1 ; Convert characters to screen codes
3 ; Helper macro that converts and outputs one character
5 .if (char >= '@' .and char <= 'z')
7 .elseif (char >= 'A' .and char <= 'Z')
8 .byte (char - 'A' + 65)
20 .error "scrcode: Character constant out of range"
24 .macro scrcode arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9
26 ; Bail out if next argument is empty
32 .if .match ({arg1}, "")
34 ; Walk over all string chars
35 .repeat .strlen (arg1), i
36 _scrcode {.strat (arg1, i)}
40 .elseif .match (.left (1, {arg1}), 0)
42 ; Just output the number
45 ; Check for a character
46 .elseif .match (.left (1, {arg1}), 'a')
48 ; Just output the character
51 ; Anything else is an error
54 .error "scrcode: invalid argument type"
58 ; Call the macro recursively with the remaining args
59 scrcode arg2, arg3, arg4, arg5, arg6, arg7, arg8