Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 5) The program of 8.34 executes, generating an interrupt for DECO. For figure 8.6, the entry to an exit from the trap handler, state the values in the following registers as four hexadecimal digits.
- (a) X{8..15} after LDBX at FC52 (b) X after ASRX at FC69
- (c) X after SUBX at FC6A (d)PC after CALL at FC6E
- (e) PC after RETTR at FC71
- Figure 8.6:
- ;********* Trap handler
- oldIR: .EQUATE 9
- ;
- FC52 DB0009 trap: LDBX oldIR,s ;X < - trapped IR
- FC55 B80028 CPBX 0x0028,i ;If X >= first nonunary trap opcode
- FC58 1CFC67 BRGE nonUnary ; trap opcode is nonunary
- ;
- FC5B 880001 unary: ANDX 0x0001,i ;Mask out all but the rightmost bit
- FC5E 0B ASLX ;Two bytes per address
- FC5F 25FC63 CALL unaryJT,x ;Call unary trap routine
- FC62 02 RETR ;Return from trap
- ;
- FC63 FD6B unaryJT:.ADDRSS opcode26 ;Address of NOP0 subroutine
- FC65 FD6C .ADDRSS opcode27 ;Address of NOP1 subroutine
- ;
- FC67 0D nonUnary:ASRX ;Trap opcode is nonunary
- FC68 0D ASRX
- FC69 0D ASRX
- FC6A 780005 SUBX 5,i ;Adjust so that NOP opcode = 0
- FC6D 0B ASLX ;Two bytes per address
- FC6E 25FC72 CALL nonUnJT,x ;Call nonunary trap routine
- FC71 02 return: RETTR ;Return from trap
- ;
- FC72 FD6D nonUnJT: .ADDRSS opcode28 ;Address of NOP subroutine
- FC74 FD77 .ADDRSS opcode30 ;Address of DECI subroutine
- FC76 FEEB .ADDRSS opcode38 ;Address of DECO subroutine
- FC78 FF76 .ADDRSS opcode40 ;Address of HEXO subroutine
- FC7A FFC2 .ADDRSS opcode48 ;Address of STRO subroutine
- ---
- Figure 8.34:
- 0000 120005 BR main ;branch around data
- 0003 0000 num: .BLOCK 2 ;Global variable
- 0005 310003 main: DECI num,d ;Input decimal value
- 0008 390003 DECO num,d ;Output decimal value
- 000B D0000A LDBA '\n',i
- 000E F1FC16 STBA charOut,d ;Output message
- 0011 490015 STRO msg,d
- 0014 00 STOP
- 0015 546861 msg: .ASCII "That's all. \x00"
- 742773
- 20616C
- 6C2E00
- 0021 .END
Add Comment
Please, Sign In to add comment