1 ; Convert characters to screen codes
3 ; Macro that converts one character.
4 ; scrbyte() can be used as an instruction operand
5 .define scrbyte(code) (<(.strat ("h@dbdlhh", code >> 5) << 4) ^ code)
7 ; Helper macro that stores one character
12 .error "scrcode: Character constant out of range"
16 .macro scrcode arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9
18 ; Bail out if next argument is empty
24 .if .match ({arg1}, "")
26 ; Walk over all string chars
27 .repeat .strlen (arg1), i
28 _scrcode {.strat (arg1, i)}
32 .elseif .match (.left (1, {arg1}), 0)
34 ; Just output the number
37 ; Check for a character
38 .elseif .match (.left (1, {arg1}), 'a')
40 ; Just output the character
43 ; Anything else is an error
45 .error "scrcode: invalid argument type"
48 ; Call the macro recursively with the remaining args
49 scrcode arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9