home *** CD-ROM | disk | FTP | other *** search
- ;> <WimpDebug$Dir>.Macros.AAsm
-
- ; ******* Call WimpDebug to display an item *******
-
- ; Syntax: Show <reg#>,<icon#>[,<type>[,<offset>]]
- ; ShowStr <icon#>,<string>
-
- ; 'Show' computes and assembles an SWI instruction which orders WimpDebug
- ; to display the required register in the specified icon, using the
- ; specified method of display.
- ; 'ShowReg' is for displaying string constants.
-
- ; The display type is specified as follows:
- ; Numbers: <base>[B][I]
- ; base: Hex, DecS, DecU, Bin
- ; options: B select byte value, I enables indirection
- ; also 'PC', which shows the number as R15 (PC & PSR separately)
- ; Strings: String<term>
- ; term: Z, CR, or SP (for zero, 0/LF/CR or space termination)
-
- ; NOTE: all bases, terminators and options must be specified in the correct
- ; letter case, as shown, because comparison within the macro is
- ; case sensitive.
- ; If you specify an offset, indirection is implied.
-
-
- MACRO
- $label Show $reg,$icon,$type,$offset
- LCLL indir
- LCLL string
- LCLL byteop
- LCLA opcode
- LCLS workstr
- LCLA swinum
-
- workstr SETS "$type"
- ASSERT $icon>=0:LAND:$icon<=31
-
- ; --- Treat the 'display without type' operation ---
-
- [ "$type"=""
- ASSERT "$offset"=""
- opcode SETA &20
- |
-
- ; --- Separate number and string operations ---
-
- [ :LEN:"$workstr">6
- string SETL "$workstr":LEFT:6="String"
- |
- string SETL {FALSE}
- ]
- [ "$string"="T"
-
- ; --- Deal with string operations
-
- workstr SETS "$workstr":RIGHT:(:LEN:"$workstr"-6)
- opcode SETA &100
- [ "$workstr"="Z"
- opcode SETA 8
- ]
- [ "$workstr"="CR"
- opcode SETA 9
- ]
- [ "$workstr"="SP"
- opcode SETA 10
- ]
- ASSERT opcode<>&100
-
- |
-
- ; --- Deal with number operations ---
-
- indir SETL "$workstr":RIGHT:1="I" ; 'I'ndirection
- [ "$indir"="T"
- workstr SETS "$workstr":LEFT:(:LEN:"$workstr"-1)
- ]
-
- byteop SETL "$workstr":RIGHT:1="B" ; 'B'yte-op
- [ "$byteop"="T"
- workstr SETS "$workstr":LEFT:(:LEN:"$workstr"-1)
- ]
-
- opcode SETA &100
- [ "$workstr"="Hex"
- opcode SETA 0
- ]
- [ "$workstr"="DecS"
- opcode SETA 2
- ]
- [ "$workstr"="DecU"
- opcode SETA 4
- ]
- [ "$workstr"="Bin"
- opcode SETA 6
- ]
- [ "$workstr"="PC"
- opcode SETA &18
- ASSERT "$byteop"="F":LAND:"$indir"="F":LAND:"$offset"=""
- ]
- ASSERT opcode<>&100
-
- [ "$byteop"="T"
- opcode SETA opcode+1
- ]
-
- ; --- Add indir bit to opcode ---
-
- [ "$indir"="T"
- opcode SETA opcode+8
- ]
-
- ]
-
- ; --- Deal with offset opcodes ---
-
- [ "$offset"/=""
- [ opcode<8
- opcode SETA opcode+8 ; Force indirection of numbers
- ]
- opcode SETA opcode+&20
- ]
-
- ]
-
- ; --- Assemble debug SWI instruction ---
-
- [ "$reg"=""
- ASSERT opcode<&20:LAND:"$offset"=""
- swinum SETA &8000:OR:$icon:OR:(opcode:SHL:5)
- |
- ASSERT $reg>=0:LAND:$reg<=15
- swinum SETA $reg:OR:($icon:SHL:4):OR:(opcode:SHL:9)
- ]
- $label SWI &FF0000:OR:swinum
- [ "$offset"/=""
- & $offset
- ]
- MEND
-
- MACRO
- $label ShowStr $icon,$string
- ASSERT $icon>=0:LAND:$icon<=31
- $label SWI &FF8400:OR:$icon
- = "$string",0
- ALIGN
- MEND
-
- END
-