diff options
author | Alexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com> | 2021-06-28 09:32:30 +0300 |
---|---|---|
committer | Alexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com> | 2021-06-28 09:32:30 +0300 |
commit | 3d26aac7f7847abbc50833f3ff73e39ce23964ff (patch) | |
tree | 0c90617d1181eee1ea68f25eeedafff26c625de8 | |
parent | 85df23a7305c7ffa0b99ca73e9ebedbbb8fd3e29 (diff) |
Fixed CHR RAM size detection
-rw-r--r-- | video.asm | 16 |
1 files changed, 11 insertions, 5 deletions
@@ -1314,21 +1314,29 @@ detect_chr_ram_size: stx PPUADDR lda #$AA sta PPUDATA + ; to prevent open bus read + lda #$55 + sta PPUDATA ; check for $AA stx PPUADDR stx PPUADDR ldy PPUDATA ; dump read + lda #$AA cmp PPUDATA bne .end ; check failed ; store $55 stx PPUADDR stx PPUADDR lda #$55 - ; check for $55 sta PPUDATA + ; to prevent open bus read + lda #$AA + sta PPUDATA + ; check for $55 stx PPUADDR stx PPUADDR ldy PPUDATA ; dump read + lda #$55 cmp PPUDATA bne .end ; check failed ; select zero bank @@ -1345,11 +1353,9 @@ detect_chr_ram_size: inc <CHR_RAM_SIZE jmp .next_size .end: + ; return everything back lda #0 jsr select_chr_bank - lda #0 - sta PPUADDR - sta PPUADDR - sta PPUDATA + jsr load_base_chr jsr disable_chr_write rts |