CS252 MIDTERM 4 Rebecca Lam 5/9/2012

advertisement
CS252 MIDTERM 4
Rebecca Lam
5/9/2012
Announcements
• Date: Friday, May 11
• Room: CS1221 (This room)
• Time: 11:00-11:50
• Scope: Ch 7, 8, 9.1, 9.2
• No calculators (as usual)
• Provided Appendices:
• LC-3 instruction set (see Midterm 3)
Topics
• Assembly
• Language
• Pseudo-ops, instruction format
• Two-pass Process
• Errors (Syntax, logic, data)
• Miscellaneous
• Multiple object files, loading, linking
• Subroutines
• Callee-save, caller-save
• Return address
• JSR, JSRR, RET
Topics (cont’d)
• I/O
• Access methods: memory-mapped vs special instructions
• Timing: Asynchronous vs synchronous
• Control transfer: Host (polling) vs device (interrupts)
• LC-3 I/O
• Memory-mapped I/O
• KBSR, KBDR, DSR, DDR
• Keyboard input procedure
• Data display / output procedure
• Interrupt-driven I/O
• Interrupt enable bit
• Priority levels
• How is it checked?
Topics (cont’d)
• LC-3 System calls / service routines (TRAP)
• Built in: HALT< IN, OUT, GETC, PUTS
• System control block / trap vector table
• 0x0000 – 0x00FF
• Execution of TRAP
Subroutines
• Subroutine structure
• LABEL code RET (Recommended)
• LABEL code JMP R#
• LABEL code BRnzp RETADDR -> Drawbacks?
• Ways to call subroutines
1. JSR LABEL (Recommended)
2. JSRR R# -> Drawbacks?
3. JMP LABEL -> Drawbacks?
4. BRnzp LABEL -> Drawbacks?
TRAP
• What happens when we call the TRAP instruction?
1. R7 loaded with PC’
2. Access TRAP vector table in memory
3. Load contents in vector table into PC
4. Execute contents of service routine
5. Return to address in R7
I/O
• KBSR
• Bit15 = keyboard has received new char
• KBDR
• Bits[7:0] = ASCII char last typed on the keyboard
• DSR
• Bit15 = Display is ready to receive another character
• DDR
• Bits[7:0] = ASCII char to be displayed on the screen
Examples
• Fall 2011 Exam 4
• Time permitting, select problems from:
• Spring 2011 Exam 4
• Fall 2010 Exam 4
Download