rename testcode/ to targettest/
This commit is contained in:
61
targettest/atari/Makefile
Normal file
61
targettest/atari/Makefile
Normal file
@@ -0,0 +1,61 @@
|
||||
|
||||
# Just the usual way to find out if we're
|
||||
# using cmd.exe to execute make rules.
|
||||
ifneq ($(shell echo),)
|
||||
CMD_EXE = 1
|
||||
endif
|
||||
|
||||
ifdef CMD_EXE
|
||||
NULLDEV = nul:
|
||||
DEL = -del /f
|
||||
RMDIR = rmdir /s /q
|
||||
else
|
||||
NULLDEV = /dev/null
|
||||
DEL = $(RM)
|
||||
RMDIR = $(RM) -r
|
||||
endif
|
||||
|
||||
ifdef CC65_HOME
|
||||
AS = $(CC65_HOME)/bin/ca65
|
||||
CC = $(CC65_HOME)/bin/cc65
|
||||
CL = $(CC65_HOME)/bin/cl65
|
||||
LD = $(CC65_HOME)/bin/ld65
|
||||
else
|
||||
AS := $(if $(wildcard ../../../bin/ca65*),../../../bin/ca65,ca65)
|
||||
CC := $(if $(wildcard ../../../bin/cc65*),../../../bin/cc65,cc65)
|
||||
CL := $(if $(wildcard ../../../bin/cl65*),../../../bin/cl65,cl65)
|
||||
LD := $(if $(wildcard ../../../bin/ld65*),../../../bin/ld65,ld65)
|
||||
endif
|
||||
|
||||
all: charmapping.xex defdev.xex displaylist.xex mem.xex multi.xex ostype.xex \
|
||||
scrcode.com sys.xex
|
||||
|
||||
charmapping.xex: charmapping.c
|
||||
$(CL) -t atari -o charmapping.xex charmapping.c
|
||||
defdev.xex: defdev.c
|
||||
$(CL) -t atari -o defdev.xex defdev.c
|
||||
displaylist.xex: displaylist.c
|
||||
$(CL) -t atari -o displaylist.xex displaylist.c
|
||||
mem.xex: mem.c ../getsp.s
|
||||
$(CL) -t atari -o mem.xex mem.c ../getsp.s
|
||||
multi.xex: multi-xex.s multi-xex.cfg
|
||||
$(CL) -t atari -C multi-xex.cfg multi-xex.s -o multi.xex
|
||||
ostype.xex: ostype.c
|
||||
$(CL) -t atari -o ostype.xex ostype.c
|
||||
scrcode.com: scrcode.s
|
||||
# ca65 -t atari -o scrcode.o scrcode.s
|
||||
# ld65 -C atari-asm.cfg -o scrcode.com scrcode.o
|
||||
$(CL) -t atari -C atari-asm.cfg -o scrcode.com scrcode.s
|
||||
sys.xex: sys.c
|
||||
$(CL) -t atari -o sys.xex sys.c
|
||||
|
||||
clean:
|
||||
$(RM) charmapping.xex
|
||||
$(RM) defdev.xex
|
||||
$(RM) displaylist.xex
|
||||
$(RM) mem.xex
|
||||
$(RM) multi.xex
|
||||
$(RM) ostype.xex
|
||||
$(RM) scrcode.o
|
||||
$(RM) scrcode.com
|
||||
$(RM) sys.xex
|
||||
51
targettest/atari/asm-xex.s
Normal file
51
targettest/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
|
||||
|
||||
63
targettest/atari/charmapping.c
Normal file
63
targettest/atari/charmapping.c
Normal file
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
** testprogram for includes "atari_screen_charmap.h" and "atari_atascii_charmap.h"
|
||||
**
|
||||
** 19-Aug-2016, Christian Krueger
|
||||
*/
|
||||
|
||||
#include <conio.h>
|
||||
#include <atari.h>
|
||||
#include <peekpoke.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
char pcDefaultMappingString[] = "Hello Atari!";
|
||||
|
||||
#include <atari_screen_charmap.h>
|
||||
char pcScreenMappingString[] = "Hello Atari!";
|
||||
|
||||
#include <atari_atascii_charmap.h>
|
||||
char pcAtasciiMappingString[] = "Hello Atari!";
|
||||
|
||||
/* THIS WON'T work due to string merging/collection problems!
|
||||
char* pcDefaultMappingString = "Hello Atari!";
|
||||
|
||||
#include <atari_screen_charmap.h>
|
||||
char* pcScreenMappingString = "Hello Atari!";
|
||||
|
||||
#include <atari_atascii_charmap.h>
|
||||
char* pcAtasciiMappingString = "Hello Atari!";
|
||||
*/
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
static unsigned char expectedAtasciiValues[] = { 40,101,108,108,111,0,33,116,97,114,105,1};
|
||||
|
||||
int returnValue = 0;
|
||||
unsigned char* screen = (unsigned char*) PEEKW(88);
|
||||
|
||||
// check default (=atascii)
|
||||
clrscr();
|
||||
cputs(pcDefaultMappingString);
|
||||
returnValue |= memcmp(screen, expectedAtasciiValues, sizeof(expectedAtasciiValues));
|
||||
|
||||
clrscr();
|
||||
memcpy(screen, pcScreenMappingString, sizeof(expectedAtasciiValues));
|
||||
returnValue |= memcmp(screen, expectedAtasciiValues, sizeof(expectedAtasciiValues));
|
||||
|
||||
clrscr();
|
||||
cputs(pcAtasciiMappingString);
|
||||
returnValue |= memcmp(screen, expectedAtasciiValues, sizeof(expectedAtasciiValues));
|
||||
|
||||
clrscr();
|
||||
if (returnValue)
|
||||
cputs("Test FAILED!");
|
||||
else
|
||||
cputs("Test passed.");
|
||||
|
||||
cputs("\n\rHit any key to exit...");
|
||||
cgetc();
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
19
targettest/atari/defdev.c
Normal file
19
targettest/atari/defdev.c
Normal file
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
** testprogram printing the default device
|
||||
**
|
||||
** 26-Nov-2009, Christian Groessler
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <conio.h>
|
||||
#include <atari.h>
|
||||
#include <cc65.h>
|
||||
|
||||
extern char _defdev[];
|
||||
|
||||
int main(void)
|
||||
{
|
||||
printf("default device: %s\n", _defdev);
|
||||
if (doesclrscrafterexit()) cgetc();
|
||||
return 0;
|
||||
}
|
||||
64
targettest/atari/displaylist.c
Normal file
64
targettest/atari/displaylist.c
Normal file
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
** test program for ANTIC instructions as defined in "_antic.h"
|
||||
**
|
||||
** 23-Feb-2017, Christian Krueger
|
||||
*/
|
||||
|
||||
#include <conio.h>
|
||||
#include <atari.h>
|
||||
|
||||
// code is only for testing purposes, as screen and display list are not aligned,
|
||||
// and jumps not set!
|
||||
|
||||
unsigned char DummyScreen[400];
|
||||
|
||||
void DisplayList = {
|
||||
DL_BLK1,
|
||||
DL_BLK2,
|
||||
DL_BLK3,
|
||||
DL_BLK4,
|
||||
DL_BLK5,
|
||||
DL_BLK6,
|
||||
DL_BLK7,
|
||||
DL_DLI(DL_BLK8),
|
||||
DL_LMS(DL_CHR40x8x1),
|
||||
DummyScreen,
|
||||
DL_HSCROL(DL_CHR40x10x1),
|
||||
DL_VSCROL(DL_CHR40x8x4),
|
||||
DL_CHR40x16x4,
|
||||
DL_LMS(DL_HSCROL(DL_VSCROL(DL_DLI(DL_CHR20x8x2)))),
|
||||
DummyScreen+120,
|
||||
DL_CHR20x16x2,
|
||||
DL_MAP40x8x4,
|
||||
DL_MAP80x4x2,
|
||||
DL_MAP80x4x4,
|
||||
DL_MAP160x2x2,
|
||||
DL_MAP160x1x2,
|
||||
DL_MAP160x2x4,
|
||||
DL_MAP160x1x4,
|
||||
DL_MAP320x1x1,
|
||||
DL_JVB,
|
||||
DL_JMP
|
||||
};
|
||||
|
||||
|
||||
/* We know that the sizeof expression is constant; don't tell us. */
|
||||
|
||||
#pragma warn (const-comparison, off)
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
int returnValue = (sizeof DisplayList != 28); // assure only one byte per instruction!
|
||||
|
||||
clrscr();
|
||||
if (returnValue)
|
||||
cputs("Test FAILED!");
|
||||
else
|
||||
cputs("Test passed.");
|
||||
|
||||
cputs("\n\rHit any key to exit...");
|
||||
cgetc();
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
47
targettest/atari/mem.c
Normal file
47
targettest/atari/mem.c
Normal file
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
** show some memory stuff
|
||||
**
|
||||
** 04-Aug-2004, Christian Groessler
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <conio.h>
|
||||
#include <atari.h>
|
||||
#include <cc65.h>
|
||||
|
||||
extern int getsp(void); /* comes from ../getsp.s */
|
||||
|
||||
unsigned char data = 0x12; /* data variable */
|
||||
|
||||
unsigned int *APPMHI = (unsigned int *)14; /* 14,15 */
|
||||
unsigned char *RAMTOP = (unsigned char *)106; /* in pages */
|
||||
unsigned int *LOMEM = (unsigned int *)128; /* used by BASIC */
|
||||
unsigned int *MEMTOP = (unsigned int *)741;
|
||||
unsigned int *MEMLO = (unsigned int *)743;
|
||||
void *allocmem;
|
||||
|
||||
int main(void)
|
||||
{
|
||||
allocmem = malloc(257);
|
||||
|
||||
clrscr();
|
||||
|
||||
printf(" RAMTOP = %02X (%u) - $%04X (%u)\n",
|
||||
*RAMTOP, *RAMTOP, *RAMTOP * 256, *RAMTOP * 256);
|
||||
printf(" APPMHI = $%04X (%u)\n", *APPMHI, *APPMHI);
|
||||
printf(" LOMEM = $%04X (%u) <BASIC only>\n", *LOMEM, *LOMEM);
|
||||
printf(" MEMTOP = $%04X (%u)\n", *MEMTOP, *MEMTOP);
|
||||
printf(" MEMLO = $%04X (%u)\n", *MEMLO, *MEMLO);
|
||||
|
||||
printf(" ----------------------\n");
|
||||
printf(" main: $%04X (code)\n", &main);
|
||||
printf(" data: $%04X (data)\n", &data);
|
||||
printf(" _dos_type: $%04X (bss)\n", &_dos_type);
|
||||
printf(" allocmem: $%04X (dyn. data)\n", allocmem);
|
||||
printf(" sp: $%04X (stack ptr)\n", getsp());
|
||||
|
||||
if (allocmem) free(allocmem);
|
||||
if (doesclrscrafterexit()) cgetc();
|
||||
return(0);
|
||||
}
|
||||
35
targettest/atari/multi-xex.cfg
Normal file
35
targettest/atari/multi-xex.cfg
Normal file
@@ -0,0 +1,35 @@
|
||||
FEATURES {
|
||||
STARTADDRESS: default = $2E00;
|
||||
}
|
||||
MEMORY {
|
||||
ZP: file = "", define = yes, start = $0082, size = $007E;
|
||||
# First memory segment in file, show message
|
||||
LOADER: file = %O, start = $680, size = 128;
|
||||
# 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 = 128;
|
||||
# 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,
|
||||
initad = LOADER: show_load;
|
||||
}
|
||||
SEGMENTS {
|
||||
ZEROPAGE: load = ZP, type = zp, optional = yes;
|
||||
# Place segments in memory areas:
|
||||
LOADER: load = LOADER, type = rw;
|
||||
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;
|
||||
}
|
||||
80
targettest/atari/multi-xex.s
Normal file
80
targettest/atari/multi-xex.s
Normal file
@@ -0,0 +1,80 @@
|
||||
; 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, show_load
|
||||
|
||||
; Loader
|
||||
.segment "LOADER"
|
||||
show_load:
|
||||
ldx #0 ; channel 0
|
||||
lda #<msg_load
|
||||
sta ICBAL,x ; address
|
||||
lda #>msg_load
|
||||
sta ICBAH,x
|
||||
lda #$FF
|
||||
sta ICBLL,x ; length
|
||||
sta ICBLH,x
|
||||
lda #PUTREC
|
||||
sta ICCOM,x
|
||||
jmp CIOV
|
||||
|
||||
msg_load:
|
||||
.byte "Loading....", ATEOL
|
||||
|
||||
; 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
|
||||
|
||||
46
targettest/atari/ostype.c
Normal file
46
targettest/atari/ostype.c
Normal file
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
** testprogram for get_ostype() and get_tv() functions
|
||||
**
|
||||
** 09-Jul-2004, chris@groessler.org
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <atari.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
unsigned int t, v;
|
||||
unsigned char palntsc;
|
||||
unsigned char *rev;
|
||||
unsigned char minor;
|
||||
unsigned char c;
|
||||
|
||||
t = get_ostype(); /* get computer type */
|
||||
v = get_tv(); /* get tv system */
|
||||
|
||||
palntsc = (v == AT_PAL);
|
||||
|
||||
minor = (t & AT_OS_TYPE_MINOR) >> 5;
|
||||
switch(t & AT_OS_TYPE_MAIN) {
|
||||
case AT_OS_UNKNOWN:
|
||||
default:
|
||||
printf("unknown system type !!\n");
|
||||
break;
|
||||
case AT_OS_400800:
|
||||
if (minor == 1) rev = "A";
|
||||
else rev = "B";
|
||||
printf("it's a 400/800, %s, Rev. %s\n",palntsc ? "PAL" : "NTSC",rev);
|
||||
break;
|
||||
case AT_OS_1200XL:
|
||||
if (minor == 1) rev = "10";
|
||||
else rev = "11";
|
||||
printf("it's a 1200XL, %s, Rev. %s\n",palntsc ? "PAL" : "NTSC",rev);
|
||||
break;
|
||||
case AT_OS_XLXE:
|
||||
printf("is'a a XL/XE, %s, Rev. %d\n",palntsc ? "PAL" : "NTSC",minor);
|
||||
break;
|
||||
}
|
||||
printf("hit <RETURN> to continue...\n");
|
||||
c = getchar();
|
||||
return 0;
|
||||
}
|
||||
63
targettest/atari/scrcode.s
Normal file
63
targettest/atari/scrcode.s
Normal file
@@ -0,0 +1,63 @@
|
||||
; Christian Groessler, 30-Aug-2005
|
||||
;
|
||||
; scrcode macro test
|
||||
;
|
||||
; compile with
|
||||
; ca65 -I../../../asminc -tatari -o scrcode.o scrcode.s
|
||||
; ld65 -tatari -o scrcode.com scrcode.o
|
||||
|
||||
.import __CODE_LOAD__, __BSS_LOAD__
|
||||
|
||||
.include "atari.inc"
|
||||
.macpack atari
|
||||
|
||||
.code
|
||||
|
||||
rts ; SpartaDOS workaround
|
||||
|
||||
; entry point
|
||||
|
||||
lda #0
|
||||
tay
|
||||
tax
|
||||
|
||||
; display dispdata
|
||||
|
||||
disp: lda dispdata,x
|
||||
sta (SAVMSC),y
|
||||
inx
|
||||
iny
|
||||
cpx #disp_len
|
||||
bne disp
|
||||
|
||||
; wait for key press
|
||||
|
||||
key: lda CH
|
||||
cmp #255
|
||||
beq key
|
||||
|
||||
rts
|
||||
|
||||
.data
|
||||
|
||||
dispdata: scrcode "fooBa", 'r', $66, 3+4
|
||||
disp_len = * - dispdata
|
||||
|
||||
.export __AUTOSTART__: absolute = 1
|
||||
.segment "AUTOSTRT"
|
||||
|
||||
.word $02E0
|
||||
.word $02E1
|
||||
.word __CODE_LOAD__+1
|
||||
|
||||
.export __EXEHDR__: absolute = 1
|
||||
.segment "EXEHDR"
|
||||
|
||||
.word $FFFF
|
||||
|
||||
.segment "MAINHDR"
|
||||
|
||||
.word __CODE_LOAD__
|
||||
.word __BSS_LOAD__ - 1
|
||||
|
||||
.end
|
||||
39
targettest/atari/sys.c
Normal file
39
targettest/atari/sys.c
Normal file
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
** testprogram for _sys() function on Atari
|
||||
**
|
||||
** 17-Sep-2013, chris@groessler.org
|
||||
**
|
||||
** uses PUTCHR IOCB function to display a string
|
||||
*/
|
||||
|
||||
#include <atari.h>
|
||||
#include <6502.h>
|
||||
#include <conio.h>
|
||||
|
||||
#define IOCB (OS.iocb[0])
|
||||
|
||||
static struct regs regs;
|
||||
static struct __iocb *iocb = &IOCB; /* use IOCB #0 */
|
||||
|
||||
static char message[] = "I'm the sys test text\n";
|
||||
|
||||
int main(void)
|
||||
{
|
||||
/* setup IOCB for CIO call */
|
||||
iocb->buffer = message;
|
||||
iocb->buflen = sizeof(message) - 1;
|
||||
iocb->command = IOCB_PUTCHR;
|
||||
|
||||
/* setup input registers */
|
||||
regs.x = 0; /* IOCB #0 */
|
||||
regs.pc = 0xe456; /* CIOV */
|
||||
|
||||
/* call CIO */
|
||||
_sys(®s);
|
||||
|
||||
if (regs.y != 1)
|
||||
cprintf("CIO error 0x%02\r\n", regs.y);
|
||||
|
||||
cgetc();
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user