mirror of
https://github.com/cc65/cc65.git
synced 2025-01-21 00:31:53 +00:00
Adds test code for the Atari (xex) linker file format.
This commit is contained in:
parent
e767c8990d
commit
2190703a57
51
testcode/lib/atari/asm-xex.s
Normal file
51
testcode/lib/atari/asm-xex.s
Normal 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
|
||||
|
31
testcode/lib/atari/multi-xex.cfg
Normal file
31
testcode/lib/atari/multi-xex.cfg
Normal 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;
|
||||
}
|
63
testcode/lib/atari/multi-xex.s
Normal file
63
testcode/lib/atari/multi-xex.s
Normal 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
|
||||
|
Loading…
x
Reference in New Issue
Block a user