This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: Appendix F Selected Solutions F.9 Chapter 9 Solutions 9.1 The most important advantage of doing I/O through a trap routine is the fact that it is not necessary for the programmer to know the gory low-level details of the speciFc hardwares input/output mechanism. These details include: the hardware data registers for the input and output devices the hardware status registers for the input and output devices the asynchronous nature of the input relative to the executing program Besides, these details may change from computer to computer. The programmer would have to know these details for the computer shes working on in order to be able to do input/output. Using a trap routine requires no hardware-speciFc knowledge on part of the programmer and saves time. 9.3 (a) Some external mechanism is the only way to start the clock (hence, the computer) af-ter it is halted. The Halt service routine can never return after bit 15 of the machine control register is cleared because the clock has stopped, which means that instruction processing has stopped. (b) STI R0, MCR This instruction clears the most signiFcant bit of the machine control register, stopping the clock. (c) LD R1, SaveR1 (d) The RET of the HALT routine will bring program control back to the program that executed the HALT instruction. The PC will point to the address following the HALT instruction. 9.5 Note: This problem should be corrected to read as follows: .ORIG x3000 LEA R0, LABEL 1 2 APPENDIXF.SELECTEDSOLUTIONS STR R1, R0, #3 TRAP x22 TRAP x25 LABEL .STRINGZ "FUNKY" LABEL2 .STRINGZ "HELLO WORLD" .END Answer: FUN 9.7 Note: This problem belongs in chapter 10....
View Full Document
- Spring '08