Add test programs

This commit is contained in:
Byron Lathi
2022-12-23 14:20:44 -05:00
parent 9947fbdfe2
commit 33e33231a7
4 changed files with 101 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
TARGETS=stacktest runram
all: $(TARGETS)
$(TARGETS):
cl65 --cpu 65c02 -C link.ld -l $@.list $@.s
xxd -ps $@ | fold -w 2 > $@.hex
clean:
rm $(TARGETS)
rm *.hex
rm *.list

View File

@@ -0,0 +1,30 @@
MEMORY
{
ZP: start = $0, size = $100, type = rw, define = yes;
SDRAM: start = $200, size = $ff00, type = rw, define = yes;
ROM: start = $ff00, size = $100, file = %O;
}
SEGMENTS {
ZEROPAGE: load = ZP, type = zp, define = yes;
CODE: load = ROM, type = ro;
RODATA: load = ROM, type = ro;
VECTORS: load = ROM, type = ro, start = $FFFA;
}
FEATURES {
CONDES: segment = STARTUP,
type = constructor,
label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__;
CONDES: segment = STARTUP,
type = destructor,
label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__;
}
SYMBOLS {
# Define the stack size for the application
__STACKSIZE__: value = $0200, type = weak;
__STACKSTART__: type = weak, value = $0800; # 2k stack
}

View File

@@ -0,0 +1,36 @@
.code
loadaddr = $1000
main:
ldx #(loadend-loadstart)
loadloop:
lda loadstart,x
sta loadaddr,x
dex
bpl loadloop
jsr loadaddr
end: bra end
loadstart:
stacktest:
lda #$55
pha
lda #$00
pla
sta $efff
rts
loadend:
.segment "VECTORS"
.addr main
.addr main
.addr main

View File

@@ -0,0 +1,23 @@
.code
main: lda #$ff
jsr stacktest
end: bra end
stacktest:
lda #$55
pha
lda #$00
pla
sta $efff
rts
.segment "VECTORS"
.addr main
.addr main
.addr main