add softswitch read test

This commit is contained in:
Zellyn Hunter 2017-01-24 23:28:19 -06:00
parent f291ff20e2
commit 2158da2308
5 changed files with 273 additions and 6 deletions

View File

@ -23,9 +23,13 @@ Error messages can be viewed at
- [x] sha1sum assembly code (currently not used yet because it's slow)
- [x] language card tests
- [x] main/auxiliary memory softswitch behavior tests
- [x] softswitch reading tests
### TODO
- [ ] Incorporate Cxxx testing into data-driven test
- [ ] Add testcases for Cxxx testing
- [ ] weirder softswitch behavior corner cases
- [ ] floating-bus tests
## Raison d'être

View File

@ -11,6 +11,7 @@
LCRESULT = $10
LCRESULT1 = $11
AUXRESULT = $12
SOFTSWITCHRESULT = $13
CSW = $36
KSW = $38
@ -31,11 +32,13 @@
!addr DST = $08
!addr SHAINPUT = $eb
!addr SHALENGTH = $ee
!addr tmp0 = $f9
!addr tmp1 = $fa
!addr tmp2 = $fb
!addr tmp3 = $fc
!addr tmp4 = $fd
!addr tmp5 = $fe
!addr tmp6 = $ff
;; Softswitch locations.
RESET_80STORE = $C000
@ -62,6 +65,14 @@
SET_SLOTC3ROM = $C00B
READ_SLOTC3ROM = $C017
RESET_80COL = $C00C
SET_80COL = $C00D
READ_80COL = $C01F
RESET_ALTCHRSET = $C00E
SET_ALTCHRSET = $C00F
READ_ALTCHRSET = $C01E
RESET_TEXT = $C050
SET_TEXT = $C051
READ_TEXT = $C01A
@ -77,9 +88,14 @@
RESET_HIRES = $C056
SET_HIRES = $C057
READ_HIRES = $C01D
RESET_INTC8ROM = $CFFF
;; Readable things without corresponding set/reset pairs.
READ_HRAM_BANK2 = $C011
READ_HRAMRD = $C012
READ_VBL = $C019
;; CXXX utility routine locations
AUXMOVE = $C311
;; Monitor locations.
@ -118,6 +134,9 @@ main:
;; Auxiliary memory card tests.
jsr AUXMEMTESTS
;; Tests of softswitch-reading
jsr SOFTSWITCHTESTS
;; ROM SHA-1 checks.
;; jsr SHASUMTESTS - do this later, because it's SLOW!
@ -129,8 +148,9 @@ end:
!src "langcard.asm"
!src "auxmem.asm"
;!src "shasumtests.asm"
!src "softswitch.asm"
!src "resetall.asm"
;!src "shasumtests.asm"
print
lda $C081

Binary file not shown.

View File

@ -63,13 +63,13 @@ AUXMEMTESTS
lda #$44
sta $D17B
jsr .zptoaux
jsr zptoaux
sta SET_ALTZP
jsr LANGCARDTESTS_NO_CHECK
sta RESET_ALTZP
jsr .zpfromaux
jsr zpfromaux
lda LCRESULT
bne +
@ -374,7 +374,7 @@ AUXMEMTESTS
+++ rts
;;; Copy zero page to aux mem. Assumes zp pointing at main mem, and leaves it that way.
.zptoaux
zptoaux
ldx #0
- sta RESET_ALTZP
lda 0,x
@ -386,7 +386,7 @@ AUXMEMTESTS
rts
;;; Copy zero page from aux mem. Assumes zp pointing at main mem, and leaves it that way.
.zpfromaux
zpfromaux
ldx #0
- sta SET_ALTZP
lda 0,x

243
audit/softswitch.asm Normal file
View File

@ -0,0 +1,243 @@
;;; Apple IIe softswitch-reading tests
;;; Copyright © 2017 Zellyn Hunter <zellyn@gmail.com>
!zone softswitch {
.resetloc = tmp1
.setloc = tmp3
.readloc = tmp5
.loopcount = tmp0
.switch = SRC
.testtimes = 8
SOFTSWITCHTESTS
lda #1
sta SOFTSWITCHRESULT
lda MACHINE
cmp #4
bcs +
+print
!text "NOT IIE OR IIC:SKIPPING SOFTSWITCH TEST",$8D
+printed
sec
rts
+ +print
!text "TESTING SOFTSWITCHES",$8D
+printed
;; Test write-softswitches
lda #<.writeswitches
sta SRC
lda #>.writeswitches
sta SRC+1
lda #(.readswitches-.writeswitches)/6
sta .loopcount
.wrtloop
;; Copy reset/set/read locations to .resetloc, .setloc, .readloc
ldy #0
ldx #0
- lda (SRC),y
sta .resetloc,x
inc SRC
bne +
inc SRC+1
+ inx
cpx #6
bne -
jsr RESETALL
jsr zptoaux
;; Initial RESET
ldy #0
sta (.resetloc),y
ldx #.testtimes ; test `.testtimes` times
- lda (.readloc),y
bpl + ;ok
ldx #$80
jsr RESETALL
jsr .fail
+ dex
bne -
;; Ensure that reading doesn't do anything.
ldy #0
lda (.setloc),y
ldx #.testtimes ; test `.testtimes` times
- lda (.readloc),y
bpl + ;ok
ldx #$02 ;TODO: create "LEAVE" fail message
jsr RESETALL
jsr .fail
+ dex
bne -
;; Actual SET
ldy #0
sta (.setloc),y
ldx #.testtimes ; test `.testtimes` times
- lda (.readloc),y
bmi + ;ok
ldx #$82
jsr RESETALL
jsr .fail
+ dex
bne -
;; RESET again
ldy #0
sta (.resetloc),y
ldx #.testtimes ; test `.testtimes` times
- lda (.readloc),y
bpl + ;ok
ldx #$80
jsr RESETALL
jsr .fail
+ dex
bne -
dec .loopcount
bne .wrtloop
lda #(.endswitches-.readswitches)/6
sta .loopcount
.readloop
;; Copy reset/set/read locations to .resetloc, .setloc, .readloc
ldy #0
ldx #0
- lda (SRC),y
sta .resetloc,x
inc SRC
bne +
inc SRC+1
+ inx
cpx #6
bne -
jsr RESETALL
jsr zptoaux
;; Initial RESET
ldy #0
lda (.resetloc),y
ldx #.testtimes ; test `.testtimes` times
- lda (.readloc),y
bpl + ;ok
ldx #$00
jsr RESETALL
jsr .fail
+ dex
bne -
;; Actual SET
ldy #0
lda (.setloc),y
ldx #.testtimes ; test `.testtimes` times
- lda (.readloc),y
bmi + ;ok
ldx #$02
jsr RESETALL
jsr .fail
+ dex
bne -
;; RESET again
ldy #0
lda (.resetloc),y
ldx #.testtimes ; test `.testtimes` times
- lda (.readloc),y
bpl + ;ok
ldx #$00
jsr RESETALL
jsr .fail
+ dex
bne -
dec .loopcount
bne .readloop
.end
jsr RESETALL
lda SOFTSWITCHRESULT
bne .success
sec
rts
.success
+print
!text "SOFTSWITCH TESTS SUCCEEDED",$8D
+printed
clc
rts
;;; Print failure message.
;;; High bit of X = write. Low two bits of X: 0 = .resetloc, 2 = .setloc
;;; A = actual value read (which tells what we expected: the opposite)
.fail
sta SCRATCH
txa
bmi +
+print
!text "READ"
+printed
beq ++
+ +print
!text "WRITE"
+printed
++ +print
!text " AT "
+printed
txa
and #$3
tax
ldy .resetloc+1,x
lda .resetloc,x
tax
jsr PRNTYX
+print
!text " SHOULD "
+printed
lda SCRATCH
bpl +
+print
!text "RE"
+printed
+ +print
!text "SET "
+printed
ldx .readloc
ldy .readloc+1
jsr PRNTYX
+print
!text ";GOT $"
+printed
lda SCRATCH
jsr PRBYTE
lda #$8D
jsr COUT
lda #0
sta SOFTSWITCHRESULT
ldx #1
rts
.writeswitches
!word RESET_80STORE, SET_80STORE, READ_80STORE
!word RESET_RAMRD, SET_RAMRD, READ_RAMRD
!word RESET_RAMWRT, SET_RAMWRT, READ_RAMWRT
!word RESET_INTCXROM, SET_INTCXROM, READ_INTCXROM
!word RESET_ALTZP, SET_ALTZP, READ_ALTZP
!word RESET_SLOTC3ROM, SET_SLOTC3ROM, READ_SLOTC3ROM
!word RESET_80COL, SET_80COL, READ_80COL
!word RESET_ALTCHRSET, SET_ALTCHRSET, READ_ALTCHRSET
.readswitches
!word RESET_TEXT, SET_TEXT, READ_TEXT
!word RESET_MIXED, SET_MIXED, READ_MIXED
!word RESET_PAGE2, SET_PAGE2, READ_PAGE2
!word RESET_HIRES, SET_HIRES, READ_HIRES
.endswitches
} ;softswitch