1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-01 13:41:34 +00:00

Adds test code for the Atari (xex) linker file format.

This commit is contained in:
Daniel Serpell 2018-12-02 00:41:36 -03:00
parent e767c8990d
commit 2190703a57
3 changed files with 145 additions and 0 deletions

View File

@ -0,0 +1,51 @@
; Sample using ATARI file format, by "atari-xex.cfg" linker configuration.
;
; This is a very simple example, shows a message to the screen, waits and
; returns to DOS.
;
; Compile with:
; cl65 -tatari -Catari-xex.cfg asm-xex.s -o prog.xex
.include "atari.inc"
; Default RUNAD is "start", export that:
.export start
; Write string to screen
.proc puts
sta ICBAL
stx ICBAH
lda #PUTREC
sta ICCOM
ldx #$FF
stx ICBLL
inx
stx ICBLH
jsr CIOV
rts
.endproc
; Write a message and exit
.proc start
lda #<msg
ldx #>msg
jsr puts
; Delay before returning to DOS
lda #0
tax
loop:
inx
cpx #$FF
adc #0
bcc loop
rts
.endproc
msg: .byte "Hello world", ATEOL

View File

@ -0,0 +1,31 @@
FEATURES {
STARTADDRESS: default = $2E00;
}
MEMORY {
ZP: file = "", define = yes, start = $0082, size = $007E;
# First memory segment in file, load over COLOR registers:
COLOR: file = %O, start = $2C4, size = 5;
# Second memory segment, load at page 6:
PAGE6: file = %O, start = $600, size = 256;
# Third memory segment in file, load over SDLST register:
SDLST: file = %O, start = $230, size = 2;
# Main segment, load at "STARTADDRESS"
MAIN: file = %O, start = %S, size = $BC20 - %S;
}
FILES {
%O: format = atari;
}
FORMATS {
atari: runad = start;
}
SEGMENTS {
ZEROPAGE: load = ZP, type = zp, optional = yes;
# Place segments in memory areas:
COLOR: load = COLOR, type = rw;
PAGE6: load = PAGE6, type = rw;
SDLST: load = SDLST, type = rw;
CODE: load = MAIN, type = rw;
RODATA: load = MAIN, type = ro optional = yes;
DATA: load = MAIN, type = rw optional = yes;
BSS: load = MAIN, type = bss, optional = yes, define = yes;
}

View File

@ -0,0 +1,63 @@
; Multiple segment ATARI file format sample, using custom linker script.
;
; This sample defines a custom display-list screen with no code, writing all
; memory areas directly.
;
; See the linker script (multi-xex.cfg) for the definition of memory areas and
; segments.
;
; Compile with:
; cl65 -tatari -Cmulti-xex.cfg multi-xex.s -o prog.xex
.include "atari.inc"
.macpack atari
; Default RUNAD is "start", export that:
.export start
; We load color values directly into registers
.segment "COLOR"
.byte $16 ; COLOR0
.byte $46 ; COLOR1
.byte $00 ; COLOR2
.byte $6A ; COLOR3
.byte $82 ; COLOR4
; We load our display list over page 6
.segment "PAGE6"
display_list:
.byte DL_BLK8
.byte DL_BLK8
.byte DL_BLK8
.byte DL_BLK8
.byte DL_BLK8
.byte DL_BLK8
.byte DL_CHR20x8x2 | DL_LMS
.word screen_memory
.byte DL_CHR40x8x1
.byte DL_JVB
.word display_list
screen_memory:
; first text line: 20 bytes
scrcode " HeLlO wOrLd! "
; second text line, 40 bytes
.byte 0, 0, 0, 0, 0, 0, 0, 0,70,71,70,71,70,71,70,71,70,71,70,71
.byte 70,71,70,71,70,71,70,71,70,71,70,71, 0, 0, 0, 0, 0, 0, 0, 0
; We write directly to the display list pointer
.segment "SDLST"
.word display_list
; And we load our main program
.code
.proc start
; Jump forever
jmp start
.endproc