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

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: EEL 3801 EEL 3801 Computer Organization Computer Organization Spring 2010 Spring 2010 Chapter 2 Chapter 2 Machine Instructions and Machine Instructions and Programs Programs Hamacher et al , Computer Organization Acknowledgment and appreciation for various slide materials from Dr. Philip Wilsey, Dr. Randy Katz, Dr. Philip Leong 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 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. Stacks s A stack is a list of data elements (usually words or bytes) s Accessing restriction: elements can be added or removed at one end of the list only s Last-in-first-out (LIFO) stack s Push: placing a new item on the stack, Pop: removing the top item from the stack s Can be implemented in several ways, one way is s First element placed in BOTTOM s Grow in direction of decreasing memory address s Assume 32-bit data Figure 2.21. A stack of words in the memory. register Stack pointer 17 BOTTOM SP Current top element element Bottom Stack 2 k 1- 739 43 28- 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...
View Full Document

This note was uploaded on 04/02/2010 for the course EEL 3801 taught by Professor Froosh during the Spring '08 term at University of Central Florida.

Page1 / 13

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

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online