2016-12-07 03:18:33 +00:00
;;; Apple II audit routines
;;; Copyright © 2016 Zellyn Hunter <zellyn@gmail.com>
! convtab < apple ii / convtab.bin >
! to "audit.o" , plain
* = $6000
HOME = $ FC58
COUT = $ FDED
2016-12-08 04:05:07 +00:00
PRBYTE = $ FDDA
2016-12-07 03:18:33 +00:00
2016-12-14 02:26:45 +00:00
STRINGS = $ 7000
! set LASTSTRING = $ 7000
! macro print {
lda # < LASTSTRING
sta getch2 + 1
lda # > LASTSTRING
sta getch2 + 2
jsr print2
! set TEMP = *
* = LASTSTRING
}
! macro printed {
! byte 0
! set LASTSTRING = *
* = TEMP
}
! macro prerr NUM {
+ print
}
! macro prerred {
! byte $ 8 D
+ printed
}
2016-12-07 03:18:33 +00:00
main:
jsr HOME
2016-12-14 02:26:45 +00:00
+ print
! text "APPLE II AUDIT" , $ 8 D , $ 8 D
+ printed
2016-12-08 04:05:07 +00:00
! zone detect {
jsr IDENTIFY
2016-12-09 02:21:17 +00:00
lda $ C082 ; Put ROM back in place.
2016-12-11 03:23:36 +00:00
2016-12-14 02:26:45 +00:00
+ print
! text "MEMORY:"
+ printed
2016-12-11 03:23:36 +00:00
lda MEMORY
bpl +
2016-12-14 02:26:45 +00:00
+ print
! text "128K" , $ 8 D
+ printed
2016-12-11 03:23:36 +00:00
beq +++
+ cmp # 64
bcc +
2016-12-14 02:26:45 +00:00
+ print
! text "64K" , $ 8 D
+ printed
2016-12-11 03:23:36 +00:00
beq +++
2016-12-14 02:26:45 +00:00
+ + print
! text "48K" , $ 8 D
+ printed
2016-12-11 03:23:36 +00:00
+ + +
2016-12-08 21:44:38 +00:00
lda MACHINE
2016-12-08 04:05:07 +00:00
bne .known
;; MACHINE=0 - unknown machine
2016-12-14 02:26:45 +00:00
+ prerr $ 0001 ;; E0001: The machine identification routines from http://www.1000bit.it/support/manuali/apple/technotes/misc/tn.misc.02.html failed to identify the model.
! text "UNABLE TO IDENTIFY"
+ prerred
2016-12-08 04:05:07 +00:00
jmp end
.known
cmp # IIeCard
bcc .leiic
bne .gs
;IIeCard
2016-12-14 02:26:45 +00:00
+ print
! text "IIE EMULATION CARD"
+ printed
2016-12-08 04:05:07 +00:00
beq .notsupported
.gs ;PLUGH
2016-12-14 02:26:45 +00:00
+ print
! text "APPLE IIGS"
+ printed
2016-12-08 04:05:07 +00:00
.notsupported
2016-12-14 02:26:45 +00:00
+ prerr $ 0002 ;; E0002: The current version of the audit program doesn't support the identified machine.
! text " NOT SUPPORTED"
+ prerred
2016-12-08 04:05:07 +00:00
jmp end
.leiic
cmp # IIe
bcc .leiii
beq .iie
;IIc
2016-12-14 02:26:45 +00:00
+ print
! text "IIC"
+ printed
2016-12-08 04:05:07 +00:00
beq .notsupported
.iie
2016-12-14 02:26:45 +00:00
+ print
! text "APPLE IIE"
+ printed
2016-12-09 02:34:43 +00:00
lda ROMLEVEL
cmp # 1
beq +
2016-12-14 02:26:45 +00:00
+ print
! text " (ENHANCED)"
+ printed
2016-12-09 02:34:43 +00:00
+ lda # $ 8 D
jsr COUT
2016-12-08 04:05:07 +00:00
beq .done
.leiii
cmp # IIplus
bcc .iiplain
beq .iiplus
;iiiem
2016-12-14 02:26:45 +00:00
+ print
! text "APPLE III IN EMULATION MODE"
+ printed
2016-12-08 04:05:07 +00:00
beq .notsupported
.iiplain
2016-12-14 02:26:45 +00:00
+ print
! text "PLAIN APPLE II" , $ 8 D
+ printed
2016-12-08 04:05:07 +00:00
beq .done
.iiplus
2016-12-14 02:26:45 +00:00
+ print
! text "APPLE II PLUS" , $ 8 D
+ printed
2016-12-08 04:05:07 +00:00
.done
} ;detect
2016-12-11 03:23:36 +00:00
! zone langcard {
lda MEMORY
cmp # 49
bcs +
2016-12-14 02:26:45 +00:00
+ 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
beq .done
+ 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-11 03:23:36 +00:00
beq .done
2016-12-14 02:26:45 +00:00
+ lda $ C088 ; RAM read, bank 1
lda $ D17B
cmp # $ 55
beq +++
cmp # $ AA
bne +
+ prerr $ 0006 ;; E0006: Read $C088 (read bank 1), but the language card is still reading bank 2.
! text "$C088: BANK 1 ACTIVE"
+ prerred
.done2 beq .done
+ cmp # $ 53
bne +
+ prerr $ 0007 ;; E0007: Read $C088 (read bank 1), but the language card is reading ROM.
! text "$C088: ROM ACTIVE"
+ prerred
beq .done
+ + prerr $ 0007 ;; E0007: Read $C088 (read bank 1), but the check byte ($D17B) is an unknown value.
! text "$C088: UNKNOWN BYTE"
+ prerred
beq .done
+ + +
;; Test
;; Success
+ print
! text "LANGUAGE CARD TESTS SUCCEEDED" , $ 8 D
+ printed
2016-12-11 03:23:36 +00:00
.done
} ;langcard
2016-12-08 04:05:07 +00:00
2016-12-07 03:18:33 +00:00
end: jmp *
2016-12-14 02:26:45 +00:00
! src "technote2.asm"
print2
lda $ C081
lda $ C081
getch2 lda $ FEED
2016-12-07 03:18:33 +00:00
beq +
jsr COUT
2016-12-14 02:26:45 +00:00
inc getch2 + 1
bne getch2
inc getch2 + 2
jmp getch2
+ rts
2016-12-08 04:05:07 +00:00
2016-12-14 02:26:45 +00:00
; !if * != STRINGS {
; !error "Expected STRINGS to be ", *
; }
! if * > STRINGS {
! error "End of compilation passed STRINGS:" , *
}