From: Daniel Serpell Date: Sun, 2 Dec 2018 03:41:36 +0000 (-0300) Subject: Adds test code for the Atari (xex) linker file format. X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=2190703a576aebd71673009e73f0aa6de457ca47;p=cc65 Adds test code for the Atari (xex) linker file format. --- diff --git a/testcode/lib/atari/asm-xex.s b/testcode/lib/atari/asm-xex.s new file mode 100644 index 000000000..d2a8d0335 --- /dev/null +++ b/testcode/lib/atari/asm-xex.s @@ -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 + 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 + diff --git a/testcode/lib/atari/multi-xex.cfg b/testcode/lib/atari/multi-xex.cfg new file mode 100644 index 000000000..18dfff820 --- /dev/null +++ b/testcode/lib/atari/multi-xex.cfg @@ -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; +} diff --git a/testcode/lib/atari/multi-xex.s b/testcode/lib/atari/multi-xex.s new file mode 100644 index 000000000..7957ddf64 --- /dev/null +++ b/testcode/lib/atari/multi-xex.s @@ -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 +