Hey all,
I've just started fiddling around with SNES stuff, more specifically with the Wikibooks tutorial. I have some (probably very) basic questions for which I haven't found an answer on these boards (or byuu's); if I am supposed to find the answers by more research or by moving forward, please don't hesitate to me so. Here's a basic change the BG color example I will refer to in my questions:
I've just started fiddling around with SNES stuff, more specifically with the Wikibooks tutorial. I have some (probably very) basic questions for which I haven't found an answer on these boards (or byuu's); if I am supposed to find the answers by more research or by moving forward, please don't hesitate to me so. Here's a basic change the BG color example I will refer to in my questions:
Code:
.include "Header.inc"
.include "Snes_Init.asm"
VBlank:
RTI
.bank 0
.section "MainCode"
Start:
Snes_Init
; Set the background color to green.
sep #$20 ; Set the A register to 8-bit.
lda #%10000000 ; Force VBlank by turning off the screen.
sta $2100
lda #%11100000 ; Load the low byte of the green color.
sta $2122
lda #%00000000 ; Load the high byte of the green color.
sta $2122
lda #%00001111 ; End VBlank, setting brightness to 15 (100%).
sta $2100
Forever:
jmp Forever
.ends
.include "Snes_Init.asm"
VBlank:
RTI
.bank 0
.section "MainCode"
Start:
Snes_Init
; Set the background color to green.
sep #$20 ; Set the A register to 8-bit.
lda #%10000000 ; Force VBlank by turning off the screen.
sta $2100
lda #%11100000 ; Load the low byte of the green color.
sta $2122
lda #%00000000 ; Load the high byte of the green color.
sta $2122
lda #%00001111 ; End VBlank, setting brightness to 15 (100%).
sta $2100
Forever:
jmp Forever
.ends
- Is there a way to load both bytes into $2122 at once? It seems kinda strange to me to set the register to 8 bits, load 8 bits, then load 8 more bits, rather than doing all of this with just one lda/sta.
- Speaking of which... How come doing sta $2122 twice with a byte both times doesn't end up just writing the latest byte of the two? Is writing the low byte first, and the the high byte the "standard way" of setting a color value here?
- I tried copying and pasting the "Set the background [...]" block so that there's two of them, changing the color to red the second time. By moving the Forever label at the top of the first of these blocks, I expected alternating red and green as the background color, but I end up with a rather trippy effect involving red and black only. Am I supposed to do something between (or during) VBlanks?