1 ; Convert characters to screen codes
3 ; Helper macro that converts and outputs one character
6 .byte <(.strat ("h@dbdlhh", char >> 5) << 4) ^ char
8 .error "scrcode: Character constant out of range"
12 .macro scrcode arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9
14 ; Bail out if next argument is empty
20 .if .match ({arg1}, "")
22 ; Walk over all string chars
23 .repeat .strlen (arg1), i
24 _scrcode {.strat (arg1, i)}
28 .elseif .match (.left (1, {arg1}), 0)
30 ; Just output the number
33 ; Check for a character
34 .elseif .match (.left (1, {arg1}), 'a')
36 ; Just output the character
39 ; Anything else is an error
42 .error "scrcode: invalid argument type"
46 ; Call the macro recursively with the remaining args
47 scrcode arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9