; Assume mem 8-Bit, Index 16-Bit ; SRCOFFSET = data to store offset ; DEST = where in Vram to store it ; SIZE = size of the data ; REGSMODE = register & transfer mode.($1801->port $2118, mode 1) ; CHANNELDATA = dma channel init byte. EX: ; ($0210) $00 = $4310, $02 = init to $420b ; ;######################################################## ; Macro to store data into Vram using a DMA transfer # ;######################################################## DMA .macro (SRCOFFSET,DEST,SIZE,REGSMODE,CHANNELDATA) PHB PHA PHP REP #$10 sep #$20 ldy #!$0000 lda #$00 xba lda CHANNELDATA ; load the channel to use. $10 from above tay stz $420B ; clear dma init port LDA SRCOFFSET+2 ; load the bank to transfer from sta $4304,y REP #$30 lda REGSMODE sta $4300,y Lda SRCOFFSET ; load 16-Bit offset sta $4302,y LDa SIZE ; size of data to transfer sta $4305,y LDa DEST ; vram location sta $2116 sep #$20 lda CHANNELDATA+1 ; start the transfer sta $420b PLP PLA PLB .endm