Adding some random tests

This commit is contained in:
Stefan Arentz 2016-12-26 11:10:26 -05:00
parent f80e7cf8e6
commit 762c746aef
6 changed files with 245 additions and 0 deletions

11
tests/apple1/Makefile Normal file
View File

@ -0,0 +1,11 @@
all: echo.bin
clean:
rm -f *.o *.bin *.lst *.hex
echo.bin: echo.o
ld65 -t none -vm -o $@ $<
echo.o: echo.s
ca65 -l $<

24
tests/apple1/echo.s Normal file
View File

@ -0,0 +1,24 @@
.ORG $8000
KBD = $D010 ; PIA.A keyboard input
KBDCR = $D011 ; PIA.A keyboard control register
DSP = $D012 ; PIA.B display output register
DSPCR = $D013 ; PIA.B display control register
MAIN: JSR GETC ;
JSR PUTC ;
CMP #$03 ;
BNE MAIN ;
BRK ;
GETC: LDA KBDCR ;
BPL GETC ; Do we have a character?
LDA KBD ; Yup, load it
RTS ;
PUTC: BIT DSP ; Bit (B7) cleared yet?
BMI PUTC ; No, wait for display
STA DSP ; Yup, send it to the display
RTS ;

25
tests/apple2/Makefile Normal file
View File

@ -0,0 +1,25 @@
all: echo.bin textpages.bin lores.bin buttons.bin
clean:
rm -f *.o *.bin *.lst *.hex
echo.bin: echo.o
ld65 -t none -vm -o $@ $<
echo.o: echo.s
ca65 -l $<
textpages.bin: textpages.o
ld65 -t none -vm -o $@ $<
textpages.o: textpages.s
ca65 -l $<
lores.bin: lores.o
ld65 -t none -vm -o $@ $<
lores.o: lores.s
ca65 -l $<
buttons.bin: buttons.o
ld65 -t none -vm -o $@ $<
buttons.o: buttons.s
ca65 -l $<

16
tests/apple2/echo.s Normal file
View File

@ -0,0 +1,16 @@
.org $8000
kybd = $c000
strobe = $c010
cout = $fded
home = $fc58
start: jsr home
loop: lda kybd
cmp #$80
bcc loop
sta strobe
jsr cout
jmp loop

113
tests/apple2/lores.s Normal file
View File

@ -0,0 +1,113 @@
.org $8000
ptr = $06
full = $c052
mixed = $c053
page1 = $c054
page2 = $c055
kybd = $c000
strobe = $c010
main: lda $c054
lda $c056
lda $c052
lda $c050
jsr clear1
jsr clear2
loop: lda page1 ; mixed page 1
lda mixed
jsr clear1
jsr settext1
jsr wait
lda page1 ;full page 1
lda full
jsr clear1
jsr wait
lda page2 ;mixed page 2
lda mixed
jsr clear2
jsr settext2
jsr wait
lda page2 ;full page 2
lda full
jsr clear2
jsr wait
jmp loop
wait: lda kybd
cmp #$80
bcc wait
sta strobe
rts
clear1: lda #$04
sta ptr+1
ldy #$00
sty ptr
start1: lda #$11
loop1: sta (ptr),y
iny
bne loop1
nxt1: inc ptr+1
lda ptr+1
cmp #$08
bcc start1
rts
clear2: lda #$08
sta ptr+1
ldy #$00
sty ptr
start2: lda #$22
loop2: sta (ptr),y
iny
bne loop2
nxt2: inc ptr+1
lda ptr+1
cmp #$0c
bcc start2
rts
settext1: lda #$06
sta ptr+1
ldy #$50
sty ptr
xstart2: lda #$B1
xloop2: sta (ptr),y
iny
bne xloop2
xnxt2: inc ptr+1
lda ptr+1
cmp #$08
bcc xstart2
rts
settext2: lda #$0a
sta ptr+1
ldy #$50
sty ptr
ystart2: lda #$B2
yloop2: sta (ptr),y
iny
bne yloop2
ynxt2: inc ptr+1
lda ptr+1
cmp #$0c
bcc ystart2
rts

56
tests/apple2/textpages.s Normal file
View File

@ -0,0 +1,56 @@
.org $8000
ptr = $06
page2off = $c054
page2on = $c055
kybd = $c000
strobe = $c010
main: jsr clear1
jsr clear2
loop: lda page2off
jsr wait
lda page2on
jsr wait
jmp loop
wait: lda kybd
cmp #$80
bcc wait
sta strobe
rts
clear1: lda #$04
sta ptr+1
ldy #$00
sty ptr
start1: lda #'1'
loop1: sta (ptr),y
iny
bne loop1
nxt1: inc ptr+1
lda ptr+1
cmp #$08
bcc start1
rts
clear2: lda #$08
sta ptr+1
ldy #$00
sty ptr
start2: lda #'2'
loop2: sta (ptr),y
iny
bne loop2
nxt2: inc ptr+1
lda ptr+1
cmp #$0c
bcc start2
rts