; Probe 01: PPU open bus, the two latches (U2; undocumented-behavior Q2). ; ; fullsnes l.1357-1397: the unused bits of a PPU1 register read return PPU1's ; last read value, those of a PPU2 read return PPU2's, and a read of a ; write-only register returns the CPU's MDR (the last byte on the data bus). ; Nothing pinned shows a console result, so each case here primes the latches ; with $FF or $00 and reads a register with such bits: ; ; PPU1 latch: primed by reading MPYL ($2134) after M7A = $00FF, M7B = 1 or 0; ; seen in STAT77 ($213E) bit 4. ; PPU2 latch: primed by reading CGRAM colour 2 ($7FFF) or 3 ($0000) low ; byte; seen in STAT78 ($213F) bit 5 and CGRAM high-byte bit 7. ; MDR: `lda $2100` (last bus byte = operand high byte $21) and ; `lda $002100` long (last bus byte = bank $00). ; ; Each row shows the raw byte and OK or DIFF against fullsnes's prediction for ; the masked bits. Rows 7-10 prime one latch, then the other, then read: if the ; latches were one shared latch, those rows would show DIFF. ; The display stays in force blank throughout the reads; colours 2 and 3 are ; unused by the text. .include "common.inc" NCASES = 11 idx = $10 ; 16-bit rowaddr = $12 ; 16-bit .segment "CODE" Reset: ProbeStart jsr InitPPU lda #2 ; colour 2 = $7FFF, colour 3 = $0000 sta CGADD lda #$FF sta CGDATA lda #$7F sta CGDATA stz CGDATA stz CGDATA lda $2100 ; 0: write-only, absolute sta RESULTS+8 lda f:$002100 ; 1: write-only, long sta RESULTS+9 jsr PrimePpu1FF ; 2 lda STAT77 sta RESULTS+10 jsr PrimePpu100 ; 3 lda STAT77 sta RESULTS+11 jsr PrimePpu2FF ; 4 lda STAT78 sta RESULTS+12 jsr PrimePpu200 ; 5 lda STAT78 sta RESULTS+13 lda #2 ; 6: CGRAM high byte after a $FF low byte sta CGADD lda RDCGRAM lda RDCGRAM sta RESULTS+14 jsr PrimePpu1FF ; 7 jsr PrimePpu200 lda STAT77 sta RESULTS+15 jsr PrimePpu1FF ; 8 jsr PrimePpu200 lda STAT78 sta RESULTS+16 jsr PrimePpu100 ; 9 jsr PrimePpu2FF lda STAT77 sta RESULTS+17 jsr PrimePpu100 ; 10 jsr PrimePpu2FF lda STAT78 sta RESULTS+18 ldx #$0000 : lda Magic,x sta RESULTS,x inx cpx #8 bne :- ldy #8 + NCASES jsr SaveResults PrintAt 1, TitleText PrintAt 2, SubtitleText PrintAt 4, HeadText ldx #$0000 @row: stx idx rep #$20 .a16 txa clc adc #6 asl a asl a asl a asl a asl a clc adc #MAP + 2 sta VMADD sta rowaddr txa asl a tax lda Labels,x tay sep #$20 .a8 jsr PrintHere rep #$20 .a16 lda rowaddr clc adc #16 sta VMADD sep #$20 .a8 lda #'$' jsr PutChar ldx idx lda RESULTS+8,x jsr PrintHex ldx idx lda RESULTS+8,x and Masks,x cmp Wants,x bne :+ ldy #OkText bra :++ : ldy #DiffText : jsr PrintHere ldx idx inx cpx #NCASES bne @row PrintAt 19, Help1Text PrintAt 20, Help2Text PrintAt 21, Help3Text jmp ShowAndHalt ; PPU1's latch = $FF or $00: the low byte of M7A x M7B, read from MPYL. PrimePpu1FF: lda #$FF sta M7A stz M7A lda #$01 sta M7B lda MPYL rts PrimePpu100: lda #$FF sta M7A stz M7A stz M7B lda MPYL rts ; PPU2's latch = $FF or $00: the low byte of CGRAM colour 2 or 3. PrimePpu2FF: lda #2 sta CGADD lda RDCGRAM rts PrimePpu200: lda #3 sta CGADD lda RDCGRAM rts .segment "RODATA" ; Per case: the bits fullsnes predicts, and their predicted value. Masks: .byte $FF, $FF, $10, $10, $20, $20, $80, $10, $20, $10, $20 Wants: .byte $21, $00, $10, $00, $20, $00, $80, $10, $00, $00, $20 Labels: .word L0, L1, L2, L3, L4, L5, L6, L7, L8, L9, L10 L0: .byte "2100 ABS", 0 L1: .byte "2100 LONG", 0 L2: .byte "213E P1=FF", 0 L3: .byte "213E P1=00", 0 L4: .byte "213F P2=FF", 0 L5: .byte "213F P2=00", 0 L6: .byte "CGRAM HI P2=FF", 0 L7: .byte "213E P1FF P200", 0 L8: .byte "213F P1FF P200", 0 L9: .byte "213E P100 P2FF", 0 L10: .byte "213F P100 P2FF", 0 Magic: .byte "SNESPRB1" TitleText: .byte "SNES PROBE PACK", 0 SubtitleText: .byte "01 PPU OPEN BUS LATCHES", 0 HeadText: .byte "READ RAW", 0 OkText: .byte " OK", 0 DiffText: .byte " DIFF", 0 Help1Text: .byte "PHOTOGRAPH THIS SCREEN.", 0 Help2Text: .byte "DIFF MEANS THE CONSOLE", 0 Help3Text: .byte "DISAGREES WITH FULLSNES.", 0 ProbeTail "SNES PROBE OPEN BUS "