2017-01-10 02:41:06 +00:00
;;; Apple IIe Auxiliary memory audit routines
;;; Copyright © 2017 Zellyn Hunter <zellyn@gmail.com>
! zone auxmem {
AUXMEMTESTS
2017-01-18 02:44:31 +00:00
lda # 0
sta AUXRESULT
2017-01-10 02:41:06 +00:00
lda MEMORY
cmp # 65
bcs +
+ print
! text "64K OR LESS:SKIPPING AUXMEM TEST" , $ 8 D
+ printed
2017-01-18 02:44:31 +00:00
sec
2017-01-10 02:41:06 +00:00
rts
2017-01-18 02:44:31 +00:00
+ + print
! text "TESTING AUX MEM" , $ 8 D
2017-01-10 02:41:06 +00:00
+ printed
2017-01-18 02:44:31 +00:00
lda LCRESULT
bne .auxlc
2017-01-10 02:41:06 +00:00
+ print
2017-01-18 02:44:31 +00:00
! text "LC FAILED BEFORE:SKIPPING AUXMEM LC" , $ 8 D
2017-01-10 02:41:06 +00:00
+ printed
2017-01-19 01:57:26 +00:00
beq .afterlc
2017-01-10 02:41:06 +00:00
2017-01-18 02:44:31 +00:00
.auxlc ;; Run langcard tests in auxmem
2017-01-10 02:41:06 +00:00
2017-01-18 02:44:31 +00:00
lda LCRESULT
2017-01-19 01:57:26 +00:00
sta LCRESULT1
2017-01-18 02:44:31 +00:00
lda # 0
sta LCRESULT
;; Store distinct values in RAM areas, to see if they stay safe.
lda $ C08B ; Read and write bank 1
lda $ C08B
lda # $ 44
sta $ D17B ; $D17B is $53 in Apple II/plus/e/enhanced
sta $ FE1F ; FE1F is $60 in Apple II/plus/e/enhanced
lda $ C083 ; Read and write bank 2
lda $ C083
2017-01-19 01:57:26 +00:00
lda # $ 44
2017-01-18 02:44:31 +00:00
sta $ D17B
2017-01-10 02:41:06 +00:00
2017-01-18 02:44:31 +00:00
jsr .zptoaux
sta AL TZP_ON_W
jsr LANGCARDTESTS_NO_CHECK
sta AL TZP_OFF_W
2017-01-10 02:41:06 +00:00
2017-01-18 02:44:31 +00:00
jsr .zpfromaux
2017-01-19 01:57:26 +00:00
lda LCRESULT
bne +
+ prerr $ 0008 ;; E0008: We tried to run the langcard tests again with auxmem (ALTZP active), and they failed, so we're quitting the auxmem test.
! text "QUITTING AUXMEM TEST DUE TO LC FAIL" , $ 8 D
+ prerred
sec
rts
;; Check that the stuff we stashed in main RAM was unaffected.
+
lda $ C088 ; Read bank 1
lda $ D17B
cmp # $ 44
beq +
pha
+ print
! text "WANT BANK1 $D17B"
+ printed
beq .lcerr
+ lda $ C080 ; Read bank 2
lda $ D17B
cmp # $ 44
beq +
pha
+ print
! text "WANT BANK2 $D17B"
+ printed
beq .lcerr
+
lda $ FE1F
cmp # $ 44
beq .afterlc
pha
+ print
! text "WANT RAM $FE1F"
+ printed
.lcerr
+ print
! text "=$44;GOT $"
+ printed
pla
jsr PRBYTE
+ prerr $ 0009 ;; E0009: We wrote $44 to main RAM in the three test locations used by the LC test. They should have been unaffected by the LC test while it was using auxmem, but at least one of them was modified.
! text ""
+ prerred
sec
rts
2017-01-18 02:44:31 +00:00
2017-01-19 01:57:26 +00:00
.afterlc
2017-01-10 02:41:06 +00:00
2017-01-18 02:44:31 +00:00
;; Success
2017-01-10 02:41:06 +00:00
+ print
2017-01-18 02:44:31 +00:00
! text "AUXMEM TESTS SUCCEEDED" , $ 8 D
2017-01-10 02:41:06 +00:00
+ printed
2017-01-18 02:44:31 +00:00
lda # 1
sta AUXRESULT
clc
.done
rts
2017-01-10 02:41:06 +00:00
2017-01-18 02:44:31 +00:00
;;; Copy zero page to aux mem. Assumes zp pointing at main mem, and leaves it that way.
.zptoaux
ldx # 0
- sta AL TZP_OFF_W
lda 0 , x
sta AL TZP_ON_W
sta 0 , x
inx
bne -
sta AL TZP_OFF_W
2017-01-10 02:41:06 +00:00
rts
2017-01-18 02:44:31 +00:00
;;; Copy zero page from aux mem. Assumes zp pointing at main mem, and leaves it that way.
.zpfromaux
ldx # 0
- sta AL TZP_ON_W
lda 0 , x
sta AL TZP_OFF_W
sta 0 , x
inx
2017-01-10 02:41:06 +00:00
bne -
rts
2017-01-17 03:45:29 +00:00
} ;auxmem