1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-23 04:30:10 +00:00

Made CBM scrcode assembly-macro properly handle all 256 codes.

And, made it smaller.
This commit is contained in:
Greg King 2013-04-25 12:32:49 -04:00
parent 3afc8ddcf3
commit 662aef4efa

View File

@ -2,20 +2,8 @@
; Helper macro that converts and outputs one character ; Helper macro that converts and outputs one character
.macro _scrcode char .macro _scrcode char
.if (char >= '@' .and char <= 'z') .if (char < 256)
.byte (char - '@') .byte <(.strat ("h@dbdlhh", char >> 5) << 4) ^ char
.elseif (char >= 'A' .and char <= 'Z')
.byte (char - 'A' + 65)
.elseif (char = '[')
.byte 27
.elseif (char = ']')
.byte 29
.elseif (char = '^')
.byte 30
.elseif (char = '_')
.byte 31
.elseif (char < 256)
.byte char
.else .else
.error "scrcode: Character constant out of range" .error "scrcode: Character constant out of range"
.endif .endif
@ -24,7 +12,7 @@
.macro scrcode arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9 .macro scrcode arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9
; Bail out if next argument is empty ; Bail out if next argument is empty
.if .blank (arg1) .if .blank ({arg1})
.exitmacro .exitmacro
.endif .endif