ShiningDrake

Untitled

Apr 14th, 2019
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.92 KB | None | 0 0
  1. 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.
  2.  
  3. (a) X{8..15} after LDBX at FC52 (b) X after ASRX at FC69
  4. (c) X after SUBX at FC6A (d)PC after CALL at FC6E
  5. (e) PC after RETTR at FC71
  6.  
  7.  
  8. Figure 8.6:
  9.  
  10. ;********* Trap handler
  11. oldIR: .EQUATE 9
  12. ;
  13. FC52 DB0009 trap: LDBX oldIR,s ;X < - trapped IR
  14. FC55 B80028 CPBX 0x0028,i ;If X >= first nonunary trap opcode
  15. FC58 1CFC67 BRGE nonUnary ; trap opcode is nonunary
  16. ;
  17. FC5B 880001 unary: ANDX 0x0001,i ;Mask out all but the rightmost bit
  18. FC5E 0B ASLX ;Two bytes per address
  19. FC5F 25FC63 CALL unaryJT,x ;Call unary trap routine
  20. FC62 02 RETR ;Return from trap
  21. ;
  22. FC63 FD6B unaryJT:.ADDRSS opcode26 ;Address of NOP0 subroutine
  23. FC65 FD6C .ADDRSS opcode27 ;Address of NOP1 subroutine
  24. ;
  25. FC67 0D nonUnary:ASRX ;Trap opcode is nonunary
  26. FC68 0D ASRX
  27. FC69 0D ASRX
  28. FC6A 780005 SUBX 5,i ;Adjust so that NOP opcode = 0
  29. FC6D 0B ASLX ;Two bytes per address
  30. FC6E 25FC72 CALL nonUnJT,x ;Call nonunary trap routine
  31. FC71 02 return: RETTR ;Return from trap
  32. ;
  33. FC72 FD6D nonUnJT: .ADDRSS opcode28 ;Address of NOP subroutine
  34. FC74 FD77 .ADDRSS opcode30 ;Address of DECI subroutine
  35. FC76 FEEB .ADDRSS opcode38 ;Address of DECO subroutine
  36. FC78 FF76 .ADDRSS opcode40 ;Address of HEXO subroutine
  37. FC7A FFC2 .ADDRSS opcode48 ;Address of STRO subroutine
  38.  
  39. ---
  40.  
  41. Figure 8.34:
  42.  
  43. 0000 120005 BR main ;branch around data
  44. 0003 0000 num: .BLOCK 2 ;Global variable
  45. 0005 310003 main: DECI num,d ;Input decimal value
  46. 0008 390003 DECO num,d ;Output decimal value
  47. 000B D0000A LDBA '\n',i
  48. 000E F1FC16 STBA charOut,d ;Output message
  49. 0011 490015 STRO msg,d
  50. 0014 00 STOP
  51. 0015 546861 msg: .ASCII "That's all. \x00"
  52. 742773
  53. 20616C
  54. 6C2E00
  55. 0021 .END
Add Comment
Please, Sign In to add comment