From 762c746aef90893bdb6d209d027729352c8cdee8 Mon Sep 17 00:00:00 2001 From: Stefan Arentz Date: Mon, 26 Dec 2016 11:10:26 -0500 Subject: [PATCH] Adding some random tests --- tests/apple1/Makefile | 11 ++++ tests/apple1/echo.s | 24 +++++++++ tests/apple2/Makefile | 25 +++++++++ tests/apple2/echo.s | 16 ++++++ tests/apple2/lores.s | 113 +++++++++++++++++++++++++++++++++++++++ tests/apple2/textpages.s | 56 +++++++++++++++++++ 6 files changed, 245 insertions(+) create mode 100644 tests/apple1/Makefile create mode 100644 tests/apple1/echo.s create mode 100644 tests/apple2/Makefile create mode 100644 tests/apple2/echo.s create mode 100644 tests/apple2/lores.s create mode 100644 tests/apple2/textpages.s diff --git a/tests/apple1/Makefile b/tests/apple1/Makefile new file mode 100644 index 0000000..7a4154d --- /dev/null +++ b/tests/apple1/Makefile @@ -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 $< + diff --git a/tests/apple1/echo.s b/tests/apple1/echo.s new file mode 100644 index 0000000..d5e6d34 --- /dev/null +++ b/tests/apple1/echo.s @@ -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 ; diff --git a/tests/apple2/Makefile b/tests/apple2/Makefile new file mode 100644 index 0000000..d7db9c0 --- /dev/null +++ b/tests/apple2/Makefile @@ -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 $< diff --git a/tests/apple2/echo.s b/tests/apple2/echo.s new file mode 100644 index 0000000..6e0a51e --- /dev/null +++ b/tests/apple2/echo.s @@ -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 + diff --git a/tests/apple2/lores.s b/tests/apple2/lores.s new file mode 100644 index 0000000..e4c2903 --- /dev/null +++ b/tests/apple2/lores.s @@ -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 diff --git a/tests/apple2/textpages.s b/tests/apple2/textpages.s new file mode 100644 index 0000000..bc87585 --- /dev/null +++ b/tests/apple2/textpages.s @@ -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 +