home *** CD-ROM | disk | FTP | other *** search
/ APDL Public Domain 1 / APDL_PD1A.iso / program / debug / wimpdebug / !WimpDebug / Macros / AAsm next >
Encoding:
Text File  |  1991-08-27  |  3.6 KB  |  150 lines

  1. ;> <WimpDebug$Dir>.Macros.AAsm
  2.  
  3. ;      ******* Call WimpDebug to display an item *******
  4.  
  5. ; Syntax: Show <reg#>,<icon#>[,<type>[,<offset>]]
  6. ;         ShowStr <icon#>,<string>
  7.  
  8. ;    'Show' computes and assembles an SWI instruction which orders WimpDebug
  9. ;    to display the required register in the specified icon, using the 
  10. ;    specified method of display.
  11. ;    'ShowReg' is for displaying string constants.
  12.  
  13. ; The display type is specified as follows:
  14. ;  Numbers: <base>[B][I]
  15. ;             base: Hex, DecS, DecU, Bin
  16. ;              options: B select byte value, I enables indirection
  17. ;             also 'PC', which shows the number as R15 (PC & PSR separately)
  18. ;  Strings: String<term>
  19. ;             term: Z, CR, or SP (for zero, 0/LF/CR or space termination)
  20.  
  21. ; NOTE: all bases, terminators and options must be specified in the correct
  22. ;       letter case, as shown, because comparison within the macro is
  23. ;       case sensitive.
  24. ;       If you specify an offset, indirection is implied.
  25.  
  26.  
  27.         MACRO
  28. $label  Show    $reg,$icon,$type,$offset
  29.         LCLL    indir
  30.         LCLL    string
  31.         LCLL    byteop
  32.         LCLA    opcode
  33.         LCLS    workstr
  34.         LCLA    swinum
  35.  
  36. workstr SETS    "$type"
  37.         ASSERT  $icon>=0:LAND:$icon<=31
  38.  
  39. ; --- Treat the 'display without type' operation ---
  40.  
  41.   [       "$type"=""
  42.         ASSERT  "$offset"=""
  43. opcode  SETA    &20
  44.   |
  45.  
  46. ; --- Separate number and string operations ---
  47.  
  48.         [       :LEN:"$workstr">6
  49. string  SETL    "$workstr":LEFT:6="String"
  50.         |
  51. string  SETL    {FALSE}
  52.         ]
  53.      [       "$string"="T"
  54.  
  55. ; --- Deal with string operations
  56.  
  57. workstr SETS    "$workstr":RIGHT:(:LEN:"$workstr"-6)
  58. opcode  SETA    &100
  59.         [       "$workstr"="Z"
  60. opcode  SETA    8
  61.         ]
  62.         [       "$workstr"="CR"
  63. opcode  SETA    9
  64.         ]
  65.         [       "$workstr"="SP"
  66. opcode  SETA    10
  67.         ]
  68.         ASSERT  opcode<>&100
  69.  
  70.      |
  71.  
  72. ; --- Deal with number operations ---
  73.  
  74. indir   SETL    "$workstr":RIGHT:1="I"                  ; 'I'ndirection
  75.         [       "$indir"="T"
  76. workstr SETS    "$workstr":LEFT:(:LEN:"$workstr"-1)
  77.         ]
  78.  
  79. byteop  SETL    "$workstr":RIGHT:1="B"                  ; 'B'yte-op
  80.         [       "$byteop"="T"
  81. workstr SETS    "$workstr":LEFT:(:LEN:"$workstr"-1)
  82.         ]
  83.  
  84. opcode  SETA    &100
  85.         [       "$workstr"="Hex"
  86. opcode  SETA    0
  87.         ]
  88.         [       "$workstr"="DecS"
  89. opcode  SETA    2
  90.         ]
  91.         [       "$workstr"="DecU"
  92. opcode  SETA    4
  93.         ]
  94.         [       "$workstr"="Bin"
  95. opcode  SETA    6
  96.         ]
  97.         [       "$workstr"="PC"
  98. opcode  SETA    &18
  99.         ASSERT  "$byteop"="F":LAND:"$indir"="F":LAND:"$offset"=""
  100.         ]
  101.         ASSERT  opcode<>&100
  102.  
  103.         [       "$byteop"="T"
  104. opcode  SETA    opcode+1
  105.         ]
  106.  
  107. ; --- Add indir bit to opcode ---
  108.  
  109.         [       "$indir"="T"
  110. opcode  SETA    opcode+8
  111.         ]
  112.  
  113.      ]
  114.  
  115. ; --- Deal with offset opcodes ---
  116.  
  117.         [       "$offset"/=""
  118.         [       opcode<8
  119. opcode  SETA    opcode+8                ; Force indirection of numbers
  120.         ]
  121. opcode  SETA    opcode+&20
  122.         ]
  123.  
  124.   ]
  125.  
  126. ; --- Assemble debug SWI instruction ---
  127.  
  128.         [       "$reg"=""
  129.         ASSERT  opcode<&20:LAND:"$offset"=""
  130. swinum  SETA    &8000:OR:$icon:OR:(opcode:SHL:5)
  131.         |
  132.         ASSERT  $reg>=0:LAND:$reg<=15
  133. swinum  SETA    $reg:OR:($icon:SHL:4):OR:(opcode:SHL:9)
  134.         ]
  135. $label  SWI     &FF0000:OR:swinum
  136.         [       "$offset"/=""
  137.         &       $offset
  138.         ]
  139.         MEND
  140.  
  141.         MACRO
  142. $label  ShowStr $icon,$string
  143.         ASSERT  $icon>=0:LAND:$icon<=31
  144. $label  SWI     &FF8400:OR:$icon
  145.         =       "$string",0
  146.         ALIGN
  147.         MEND
  148.  
  149.         END
  150.