Skip to content

Commit

Permalink
Fix bus conflict error when bank switching
Browse files Browse the repository at this point in the history
I tried out the ROM in FCEUX 2.2.3, and ran into an issue where it
looked like the bank switch wasn't properly working. I did some
research, and thought this was caused by a bus conflict. This fixes
it (along with expanding the CHR-ROM to be a power of 2 [i.e. 4]
rather than 3). But I don't know why.

See sample code at in zip at
https://web.archive.org/web/20170806091648/http://nintendoage.com/forum/messageview.cfm?catid=22&threadid=17074
as well as article at https://wiki.nesdev.com/w/index.php/Bus_conflict
  • Loading branch information
samcan committed Jun 28, 2020
1 parent a0ab95d commit 30f3bfe
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
Binary file modified src/chrblock.chr
Binary file not shown.
10 changes: 8 additions & 2 deletions src/helper.asm
Original file line number Diff line number Diff line change
Expand Up @@ -246,10 +246,16 @@ clr_sprite_mem:
;;;;;;;;;;;;;;;
;;
;; Clobbers: A, X
;;
;; I HAVE NO IDEA WHY THIS WORKS
;; I THOUGHT WE NEEDED TO WRITE TO $8000 TO
;; SWITCH BANKS, WHICH WORKED IN MESEN, BUT
;; NOT IN FCEUX. YOU'RE TELLING ME THAT WE CAN
;; JUST WRITE TO bankvalues AND THAT SWITCHES
;; BANKS???? WHYY???????!!!!!!!!
BankSwitch:
TAX
LDA bankvalues, x
STA $8000
STA bankvalues, x
RTS
;;;;;;;;;;;;;;;
;;
Expand Down
2 changes: 1 addition & 1 deletion src/westward.asm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PRG_COUNT = 2 ; 2x 16KB PRG code
CHR_COUNT = 3 ; 3x 8KB CHR data
CHR_COUNT = 4 ; 4x 8KB CHR data
MAPPER = 3 ; mapper 3 = CNROM
MIRRORING = 1 ; background mirroring

Expand Down

0 comments on commit 30f3bfe

Please sign in to comment.