{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

ch2 part D - EEL EEL 3801 Computer Organization Spring 2010...

Info icon This preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
EEL 3801 Computer Organization Spring 2010 Chapter 2 Machine Instructions and Programs Hamacher et al , Computer Organization Acknowledgment and appreciation for various slide materials from Dr. Philip Wilsey, Dr. Randy Katz, Dr. Philip Leong
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Basic I/O Operations Move #LOC,R0 Initialize pointer register R0to point to the address of the first locationin memory where the characters are to be stored. READ TestBit #3,INST ATUS Wait for a character to be entered Branch=0 READ in the keyboard buffer DATAIN. MoveByte DATAIN,(R0) Transfer thecharacter from DATAIN into the memory (this clears SIN to 0). ECHO TestBit #3,OUTSTATUS Wait for the displa y to becomeready. Branch=0 ECHO MoveByte (R0),DATAOUT Movethecharacter just read to the displa y buffer register (this clears SOUT to 0). Compare #CR,(R0)+ Check if thecharacter just read is CR (carriage return). If it is not CR, then Branch 0 READ branch back and read another character. Also, increment the pointer to store the next character. Figure 2.20. A program that reads a line of characters and displays it.
Image of page 2
Stacks square6 A stack is a list of data elements (usually words or bytes) square6 Accessing restriction: elements can be added or removed at one end of the list only square6 Last-in-first-out (LIFO) stack square6 Push: placing a new item on the stack, Pop: removing the top item from the stack square6 Can be implemented in several ways, one way is square6 First element placed in BOTTOM square6 Grow in direction of decreasing memory address square6 Assume 32-bit data Figure 2.21. A stack of words in the memory. register Stack pointer 17 BOTTOM 0 SP Current top element element Bottom Stack 2 k 1 - 739 43 28 -
Image of page 3

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Stacks (b) After pop into ITEM (a) After push from NEWITEM 17 739 43 ITEM SP Stack SP NEWITEM 19 17 739 19 43 28 - 28 - 28 - SAFEPOP Compare #2000,SP Checkto see ifthestack pointer contains Branch>0 EMPTYERROR anaddressvaluegreater than 2000. If it does,the stackis empty. Branch to the
Image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern