]> git.sur5r.net Git - cc65/blob - asminc/atari5200.mac
changed version, startup screen now not fine anymore
[cc65] / asminc / atari5200.mac
1 ; Convert characters to screen codes
2
3 ; Helper macro that converts and outputs one character
4 .macro _scrcode char
5 .if 1
6         .if (char >= 96) .and (char <= 127)
7         .byte (char)
8         .else
9         .byte (char - 32)
10         .endif
11 .else
12         .if (char >= 0) .and (char <= 31)
13                 .byte   (char + 64)
14         .elseif (char >= 32) .and (char <= 95)
15                 .byte   (char + 32)
16         .elseif (char >= 96) .and (char <= 127)
17                 .byte   char
18         .elseif (char >= 128) .and (char <= 159)
19                 .byte   (char + 64)
20         .elseif (char >= 160) .and (char <= 223)
21                 .byte   (char - 32)
22         .elseif (char >= 224) .and (char <= 255)
23                 .byte   char
24         .else
25                 .error  "scrcode: Character constant out of range"
26         .endif
27 .endif
28 .endmacro
29
30 .macro  scrcode arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9
31
32         ; Bail out if next argument is empty
33         .if     .blank (arg1)
34                 .exitmacro
35         .endif
36
37         ; Check for a string
38         .if     .match ({arg1}, "")
39
40                 ; Walk over all string chars
41                 .repeat .strlen (arg1), i
42                         _scrcode        {.strat (arg1, i)}
43                 .endrepeat
44
45         ; Check for a number
46         .elseif .match (.left (1, {arg1}), 0)
47
48                 ; Just output the number
49                 _scrcode        arg1
50
51         ; Check for a character
52         .elseif .match (.left (1, {arg1}), 'a')
53
54                 ; Just output the character
55                 _scrcode        arg1
56
57         ; Anything else is an error
58         .else
59
60                 .error  "scrcode: invalid argument type"
61
62         .endif
63
64         ; Call the macro recursively with the remaining args
65         scrcode arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9
66 .endmacro