I'm running into a problem with my hdma gradient when vwf_dialogues does dma to backup my layer 3 image.
For 1 frame after my layer 3 disappears my hdma gradient is a mess of colors like in the image below

This doesn't happen every time which makes it quite difficult to pin down the problem.
This is the dma code i from vwf (with the call that causes the problem):
Code;%dmatransfer(#$01,#$81,#$39,".b #!backupram>>16",".b $01",".b $00",#$0800)
macro dmatransfer(channel, dmasettings, destination, sourcebank, sourcehigh, sourcelow, bytes)
lda <dmasettings>
sta $4300
lda <destination>
sta $4301
lda<sourcelow> ; I put the label close to the opcode
sta $4302 ; to allow length definitions
lda<sourcehigh>
sta $4303
lda<sourcebank>
sta $4304
rep #$20
lda <bytes>
sta $4305
sep #$20
lda <channel>
sta $420B
endmacro
and this is my hdma creation code (only runs during init):
Code STZ $4330
LDA #$02
STA $4340
LDA #$32
STA $4331
STA $4341
REP #$20
LDA.w #Gradient1_BlueTable
STA $4332
LDA.w #Gradient1_RedGreenTable
STA $4342
SEP #$20
LDA.b #Gradient1_BlueTable>>16
STA $4334
LDA.b #Gradient1_BlueTable>>16
STA $4344
LDA #$18
TSB $6D9F
The project uses the sa-1 chip.
I tried looking into dma transfer stuff and hdma using regs.txt but wasn't able to find something obviously wrong with the code.
But someone will probably prove me wrong

As far as I know there are no other dma calls there.
Does anybody have a clue what's wrong or where I can examine further?
--------------------
My Youtube channel
Currently working on:
Project C
Finished project:
Follow Us On