1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-27 00:29:31 +00:00

Added scrcode macro for the Apple II.

Although the Apple II generally works with plain ASCII (i.e. in the ProDOS 8 MLI) the actual screen codes differ. This fixes #260.
This commit is contained in:
Oliver Schmidt 2016-03-27 18:26:46 +02:00
parent c0e82f4200
commit e2419ece0b
2 changed files with 54 additions and 0 deletions

48
asminc/apple2.mac Normal file
View File

@ -0,0 +1,48 @@
; Convert characters to screen codes
; Helper macro that converts and outputs one character
.macro _scrcode char
.if (char < 256)
.byte (char + 128)
.else
.error "scrcode: Character constant out of range"
.endif
.endmacro
.macro scrcode arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9
; Bail out if next argument is empty
.if .blank (arg1)
.exitmacro
.endif
; Check for a string
.if .match ({arg1}, "")
; Walk over all string chars
.repeat .strlen (arg1), i
_scrcode {.strat (arg1, i)}
.endrepeat
; Check for a number
.elseif .match (.left (1, {arg1}), 0)
; Just output the number
_scrcode arg1
; Check for a character
.elseif .match (.left (1, {arg1}), 'a')
; Just output the character
_scrcode arg1
; Anything else is an error
.else
.error "scrcode: invalid argument type"
.endif
; Call the macro recursively with the remaining args
scrcode arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9
.endmacro

View File

@ -4450,6 +4450,12 @@ The package defines the following macros:
<sect1><tt>.MACPACK apple2</tt><p>
This macro package defines a macro named <tt/scrcode/. It takes a string
as argument and places this string into memory translated into screen codes.
<sect1><tt>.MACPACK atari</tt><p>
This macro package defines a macro named <tt/scrcode/. It takes a string