So I was writing a pong game and in the meantime I accidentally deleted some important files, and thus I was forced to rewrite the entire source code. However, I seem to have hit a very big wall.
I followed the superfamicom.org wiki for loading data to VRAM. It was working just fine in the previous code, but now it simply won't load data to VRAM at all, despite all arguments being correct.
I have a file called initdma.asm which contains this code:
Code: Select all
.macro LoadSprites
lda #$80
sta $2115 ; Increment VRAM word after writing to $2119.
ldx #\2
stx $2116 ; Set initial VRAM word address.
lda #:\1
ldx #\1
ldy #\3
jsr LoadSpritesRoutine
.endm
LoadSpritesRoutine:
php
stx $4302
sta $4304 ; Set DMA source address and bank
sty $4305 ; Set DMA transfer size in bytes
lda #1
sta $4300 ; Set transfer mode to 1-word
lda #$18
sta $4301 ; Set DMA destination to $2118
lda #1
sta $420B ; Begin DMA transfer
plp
rts
Code: Select all
LoadSprites sprite, $0000, $0800 ; sprite is located at $01:8000. Set initial VRAM address to $0000, transfer size is 2kB.
Thanks in advance.