msbasic/macros.s
Michael Steil ee400a016f cleanup
2008-10-12 19:18:33 +00:00

59 lines
1.3 KiB
ArmAsm

; htasc - set the hi bit on the last byte of a string for termination
; (by Tom Greene)
.macro htasc str
.repeat .strlen(str)-1,I
.byte .strat(str,I)
.endrep
.byte .strat(str,.strlen(str)-1) | $80
.endmacro
; For every token, a byte gets put into segment "DUMMY".
; This way, we count up with every token. The DUMMY segment
; doesn't get linked into the binary.
.macro define_token_init
.segment "DUMMY"
DUMMY_START:
.endmacro
; optionally define token symbol
; count up token number
.macro define_token token
.segment "DUMMY"
.ifnblank token
token := <(*-DUMMY_START)+$80
.endif
.res 1; count up in any case
.endmacro
; lay down a keyword, optionally define a token symbol
.macro keyword key, token
.segment "KEYWORDS"
htasc key
define_token token
.endmacro
; lay down a keyword and an address (RTS style),
; optionally define a token symbol
.macro keyword_rts key, vec, token
.segment "VECTORS"
.word vec-1
keyword key, token
.endmacro
; lay down a keyword and an address,
; optionally define a token symbol
.macro keyword_addr key, vec, token
.segment "VECTORS"
.addr vec
keyword key, token
.endmacro
;---------------------------------------------
; set the MSB of every byte of a string
.macro asc80 str
.repeat .strlen(str),I
.byte .strat(str,I)+$80
.endrep
.endmacro