Useful objasm macros

 

I don't like the DCx version of allocating storage, I'm used to the EQUx method provided by the BASIC assembler...

EQUB

          ; EQUB <value>
          MACRO
          EQUB    $var
          DCB     $var
          MEND

EQUW

          ; EQUW <value>
          MACRO
          EQUW    $var
          DCW     $var
          MEND

EQUD

          ; EQUD <value>
          MACRO
          EQUD    $var
          DCD     $var
          MEND

EQUD

          ; EQUS "<value>"
          ; For 'EQUS "something", 13, 0'
          ; you will need use DCB directly.
          MACRO
          EQUS    $var
          DCB     "$var"
          MEND

 

You might like to try something such as:

          ; EQUSZ "<value>"
          MACRO
          EQUSZ   $var
          DCB     "$var", 0
          MEND
though I've not tested this one.

RLIST

You can use RLIST to define ranges of registers:
stm_temp  RLIST {R0-R3,R14}
ldm_temp  RLIST {R0-R3,PC}
str_temp  RLIST {R0-R3}
Then, in your code, instead of:
  STMFD R13!, {R0-R3, R14}
  ...
  LDMFD R13!, {R0-R3, PC}

you could write:
  STMFD R13!, stm_temp
  ...
  LDMFD R13!, ldm_temp

The 'str_temp' version is for when you want to store/load without messing with R14/PC. The same is used for both loading and storing.


Return to assembler index
Copyright © 2001 Richard Murray