DMA write to tile map
DMA write was always working, I just had the wrong tile data format Tile data is two bytes, not wrong Also keep around previously-working tile-load loop for prosterity
This commit is contained in:
parent
23bdc734bb
commit
21968ae8ef
@ -45,3 +45,29 @@ lda #\1
|
||||
sta $2100 ; $2100 is the screen brightness register
|
||||
|
||||
.ENDM
|
||||
|
||||
|
||||
|
||||
; loads, in a loop, an alternating grid of tiles
|
||||
.MACRO Tile_Load_Loop
|
||||
|
||||
ldx #$0400 ; load $0400 (VRAM address of tile data)
|
||||
TileLoadLoop:
|
||||
|
||||
stx $2116 ; store VRAM address of tile data to VRAM address word-sized register
|
||||
|
||||
lda #$01 ; smile tile
|
||||
sta $2118 ;store tile map entry to the address specified in $2116 - this increments or not based on 2115
|
||||
|
||||
inx
|
||||
stx $2116
|
||||
|
||||
lda #$00 ; blank tile
|
||||
sta $2118
|
||||
|
||||
inx
|
||||
|
||||
cpx #$0780 ; $400 - $780 seems to be limit of snes screen tile memory
|
||||
bne TileLoadLoop
|
||||
|
||||
.ENDM
|
||||
|
63
test_gfx.asm
63
test_gfx.asm
@ -77,27 +77,9 @@ Start:
|
||||
lda #%00000001
|
||||
sta $212c ; enable bkg 1,
|
||||
|
||||
; Load_Block_to_VRAM TileMap, $0400, 16
|
||||
Load_Block_to_VRAM Tiles, $0000, (8*2*2),
|
||||
Load_Block_to_VRAM Tiles, $0000, (8*2*3),
|
||||
|
||||
ldx #$0400 ; load $0400 (VRAM address of tile data)
|
||||
TileLoadLoop:
|
||||
|
||||
stx $2116 ; store VRAM address of tile data to VRAM address word-sized register
|
||||
|
||||
lda #$01 ; smile tile
|
||||
sta $2118 ;store tile map entry to the address specified in $2116 - this increments or not based on 2115
|
||||
|
||||
inx
|
||||
stx $2116
|
||||
|
||||
lda #$00 ; blank tile
|
||||
sta $2118
|
||||
|
||||
inx
|
||||
|
||||
cpx #$0780 ; $400 - $780 seems to be limit of snes screen tile memory
|
||||
bne TileLoadLoop
|
||||
Load_Block_to_VRAM TileMap, $0400, 4
|
||||
|
||||
lda #%10000001 ; enable NMI and joypads
|
||||
sta $4200
|
||||
@ -159,14 +141,37 @@ Tiles:
|
||||
.db %00111100
|
||||
.db %00111100
|
||||
|
||||
TileMap:
|
||||
.db $00, $01
|
||||
.db $00, $01
|
||||
.db $00, $01
|
||||
.db $00, $01
|
||||
.db $00, $01
|
||||
.db $00, $01
|
||||
.db $00, $01
|
||||
.db $00, $01
|
||||
; different face
|
||||
.db %11111111
|
||||
.db %00000000
|
||||
|
||||
.db %11111111
|
||||
.db %00000000
|
||||
|
||||
.db %11000011
|
||||
.db %00000000
|
||||
|
||||
.db %00111000
|
||||
.db %00111000
|
||||
|
||||
.db %00111000
|
||||
.db %00111000
|
||||
|
||||
.db %10000001
|
||||
.db %10000001
|
||||
|
||||
.db %01000010
|
||||
.db %01000010
|
||||
|
||||
.db %00111100
|
||||
.db %00111100
|
||||
|
||||
|
||||
; each entry in the tile map is two bytes long
|
||||
; here is the format:
|
||||
;High Low v: vertical flip h: horizontal flip
|
||||
;vhopppcc cccccccc o: priority bit p: palette number
|
||||
; c: Starting character (tile) number
|
||||
TileMap:
|
||||
.db $02, $00, $02, $00
|
||||
.ENDS
|
||||
|
Loading…
Reference in New Issue
Block a user