1 ; Convert characters to screen codes
3 ; Helper macro that converts and outputs one character
6 .if (char >= 96) .and (char <= 127)
12 .if (char >= 0) .and (char <= 31)
14 .elseif (char >= 32) .and (char <= 95)
16 .elseif (char >= 96) .and (char <= 127)
18 .elseif (char >= 128) .and (char <= 159)
20 .elseif (char >= 160) .and (char <= 223)
22 .elseif (char >= 224) .and (char <= 255)
25 .error "scrcode: Character constant out of range"
30 .macro scrcode arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9
32 ; Bail out if next argument is empty
38 .if .match ({arg1}, "")
40 ; Walk over all string chars
41 .repeat .strlen (arg1), i
42 _scrcode {.strat (arg1, i)}
46 .elseif .match (.left (1, {arg1}), 0)
48 ; Just output the number
51 ; Check for a character
52 .elseif .match (.left (1, {arg1}), 'a')
54 ; Just output the character
57 ; Anything else is an error
60 .error "scrcode: invalid argument type"
64 ; Call the macro recursively with the remaining args
65 scrcode arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9