; Probe 00: the console reports its own revision, and the flash cart's save path. ; ; Reads the three version registers once at reset (force blank, before anything ; else touches the PPU): $4210 RDNMI bits 0-3 = 5A22 version; $213E STAT77 bits ; 0-3 = PPU1 version; $213F STAT78 bits 0-3 = PPU2 version, bit 4 = PAL. The ; raw bytes are shown too, because the other bits are flags and open bus. ; ; Battery RAM at $70:0000 holds a magic string, a boot counter and the last ; readings. Each boot adds one. If the flash cart writes SRAM back to its SD ; card, powering off and running the probe again shows the count go up, and the ; .srm file on the card carries the readings for scripts/probe_results.py. .include "common.inc" cpu_raw = $10 ppu1_raw = $11 ppu2_raw = $12 sram_ok = $13 count = $14 ; 16-bit ; SRAM layout (also in scripts/probe_results.py). S_MAGIC = 0 ; "SNESPRB0", 8 bytes S_COUNT = 8 ; boot count, 16-bit little-endian S_CPU = 10 S_PPU1 = 11 S_PPU2 = 12 .segment "CODE" Reset: ProbeStart ; The readings first, before any PPU write. lda RDNMI sta cpu_raw lda STAT77 sta ppu1_raw lda STAT78 sta ppu2_raw jsr InitPPU jsr UpdateSram PrintAt 2, TitleText PrintAt 3, SubtitleText PrintAt 6, CpuText lda cpu_raw jsr PrintRawAndVersion PrintAt 8, Ppu1Text lda ppu1_raw jsr PrintRawAndVersion PrintAt 10, Ppu2Text lda ppu2_raw jsr PrintRawAndVersion ldx #MAP + 12*32 + 2 ldy #NtscText lda ppu2_raw and #$10 beq :+ ldy #PalText : jsr Print PrintAt 15, CountText lda count+1 jsr PrintHex lda count jsr PrintHex ldx #MAP + 17*32 + 2 ldy #SramOkText lda sram_ok bne :+ ldy #SramFailText : jsr Print PrintAt 20, Help1Text PrintAt 22, Help2Text PrintAt 24, Help3Text PrintAt 25, Help4Text jmp ShowAndHalt ; Keep the readings and the boot count in battery RAM; verify by reading back. UpdateSram: ldx #$0000 : lda f:SRAM+S_MAGIC,x cmp Magic,x bne @fresh inx cpx #8 bne :- bra @counted @fresh: ldx #$0000 : lda Magic,x sta f:SRAM+S_MAGIC,x inx cpx #8 bne :- lda #$00 sta f:SRAM+S_COUNT sta f:SRAM+S_COUNT+1 @counted: rep #$20 .a16 lda f:SRAM+S_COUNT inc a sta f:SRAM+S_COUNT sta count cmp f:SRAM+S_COUNT sep #$20 .a8 bne @fail lda cpu_raw sta f:SRAM+S_CPU lda ppu1_raw sta f:SRAM+S_PPU1 lda ppu2_raw sta f:SRAM+S_PPU2 cmp f:SRAM+S_PPU2 bne @fail lda #$01 sta sram_ok rts @fail: stz sram_ok rts ; A = raw register byte: "$xx VERSION n". PrintRawAndVersion: pha lda #'$' jsr PutChar pla pha jsr PrintHex ldy #VersionText jsr PrintHere pla and #$0F jmp PutNibble .segment "RODATA" Magic: .byte "SNESPRB0" TitleText: .byte "SNES PROBE PACK", 0 SubtitleText: .byte "00 REVISION AND SAVE TEST", 0 CpuText: .byte "CPU 4210=", 0 Ppu1Text: .byte "PPU1 213E=", 0 Ppu2Text: .byte "PPU2 213F=", 0 VersionText: .byte " VERSION ", 0 NtscText: .byte "VIDEO 60 HZ (NTSC)", 0 PalText: .byte "VIDEO 50 HZ (PAL)", 0 CountText: .byte "BOOT COUNT $", 0 SramOkText: .byte "SAVE RAM READS BACK OK", 0 SramFailText: .byte "SAVE RAM FAILED", 0 Help1Text: .byte "PHOTOGRAPH THIS SCREEN.", 0 Help2Text: .byte "POWER OFF, ON, RUN AGAIN:", 0 Help3Text: .byte "BOOT COUNT GOING UP MEANS", 0 Help4Text: .byte "THE CART KEEPS SAVES.", 0 ProbeTail "SNES PROBE REVISION "