Posted: Tue Jan 02, 2007 11:49 am
here's how i setup dma, for transfering a palette to CRAM palette 0
d0 = address of the palette to transfert
d0 = address of the palette to transfert
Code: Select all
VDP_SetRegister $13,((16)&$ff) ; set length
VDP_SetRegister $14,((0)&$ff)
lsr.l #1,d0 ; low source d0 source
move.w #$9500,d3
move.b d0,d3
move.w d3,VDP_CTRL
lsr.l #8,d0 ; mid source
move.w #$9600,d3
move.b d0,d3
move.w d3,VDP_CTRL
lsr.l #8,d0 ; high source
move.w #$9700,d3
move.b d0,d3
andi.b #$7f,d3
move.w d3,VDP_CTRL
0: move.b VDP_CTRL,d0 ; wait dma
btst #1,d0
beq 0
VDP_SetCRAMWriteAddrFlag 0,VDP_CTRL,$80 ; command flag
*******************************************************************************
* MACRO: VDP_SetCRAMWriteAddrMode(Adresse,Destination)
* DESCRIPTION: Sets up the VDP for cram Write, calcs an address for
* the CRAM write.
* PARAMETERS: \1 address of CRAM,
* \2 Where to store the result - long! (will typically be VCTRL)
* \3 mode to or
*******************************************************************************
VDP_SetCRAMWriteAddrFlag macro
move.l #$C0000000|((\1&$3fff)<<16)|((\1>>14)&3)|\3,\2
endm
*******************************************************************************
* MACRO SetVdpRegister REGISTER,VALUE
* DESCRIPTION: Puts a value into one of the Genesis's VDP registers.
* This macro only works for CONSTANTS.
* PARAMETERS: VDP Register #,
* Value to place into the register
*******************************************************************************
VDP_SetRegister macro
move.w #$8000|(\1<<8)|\2,VDP_CTRL ; check out the SEGA manual
endm