For a 4 bit sprite I'm DMAing into VRAM
Code: Select all
PlayerSprite: ;Bitplanes 1 and 2 are interleaved, same as 3 and 4
;So the left column is plane 1, second is plane 2. Then this repeats for 3 and 4
.db %00000000 %00000000
.db %00000000 %00000000
.db %00000000 %00000000
.db %00000000 %00000000
.db %11111111 %11111111
.db %11111111 %11111111
.db %11111111 %11111111
.db %11111111 %11111111
.db %00000000 %00000000
.db %00000000 %00000000
.db %00000000 %00000000
.db %00000000 %00000000
.db %00000000 %00000000
.db %00000000 %00000000
.db %00000000 %00000000
.db %00000000 %00000000
;Start of the next one, we'll get there in a second
.db %11111111 %11111111
.db %11111111 %11111111 ;Note we have 2 lines here
.db %00000000 %00000000 ;And the third is set to 0
Code: Select all
PlayerSprite:
.db %00000000 %00000000
.db %00000000 %00000000
.db %00000000 %00000000
.db %00000000 %11111111 ;Note I've moved it up by 1
.db %11111111 %11111111
.db %11111111 %11111111
.db %11111111 %11111111
.db %11111111 %00000000
My DMA code is the following, in the event I've got something wrong there
Code: Select all
DMAPlayerSprite:
rep #$20
lda.w #PlayerSprite
sta $4302 ;Set the source
sep #$20 ;8 bit A
lda #64 ;Byte size
sta $2115
sta $4305
lda #0
sta $2116 ;Set the VRAM target
sta $2117
sta $4306 ;Upper byte of DMA transfer size
lda #$18
sta $4301 ;Target 2118 (VRAM gate)
lda #$0
sta $4304 ;src is in Bank 0
;sta $4300
lda #$01
sta $4300 ;Flag to send a word at a time
sta $420b ;start the DMA
rts