1. Macro DMA
As you can see it is a macro to do DMA Transfer just by calling it with your arguments.
macro CustomDMA(Channel, VRAM, TMode, Reg, Source, Size)
REP #$20
LDA #VRAM
STA $2116
SEP #$20
LDA #TMode
STA $43Channel0
LDA #Reg
STA $43Channel1
REP #$20
LDA #Source
STA $43Channel2
LDY.b #Source>>16
STY $43Channel4
LDA #Size
STA $43Channel5
SEP #$20
LDX #$0Channel
LDA DMAActivationTable,x
STA $420B
endmacro
Make sure you include this table somewhere in your code (not inside your macro!!!):
DMAActivationTable:
db $01,$02,$04,$08,$10,$20,$40,$80
To use this macro, call it like this:
%CustomDMA(ChannelNumber,VRAM Address,Transfer Mode,Register,Source Table,Size)
-Channel number is the channel number... 0-7, not $00-$07
-Even if you'll not upload anything to VRAM, set VRAM Address to $0000
-Transfer Mode ($00-$FF)
-Last two bytes of the register to write to ($212C would be $2C)
-Source Table is the table with data.
-Size, 16 bits.
-You'll have to edit the code a bit. Since blogger things that < and > makes a TAG, you'll have to edit each arguments and add a < before each one and add a > after each one.
2. Mode 7 HDMA
A simple HDMA code that allows you to stretch both X and Y factors by scanline, you just have to configure the table to your needs.
Mode7HDMA:
.X
REP #$20
LDA #$1B02
STA $4330
LDA #.XTable
STA $4332
LDX #.XTable>>16
STX $4334
.Y
LDA #$1E02
STA $4340
LDA #.YTable
STA $4342
LDX #.YTable>>16
STX $4344
SEP #$20
LDA #$18
STA $0D9F
RTS
.XTable
db $ScanLine : dw $Stretch_X
db $00
.YTable
db $ScanLine : dw $Stretch_Y
db $00
Well, that's it, I'm going to bed now, it is late here, see ya :3