Working on video audit routines

This commit is contained in:
Zellyn Hunter 2017-02-19 20:55:26 -05:00
parent b5378b321b
commit a2992b28d6
6 changed files with 387 additions and 9 deletions

View File

@ -4,6 +4,9 @@ This repository contains routines to audit Apple II computers (II,
II+, IIe, IIc), providing information about hardware, ROM versions,
RAM configuration, and behavior.
The file to download and try is
[audit/audit.dsk](https://github.com/zellyn/a2audit/blob/master/audit/audit.dsk).
Eventually, it should comprise a complete emulator test suite,
enabling emulator writers to systematically identify and eliminate
software-testable differences from real hardware. If a difference
@ -28,6 +31,7 @@ Error messages can be viewed at
- [x] Add testcases for Cxxx testing
- [x] duplicate HOME and COUT routines from AppleII, so IIe tests
don't depend on Cxxx ROM working
- [x] Some simple "same result from two different modes" graphics tests
### TODO
@ -36,6 +40,9 @@ Error messages can be viewed at
- [ ] IIe: don't test auxmem softswitches if we only have 64k
- [ ] weirder softswitch behavior corner cases
- [ ] floating-bus tests
- [ ] dbl lores tests
- [ ] weird lores tests
- [ ] undelayed hires tests
## Raison d'être
@ -43,4 +50,3 @@ This test suite is a step on the way to implementing Apple IIe
(enhanced) support in
[OpenEmulator](http://openemulatorproject.github.io/): I may alternate
adding tests here and features there.

View File

@ -18,8 +18,19 @@
CSW = $36
KSW = $38
PCL=$3A
PCH=$3B
A1L=$3C
A1H=$3D
A2L=$3E
A2H=$3F
A3L=$40
A3H=$41
A4L=$42
A4H=$43
;; SHASUM locations
!addr SRC = $06
@ -34,6 +45,10 @@
!addr tmp5 = $fe
!addr tmp6 = $ff
;; Ports to read
KBD = $C000
KBDSTRB = $C010
;; Softswitch locations.
RESET_80STORE = $C000
SET_80STORE = $C001
@ -74,22 +89,25 @@
RESET_MIXED = $C052
SET_MIXED = $C053
READ_MIXED = $C01B
RESET_PAGE2 = $C054
SET_PAGE2 = $C055
READ_PAGE2 = $C01C
RESET_HIRES = $C056
SET_HIRES = $C057
READ_HIRES = $C01D
RESET_AN3 = $C05E
SET_AN3 = $C05F
RESET_INTC8ROM = $CFFF
;; Readable things without corresponding set/reset pairs.
READ_HRAM_BANK2 = $C011
READ_HRAMRD = $C012
READ_VBL = $C019
;; Monitor locations.
;HOME = $FC58
;COUT = $FDED
@ -99,8 +117,11 @@
;PRBYTE = $FDDA
;PRNTYX = $F940
STRINGS = $7000
!set LASTSTRING = $7000
AUXMOVE = $C311 ; Move from (A1L/H - A2L/H) to (A4L/H) Carry set: main->aux
MOVE = $FE2C ; Move to (A4L/H) from (A1L/H) through (A2L,H)
STRINGS = $8000
!set LASTSTRING = STRINGS
;; Printing and error macros.
!src "macros.asm"
@ -109,7 +130,7 @@ main:
;; Initialize stack to the top.
ldx #$ff
txs
jsr standard_fixup
jsr RESET
@ -121,6 +142,8 @@ main:
;; Detection and reporting of model and memory.
!src "detect.asm"
; SKIP = 1
!ifndef SKIP {
;; Language card tests.
jsr LANGCARDTESTS
@ -133,6 +156,14 @@ main:
;; ROM SHA-1 checks.
;; jsr SHASUMTESTS - do this later, because it's SLOW!
;; Keyboard tests: for now, just check we can press 'Y', 'N', SPACE, or ESC
jsr KEYBOARDTESTS
} ; if SKIP
;; Video tests.
jsr VIDEOTESTS
end:
+print
!text "END"
@ -145,6 +176,8 @@ end:
!src "softswitch.asm"
!src "resetall.asm"
!src "monitor-routines.asm"
!src "keyboard.asm"
!src "video.asm"
;!src "shasumtests.asm"
print
@ -238,7 +271,7 @@ standard_fixup:
rts
COPYTOAUX
;; Use AUXMOVE routine to copy the whole program to AUX memory.
;; Use our own versino of AUXMOVE routine to copy the whole program to AUX memory.
jsr RESETALL
lda #<START
sta SRC
@ -259,7 +292,7 @@ COPYTOAUX
bne -
sta RESET_RAMWRT
rts
; !if * != STRINGS {
; !error "Expected STRINGS to be ", *
; }

Binary file not shown.

39
audit/keyboard.asm Normal file
View File

@ -0,0 +1,39 @@
;;; Apple II keyboard and keyboard audit routines
;;; Copyright © 2017 Zellyn Hunter <zellyn@gmail.com>
!zone keyboard {
KEYBOARDTESTS
+print
!text "PRESS 'Y', 'N', SPACE, OR ESC",$8D
+printed
jsr YNESCSPACE
rts
YNESCSPACE
lda KBDSTRB
-- lda KBD
bpl --
sta KBDSTRB
cmp #$a0 ; SPACE: bmi/bcc
bne +
clc
lda #$a0
rts
+ cmp #$9B ; ESC: bmi/bcs
bne +
sec
lda #$9B
rts
+ and #$5f ; mask out lowercase
cmp #$59 ; 'Y': bpl/bcc
bne +
clc
lda #$59
rts
+ cmp #$4e ; 'N': bpl/bcs
bne --
sec
lda #$4e
rts
} ;keyboard

View File

@ -24,6 +24,7 @@ D76E 65
* TODOs and Links to things to test
** TODO [[https://groups.google.com/d/msg/comp.sys.apple2/RMnus8p6xp8/TDfD2HVtDwAJ][csa2: question on HGR behavior with enhanced 128K Apple //e]]
** TODO Check whether c8-cf sticks after reading c3xx but c3 is only active due to the whole c3 ROM switch
** TODO Check whether reading cfff in various states returns floating bus or ROM contents
* Language card operation
@ -202,3 +203,11 @@ Lores80 color differences: UtA2e: 8-29
* Keyboard
| Y | 217 | D9 | 59 | 11011001 |
| y | 249 | F9 | 79 | 11111001 |
| N | 206 | CE | 4E | 11001110 |
| n | 238 | EE | 6E | 11101110 |
| SPACE | 160 | A0 | 20 | 10100000 |
| ESC | 155 | 9B | 1B | 10011011 |

291
audit/video.asm Normal file
View File

@ -0,0 +1,291 @@
;;; Apple II video audit routines
;;; Copyright © 2017 Zellyn Hunter <zellyn@gmail.com>
!zone video {
VIDEOTESTS
jsr RESETALL
+print
!text "VIDEO TESTS:",$8D
!text "SPACE TO SWAP BETWEEN MODES",$8D
!text "Y/N TO LOG MODE EQUALITY & MOVE TO NEXT",$8D
!text "ESC TO SKIP TO END",$8D
!text "HIT SPACE TO START",$8D
+printed
- jsr YNESCSPACE
bpl -
bcs -
jsr .first
---
jsr RESETALL
jsr .load400aux
jsr .load400
jsr .load2000aux
jsr .load2000
ldx #0
--
jsr .setswitches
txa
eor #1
tax
jsr YNESCSPACE
bpl +
cmp #$a0
beq --
jmp .done ; ESC
+ ;; 'Y' or 'N'
jsr .next
jsr .next
cmp #$ff
bne ---
.done jsr RESETALL
jsr HOME
rts
.setswitches
jsr .thisx
;; 0: TEXT
lsr
bcs +
sta RESET_TEXT
bcc ++
+ sta SET_TEXT
++ ;; 1: MIXED
lsr
bcs +
sta RESET_MIXED
bcc ++
+ sta SET_MIXED
++ ;; 2: HIRES
lsr
bcs +
sta RESET_HIRES
bcc ++
+ sta SET_HIRES
++ ;; 3: 80COL
lsr
bcs +
sta RESET_80COL
bcc ++
+ sta SET_80COL
++ ;; 4: (NOT) AN3
lsr
bcs +
sta SET_AN3
bcc ++
+ sta RESET_AN3
++ ;; 5: ALTCHRSET
lsr
bcs +
sta RESET_ALTCHRSET
bcc ++
+ sta SET_ALTCHRSET
++ ;; 6: PAGE2
lsr
bcs +
sta RESET_PAGE2
bcc ++
+ sta SET_PAGE2
++ ;; 7: 80STORE
lsr
bcs +
sta RESET_80STORE
rts
+ sta SET_80STORE
rts
.load
;; A1L/A1H is start addr
;; tmp0 is # pages
;; tmp1 is even
;; tmp2 is odd
;; During loop:
;; PCL/PCH is looper
;; y is index
;; X is # pages
lda A1L
sta PCL
lda A1H
sta PCH
ldx tmp0
lda tmp1
ldy #0
- sta (PCL),y
iny
iny
bne -
inc PCH
dex
bne -
lda A1H
sta PCH
inc PCL
ldx tmp0
lda tmp2
ldy #0
- sta (PCL),y
iny
iny
bne -
inc PCH
dex
bne -
rts
;;; Read next even/odd values and store them for .load in tmp1/tmp2
.evenodd
jsr .this
sta tmp1
jsr .next
sta tmp2
jsr .next
rts
;;; Setup A1L, A1H, and tmp0 for fill of $400-$7FF
.set400
lda #<$400
sta A1L
lda #>$400
sta A1H
lda #4
sta tmp0
rts
;;; Setup A1L, A1H, and tmp0 for fill of $2000-$3fff
.set2000
lda #<$2000
sta A1L
lda #>$2000
sta A1H
lda #$20
sta tmp0
rts
.load400
jsr .evenodd
jsr .set400
jsr .load
rts
.load400aux
jsr .evenodd
jsr .set400
sta SET_RAMWRT
jsr .load
sta RESET_RAMWRT
rts
.load2000
jsr .evenodd
jsr .set2000
jsr .load
rts
.load2000aux
jsr .evenodd
jsr .set2000
sta SET_RAMWRT
jsr .load
sta RESET_RAMWRT
rts
.first
lda #<.testdata
sta .thisx+1
lda #>.testdata
sta .thisx+2
rts
.next
lda .testdata
inc .thisx+1
bne .this
inc .thisx+2
.this ldx #0
.thisx lda .testdata,x
rts
;; Mode bits:
;; 0: TEXT
;; 1: MIXED
;; 2: HIRES
;; 3: 80COL
;; 4: (NOT) AN3
;; 5: ALTCHRSET
;; 6: PAGE2
;; 7: 80STORE
.md_text = $01
.md_mixed = $02
.md_hires = $04
.md_80col = $08
.md_an3off = $10
.md_altchrset = $20
.md_page2 = $40
.md_80store = $80
.testdata
;; Aux lores even/odd, lores even/odd, aux hires even/odd, hires even/odd, mode 1, mode 2
;; 40COL and 80COL Text, inverse space.
!byte $20, $20, $20, $20, 0, 0, 0, 0, .md_text, .md_text | .md_80col
;; LORES patterns that correspond to HIRES patterns.
!byte 0, 0, $33, $33, 0, 0, $55, $2a, 0, .md_hires ; purple
!byte 0, 0, $cc, $cc, 0, 0, $2a, $55, 0, .md_hires ; green
!byte 0, 0, $66, $66, 0, 0, $d5, $aa, 0, .md_hires ; light blue
!byte 0, 0, $99, $99, 0, 0, $aa, $d5, 0, .md_hires ; orange - left column should budge
;; LORES patterns and corresponding DBL HIRES patterns.
!byte 0, 0, $11, $11, $88, $22, $11, $44, 0, .md_hires | .md_80col | .md_an3off
!byte 0, 0, $22, $22, $11, $44, $22, $88, 0, .md_hires | .md_80col | .md_an3off
!byte 0, 0, $33, $33, $99, $66, $33, $cc, 0, .md_hires | .md_80col | .md_an3off
!byte 0, 0, $44, $44, $22, $88, $44, $11, 0, .md_hires | .md_80col | .md_an3off
!byte 0, 0, $55, $55, $aa, $aa, $55, $55, 0, .md_hires | .md_80col | .md_an3off
!byte 0, 0, $66, $66, $33, $cc, $66, $99, 0, .md_hires | .md_80col | .md_an3off
!byte 0, 0, $77, $77, $bb, $ee, $77, $dd, 0, .md_hires | .md_80col | .md_an3off
!byte 0, 0, $88, $88, $44, $11, $88, $22, 0, .md_hires | .md_80col | .md_an3off
!byte 0, 0, $99, $99, $cc, $33, $99, $66, 0, .md_hires | .md_80col | .md_an3off
!byte 0, 0, $aa, $aa, $55, $55, $aa, $aa, 0, .md_hires | .md_80col | .md_an3off
!byte 0, 0, $bb, $bb, $dd, $77, $bb, $ee, 0, .md_hires | .md_80col | .md_an3off
!byte 0, 0, $cc, $cc, $66, $99, $cc, $33, 0, .md_hires | .md_80col | .md_an3off
!byte 0, 0, $dd, $dd, $ee, $bb, $dd, $77, 0, .md_hires | .md_80col | .md_an3off
!byte 0, 0, $ee, $ee, $77, $dd, $ee, $bb, 0, .md_hires | .md_80col | .md_an3off
!byte $ff
} ;video
!eof
LORES $1
DDDDDDD....... DDDDDDD.......
10001000100010 00100010001000
0010001
0100010
1000100
0001000