News:

11 March 2016 - Forum Rules

Main Menu

Writing to another bank

Started by HotCoffee, August 29, 2021, 01:52:38 PM

Previous topic - Next topic

HotCoffee

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.


Cyneprepou4uk

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.