1
Newcomer's Board / Re: Need help at understanding a peculiar VRAM blit
« on: May 23, 2013, 07:03:54 pm »It also setups a lot of other things that are non-relevant to the OP snippet; what you said makes perfect sense, so MyArray is just an array of words, each of them being the VRAM destination tile address, and by offsetting with $35CC I also get the corresponding WRAM location?
So there is a 1-to-1 tilemap in WRAM at $7F35CC that gets each time this proc is called partially copied to VRAM? In this case what about "CPX #$20" ? Does it mean that loop will exit either when finding a 0xFFFF word or when 32 tiles have been copied?
Mostly right, except it's limited to 16 tiles, not 32 (X is incremented by two bytes each time, because it's reading 16-bit addresses).
The setup code, among other things, sets up the areas in VRAM where each graphics layer pulls its data from:
Code: [Select]
LDA #$00
STA $2133 ; enable progressive mode, no overscan, etc
LDA #$58 ; BG 1 tile map is at $5800 (($58 && $FC) << 8)
STA $2107 ; BG 1 vertical mirroring is disabled ($58 && $02)
; BG 1 horizontal mirroring is disabled ($58 && $01)
LDA #$5C ; BG 2 tile map is at $5C00 (($5C && $FC) << 8)
STA $2108 ; BG 2 vertical mirroring is disabled ($5C && $02)
; BG 2 horizontal mirroring is disabled ($5C && $01)
LDA #$03 ; BG 1 tile graphics are at $6000 (($03 && $0F) << 13)
STA $210B ; BG 2 tile graphics are at $0000 (($03 && $F0) << 9)
LDA #$05 ; BG 3 tile graphics are at $A000 (($05 && $0F) << 13)
STA $210C ; BG 4 tile graphics are at $0000 (($05 && $F0) << 9)
LDA #$01 ; Enable BG mode 1 (BG1 and BG2 4bpp, BG3 2bpp, no BG4)
STA $2105 ; All four layers use 8x8 tiles (upper four bits are zero)
LDA #$63 ; use 16x16 and 32x32 sprites ($63 && $E0)
STA $2101 ; Sprite graphics are at $C000 (($63 && $07) << 14)
; ("tile map" is in OAM, separate from VRAM)
LDA #$80 ; surround Mode 7 background with empty space
STA $211A ; (not really relevant right now)
LDA #$13 ; Enable BG1, BG2, and sprites, leave BG3 and BG4 disabled
STA $212C
STZ $212D ; Disable subscreen, window masking, color math
STZ $2130
STZ $2131
STZ $2132 So the addresses in MyArray, and the memory regions set up beforehand, determine what effect the DMA transfer has depending on what range the address is in:
Layer 1: Graphics data at $6000, tile map at $5800
Layer 2: Graphics data at $0000, tile map at $5C00
Sprites: Graphics data at $C000
Assuming MyArray is set up to do tile/sprite animation, all of the addresses probably begin at $0000, $6000, or $C000. The tile maps (and separate sprite memory) determine how the tiles that make up each layer's graphics data are arranged on screen; it's not a simple rectangle blit like you'd see on a more modern system

Hope that helps.
Home
Help
Login
Register
)


