Add cc65 artifacts to repo for now
Some checks failed
Cargo Build & Test / Rust project - latest (stable) (push) Failing after 38s
Some checks failed
Cargo Build & Test / Rust project - latest (stable) (push) Failing after 38s
This commit is contained in:
56
cc65/asminc/cbm.mac
Normal file
56
cc65/asminc/cbm.mac
Normal file
@@ -0,0 +1,56 @@
|
||||
; Convert characters to screen codes
|
||||
|
||||
; Macro that converts one character.
|
||||
; scrbyte() can be used as an instruction operand
|
||||
.define scrbyte(code) (<(.strat ("h@dbdlhh", code >> 5) << 4) ^ code)
|
||||
|
||||
; Helper macro that stores one character
|
||||
.macro _scrcode char
|
||||
.if (char < 256)
|
||||
.byte scrbyte {char}
|
||||
.else
|
||||
.error "scrcode: Character constant out of range"
|
||||
.endif
|
||||
.endmacro
|
||||
|
||||
.macro scrcode arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9
|
||||
|
||||
; Bail out if next argument is empty
|
||||
.if .blank ({arg1})
|
||||
.exitmacro
|
||||
.endif
|
||||
|
||||
; Check for a string
|
||||
.if .match ({arg1}, "")
|
||||
|
||||
; Walk over all string chars
|
||||
.repeat .strlen (arg1), i
|
||||
_scrcode {.strat (arg1, i)}
|
||||
.endrepeat
|
||||
|
||||
; Check for a number
|
||||
.elseif .match (.left (1, {arg1}), 0)
|
||||
|
||||
; Just output the number
|
||||
_scrcode arg1
|
||||
|
||||
; Check for a character
|
||||
.elseif .match (.left (1, {arg1}), 'a')
|
||||
|
||||
; Just output the character
|
||||
_scrcode arg1
|
||||
|
||||
; Check for an identifier
|
||||
.elseif .match (.left (1, {arg1}), identifier)
|
||||
|
||||
; Just output the identifier
|
||||
_scrcode arg1
|
||||
|
||||
; Anything else is an error
|
||||
.else
|
||||
.error "scrcode: invalid argument type"
|
||||
.endif
|
||||
|
||||
; Call the macro recursively with the remaining args
|
||||
scrcode arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9
|
||||
.endmacro
|
||||
Reference in New Issue
Block a user