Add test programs
This commit is contained in:
12
hw/efinix_fpga/test_programs/Makefile
Normal file
12
hw/efinix_fpga/test_programs/Makefile
Normal 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
|
||||||
30
hw/efinix_fpga/test_programs/link.ld
Normal file
30
hw/efinix_fpga/test_programs/link.ld
Normal 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
|
||||||
|
}
|
||||||
36
hw/efinix_fpga/test_programs/runram.s
Normal file
36
hw/efinix_fpga/test_programs/runram.s
Normal 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
|
||||||
23
hw/efinix_fpga/test_programs/stacktest.s
Normal file
23
hw/efinix_fpga/test_programs/stacktest.s
Normal 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
|
||||||
Reference in New Issue
Block a user