Romhacking.net

Romhacking => Programming => Topic started by: HotCoffee on August 29, 2021, 01:52:38 PM

Title: Writing to another bank
Post by: HotCoffee on August 29, 2021, 01:52:38 PM
I have this Data Bytes in "bank 1":



Background:
  .db $00,$00,$00,$00,$00,$25,$25,$25,$25,$25,$25,$25,$25,$25,$25,$25 
  .db $25,$25,$25,$25,$25,$25,$25,$25,$25,$25,$25,$00,$00,$00,$00,$00

  .db $00,$00,$00,$00,$00,$25,$25,$25,$25,$25,$25,$25,$25,$25,$25,$25 
  .db $25,$25,$25,$25,$25,$25,$25,$25,$25,$25,$25,$00,$00,$00,$00,$00

  .db $00,$00,$00,$00,$00,$25,$25,$25,$25,$25,$25,$25,$25,$25,$25,$25 
  .db $25,$25,$25,$25,$25,$25,$25,$25,$25,$25,$25,$00,$00,$00,$00,$00

  .db $00,$00,$00,$00,$00,$25,$25,$25,$25,$25,$25,$25,$25,$25,$25,$25 
  .db $25,$25,$25,$25,$25,$25,$25,$25,$25,$25,$25,$00,$00,$00,$00,$00
 
  .db $00,$00,$00,$00,$00,$25,$25,$25,$25,$25,$25,$25,$25,$25,$25,$25 
  .db $25,$25,$25,$25,$25,$25,$25,$25,$25,$25,$25,$00,$00,$00,$00,$00


I read these bytes and write them in the PPU's background every frame.
However when I try to change them trough code nothing happens

I wrote this code at bank 0 to do it but it does not work.


ReadB:
  LDA $4016       
  AND #$01
  BEQ ReadBDone   
  LDA #$02
  STA Background
ReadBDone: 
     


I tried using a debugger to see what was going on and found out that once it gets to " STA Background " it simply does nothing.

Title: Re: Writing to another bank
Post by: Cyneprepou4uk on August 29, 2021, 03:16:41 PM
Your "background" variable is located somewhere between 8000-FFFF. Basically nothing happens when you write there, unless it's a mapper register. You can't overwrite PRG.