CPU_Memory.i | |
Macros | |
memset | Fill block of memory (CPU-bus) |
memcpy | Copy block of memory (from/to CPU-bus) |
WRAM_memset | Fill block of memory (WRAM) |
WRAM_memcpy | Copy block of memory (from CPU-bus to WRAM) |
VRAM_memset | Fill block of memory (VRAM) |
VRAM_memcpy | Copy block of memory (from CPU-bus to VRAM) |
CGRAM_memcpy | Copy block of memory (from CPU-bus to CGRAM) |
Fill block of memory (CPU-bus)
Uses the 65816 block move instruction so its much slower than DMA for large blocks of memory. On the other hand it’s quicker to setup doesn’t interfere with DMA.
:in: addr Address (uint24) ax/hi:x/ex:x constant :in: length Length (uint16) y constant :in?: value Value (uint8) a constant
ldy #$40 memset $7f6000, y, $66 ;Set $7f6000-$7f603f to #$66
Copy block of memory (from/to CPU-bus)
Uses the 65816 block move instruction so its much slower than DMA for large transfers. On the other hand it’s quicker to setup and doesn’t interfere with DMA.
If the memory regions overlap, but are known at assemble time, the copy will be done safely. If both addresses aren’t known the copy will be performed using MVN, ie. in negative direction.
:in: dest Destination (uint24) ay/hi:y/ex:y constant :in: source Source (uint24) ax/hi:x/ex:x constant :in: length Length (uint16) a constant
Fill block of memory (WRAM)
Disables DMA and uses channel 7 for transfer.
:in: addr Address (uint24) hi:x/ex:x constant :in: length Length (uint16) y constant :in?: value Value (uint8) a constant
ldx #$4000 ldy #$2000 lda #$40 WRAM_memset ex:x, y, a ;Set $7f:4000-5fff to #$40
Copy block of memory (from CPU-bus to VRAM)
Disables DMA and uses channel 7 for transfer.
:in: dest Destination (uint16) y (word address) constant (byte address) :in: source Source (uint24) ax/hi:x/ex:x constant :in: length Length (uint16) y a (<<8) constant :in?: vmainc VRAM increment constant :in?: dmap DMA mode constant :in?: bbad DMA B-bus address constant
;Decompress graphics and upload to VRAM LZ4_decompress Tilemap, EXRAM, y ;Returns decompressed length in y VRAM_memcpy $2000, EXRAM, y ;Copy y bytes to VRAM