Add rudimentary test for the zeropage

This commit is contained in:
s3lph 2022-02-06 15:37:55 +01:00
parent 7002b7e69f
commit af0462d2fe
2 changed files with 61 additions and 1 deletions

View file

@ -60,6 +60,9 @@ After starting up, most of the screen will be empty.
* The part right of the `>` sign is two bytes: First the byte that was written to this address, then the byte that was returned when reading from the same address.
* If the written byte reads `XX` instead of a hex byte, the byte that was actually written is the XOR of the high and low bytes of the address, i.e. `(DE xor AD)`. If you only see `XX` faults, there may be a fault in the address lines, rather than individual memory cells or output lines.
* In the bottom right you can see 3 quickly alternating characters. The first two chars are the textual (PETSCII characters, not hexdumped) representation of the memory address currently being tested. The third char is the character written to said memory address in the current pass.
* When all memtest passes have completed, there will be an additional `=` character left of these chars.
* When the memtest routine was interrupted by an NMI, there will be a `!` instead.
* When the screen is not cleared (filled with random characters), and the first line starts with `ZF***ZF` (`*` being other seemingly random characters), a fault in the first few bytes of the zero page were detected. Since the memtest uses this area to store its state, the test is terminated prematurely.
```
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓

View file

@ -26,6 +26,56 @@
main:
sei
;; test the first few bytes of memory with $FF
ldy #$00
lda #$ff
zeroloopFF:
sta $00,Y
cmp $00,Y
beq zerookFF
ldx #"Z"
stx scrptr
ldx #"F"
stx scrptr+1
sty scrptr+2
sta scrptr+3
lda $00,Y
sta scrptr+3
ldx #"Z"
stx scrptr+4
ldx #"F"
stx scrptr+5
jmp done
zerookFF:
iny
cpy #$10
bne zeroloopFF
;; test the first few bytes of memory with $00
ldy #$00
lda #$00
zeroloop00:
sta $00,Y
cmp $00,Y
beq zerook00
ldx #"Z"
stx scrptr
ldx #"F"
stx scrptr+1
sty scrptr+2
sta scrptr+3
lda $00,Y
sta scrptr+3
ldx #"Z"
stx scrptr+4
ldx #"F"
stx scrptr+5
jmp done
zerook00:
iny
cpy #$10
bne zeroloop00
;; clear screen
ldx #<scrptr
stx <addr
@ -393,6 +443,9 @@ passend:
lda passbytes,Y
cmp #$7F
bne passend2
;; Done with all passes: Show = in status
lda #"="
sta eoscr-3
jmp done
passend2:
iny
@ -435,6 +488,10 @@ passchars:
infotext:
.asc " CBM 3001 memtest, 2022 s3lph.me"
nmiv:
;; NMI: Show ! in status
lda #"!"
sta eoscr-3
done:
;; done, loop forever
jmp done
@ -446,6 +503,6 @@ eot:
.dsb (*-eot), $ff
;; 6502 vectors
* = $fffa
.byt <done, >done ; NMIV
.byt <nmiv, >nmiv ; NMIV
.byt <main, >main ; RESV
.byt <main, >main ; IRQV