2016-12-15 01:16:55 +00:00
;;; Apple II Language Card audit routines
;;; Copyright © 2016 Zellyn Hunter <zellyn@gmail.com>
! zone langcard {
lda MEMORY
cmp # 49
bcs +
+ print
! text "48K:SKIPPING LANGUAGE CARD TEST" , $ 8 D
+ printed
beq .done2
;; Setup - store differing values in bank first and second banked areas.
+ lda $ C08B ; Read and write First 4K bank
lda $ C08B
lda # $ 55
sta $ D17B ; D17B is $53 in Apple II/plus/e/enhanced
cmp $ D17B
beq +
+ prerr $ 0003 ;; E0003: We tried to put the language card into read bank 1, write bank 1, but failed to write.
! text "CANNOT WRITE TO LC BANK 1 RAM"
+ prerred
beq .done2
+ sta $ FE1F ; FE1F is $60 in Apple II/plus/e/enhanced
cmp $ FE1F
beq +
+ prerr $ 0004 ;; E0004: We tried to put the language card into read RAM, write RAM, but failed to write.
! text "CANNOT WRITE TO LC RAM"
+ prerred
2016-12-15 03:57:37 +00:00
beq .done2
2016-12-15 01:16:55 +00:00
+ lda $ C083 ; Read and write Second 4K bank
lda $ C083
lda # $ AA
sta $ D17B
cmp $ D17B
beq +
+ prerr $ 0005 ;; E0005: We tried to put the language card into read bank 2, write bank 2, but failed to write.
! text "CANNOT WRITE TO LC BANK 2 RAM"
+ prerred
2016-12-15 03:57:37 +00:00
beq .done2
;; Test that we're reading the right things
2016-12-15 01:16:55 +00:00
+ lda $ C088 ; RAM read, bank 1
lda $ D17B
cmp # $ 55
2016-12-15 03:57:37 +00:00
beq ++
2016-12-15 01:16:55 +00:00
cmp # $ AA
bne +
+ prerr $ 0006 ;; E0006: Read $C088 (read bank 1), but the language card is still reading bank 2.
2016-12-15 03:57:37 +00:00
! text "$C088: BANK 2 ACTIVE"
2016-12-15 01:16:55 +00:00
+ prerred
2016-12-15 03:57:37 +00:00
.done2 beq .done3
2016-12-15 01:16:55 +00:00
+ cmp # $ 53
bne +
+ prerr $ 0007 ;; E0007: Read $C088 (read bank 1), but the language card is reading ROM.
! text "$C088: ROM ACTIVE"
+ prerred
2016-12-15 03:57:37 +00:00
beq .done3
2016-12-17 03:35:28 +00:00
+ + prerra $ 0008 ;; E0008: Read $C088 (read bank 1), but the check byte ($D17B) is an unknown value.
2016-12-15 01:16:55 +00:00
! text "$C088: UNKNOWN BYTE"
+ prerred
2016-12-15 03:57:37 +00:00
beq .done3
+ + dec $ D17B
eor $ D17B
beq +
2016-12-17 03:35:28 +00:00
+ prerr $ 0009 ;; E0009: Read $C088 (read bank 1, write-protected), but successfully wrote byte ($D17B).
2016-12-15 03:57:37 +00:00
! text "$C088: ALLOWED WRITE"
+ prerred
beq .done3
+ lda $ C080 ; RAM read, bank 2
lda $ D17B
cmp # $ AA
beq ++
cmp # $ 55
bne +
2016-12-17 03:35:28 +00:00
+ prerr $ 000 A ;; E000A: Read $C080 (read bank 2), but the language card is still reading bank 1.
2016-12-15 03:57:37 +00:00
! text "$C080: BANK 1 ACTIVE"
+ prerred
beq .done3
+ cmp # $ 53
bne +
2016-12-17 03:35:28 +00:00
+ prerr $ 000B ;; E000B: Read $C080 (read bank 2), but the language card is reading ROM.
2016-12-15 03:57:37 +00:00
! text "$C080: ROM ACTIVE"
+ prerred
beq .done3
2016-12-17 03:35:28 +00:00
+ + prerra $ 000 C ;; E000C: Read $C080 (read bank 2), but the check byte ($D17B) is an unknown value.
2016-12-15 03:57:37 +00:00
! text "$C080: UNKNOWN BYTE"
+ prerred
2016-12-17 03:35:28 +00:00
.done3 beq .done4
2016-12-15 03:57:37 +00:00
+ + dec $ D17B
eor $ D17B
beq +
2016-12-17 03:35:28 +00:00
+ prerr $ 000 D ;; E000D: Read $C080 (read bank 2, write-protected), but successfully wrote byte ($D17B).
2016-12-15 03:57:37 +00:00
! text "$C080: ALLOWED WRITE"
+ prerred
2016-12-17 03:35:28 +00:00
beq .done4
2016-12-15 03:57:37 +00:00
+ lda $ C081 ; ROM read
lda $ D17B
cmp # $ 53
beq ++
cmp # $ 55
bne +
2016-12-17 03:35:28 +00:00
+ prerr $ 000 E ;; E000E: Read $C081 (read ROM), but the language card is still reading bank 1.
2016-12-15 03:57:37 +00:00
! text "$C081: BANK 1 ACTIVE"
+ prerred
2016-12-17 03:35:28 +00:00
beq .done4
2016-12-15 03:57:37 +00:00
+ cmp # $ AA
bne +
2016-12-17 03:35:28 +00:00
+ prerr $ 000 F ;; E000F: Read $C081 (read ROM), but the language card is reading bank 2.
2016-12-15 03:57:37 +00:00
! text "$C081: BANK 1 ACTIVE"
+ prerred
2016-12-15 01:16:55 +00:00
beq .done
2016-12-17 03:35:28 +00:00
+ + prerra $ 0010 ;; E0010: Read $C081 (read ROM), but the check byte ($D17B) is an unknown value.
2016-12-15 03:57:37 +00:00
! text "$C081: UNKNOWN BYTE"
+ prerred
beq .done
+ + dec $ D17B
eor $ D17B
beq +
2016-12-17 03:35:28 +00:00
+ prerr $ 0011 ;; E0011: Read $C081 (read ROM), but successfully modified byte ($D17B).
2016-12-15 03:57:37 +00:00
! text "$C081: ALLOWED WRITE"
+ prerred
beq .done
2016-12-16 03:38:01 +00:00
+ lda $ C089 ; ROM read
lda $ D17B
cmp # $ 53
beq ++
cmp # $ 55
bne +
2016-12-17 03:35:28 +00:00
+ prerr $ 0012 ;; E0012: Read $C089 (read ROM), but the language card is still reading bank 1.
2016-12-16 03:38:01 +00:00
! text "$C089: BANK 1 ACTIVE"
+ prerred
beq .done
+ cmp # $ AA
bne +
2016-12-17 03:35:28 +00:00
+ prerr $ 0013 ;; E0013: Read $C089 (read ROM), but the language card is reading bank 2.
2016-12-16 03:38:01 +00:00
! text "$C089: BANK 1 ACTIVE"
+ prerred
beq .done
2016-12-17 03:35:28 +00:00
+ + prerra $ 0014 ;; E0014: Read $C089 (read ROM), but the check byte ($D17B) is an unknown value.
2016-12-16 03:38:01 +00:00
! text "$C089: UNKNOWN BYTE"
+ prerred
beq .done
+ + dec $ D17B
eor $ D17B
beq +
2016-12-17 03:35:28 +00:00
+ prerr $ 0015 ;; E0015: Read $C089 (read ROM), but successfully modified byte ($D17B).
2016-12-16 03:38:01 +00:00
! text "$C089: ALLOWED WRITE"
+ prerred
2016-12-17 03:35:28 +00:00
.done4 beq .done
2016-12-15 03:57:37 +00:00
2016-12-17 03:35:28 +00:00
+ lda $ C08B ; RAM read, bank 1
lda $ D17B
cmp # $ 55
beq ++
cmp # $ AA
bne +
+ prerr $ 0016 ;; E0016: Read $C08B (read bank 1), but the language card is still reading bank 2.
! text "$C08B: BANK 2 ACTIVE"
+ prerred
beq .done
+ cmp # $ 53
bne +
+ prerr $ 0017 ;; E0017: Read $C08B (read bank 1), but the language card is reading ROM.
! text "$C08B: ROM ACTIVE"
+ prerred
beq .done
+ cmp # $ 54
bne +
+ prerr $ 0018 ;; E0018: Read $C08B (read bank 1), but byte was previously decremented during single-read $C089 or $C081 phase, which should have Write-protected RAM.
! text "$C08B: PREVIOUS WRITE SUCCEEDED"
+ prerred
beq .done
+ + prerra $ 0019 ;; E0019: Read $C08B (read bank 1), but the check byte ($D17B) is an unknown value.
! text "$C08B: UNKNOWN BYTE"
+ prerred
beq .done
+ +
2016-12-15 01:16:55 +00:00
;; Success
+ print
! text "LANGUAGE CARD TESTS SUCCEEDED" , $ 8 D
+ printed
.done
} ;langcard