Hello SpritesMind,
I continue to learn the "low level" stuff on Megadrive ...
Have u some VPD tools (calc, registers helper) ?
I ve starting the coding of a tool for help me to dealing with vdp, but maybe you ve something already finished (forge vdp packet ..., registers ... ) ?
i ve found this http://www.hacking-cult.org/?vdp
Please share with me your "VDP tools" ...
VDP Tools ? (calc)
Moderators: BigEvilCorporation, Mask of Destiny
Re: VDP Tools ? (calc)
A lot of the time I use this bot called DocScratch (also ChaosGamma) on irc.badnik.zone that has a !vdp command, to convert from and to VDP commands. I also have the following macros for laziness' sake;
Do note that this macro is made for ASM68K specifically, so you probably need to modify it for any other assembler/compiler.
Code: Select all
vdpComm macro ins,addr,type,rwd,end,end2
if narg=5
\ins #(((\type&\rwd)&3)<<30)|(((\addr)&$3FFF)<<16)|(((\type&\rwd)&$FC)<<2)|(((\addr)&$C000)>>14), \end
elseif narg=6
\ins #(((((\type&\rwd)&3)<<30)|(((\addr)&$3FFF)<<16)|(((\type&\rwd)&$FC)<<2)|(((\addr)&$C000)>>14))\end, \end2
else
\ins (((\type&\rwd)&3)<<30)|(((\addr)&$3FFF)<<16)|(((\type&\rwd)&$FC)<<2)|(((\addr)&$C000)>>14)
endif
endm
; ===========================================================================
; values for the type argument
VRAM = %100001
CRAM = %101011
VSRAM = %100101
; values for the rwd argument
READ = %001100
WRITE = %000111
DMA = %100111
; ===========================================================================
; tells the VDP to copy a region of 68k memory to VRAM or CRAM or VSRAM
dma68kToVDP macro source,dest,length,type
move.l #(($9400|((((length)>>1)&$FF00)>>8))<<16)|($9300|(((length)>>1)&$FF)),(a5)
move.l #(($9600|((((source)>>1)&$FF00)>>8))<<16)|($9500|(((source)>>1)&$FF)),(a5)
move.w #$9700|(((((source)>>1)&$FF0000)>>16)&$7F),(a5)
vdpComm move.l,\dest,\type,DMA,(a5)
endm
; ===========================================================================
vdpcomm move.l,4,CRAM,WRITE,(a6)
vdpcomm dc.l,$20,VSRAM,WRITE
vdpcomm ori.l,$1234,VRAM,DMA,d2
vdpcomm move.w,$1234,VRAM,DMA,>>16)&$FFFF,$FFFF8234.w
dma68kToVDP SomeArt,$1234,$400,VRAM
Re: VDP Tools ? (calc)
Jeeeeeeeez that vdpComm macro looks like a mess O.O I normally use something like this instead, it may be more limited as it only does MOVE but I never had the need for anything else (and for that matter, that \where argument can be anything, e.g. ($C00004), 4(a0) or d7):
My DMA macros these days are more like yours, though again they follow the same pattern of multiple macros piggybacking on another generic one.
EDIT: oh by the way, if you ever need to calculate a command on the fly, you can always resort to something like this (optimize or change as needed):
Code: Select all
SetXRAMAddr: macro addr, where, cmd
move.l (\cmd)|(((\addr)&$3FFF)<<16)|((\addr)>>14), \where
endm
SetVRAMAddr: macro addr, where
SetXRAMAddr \addr, \where, $40000000
endm
SetCRAMAddr: macro addr, where
SetXRAMAddr \addr, \where, $C0000000
endm
SetVSRAMAddr: macro addr, where
SetXRAMAddr \addr, \where, $40000010
endm
EDIT: oh by the way, if you ever need to calculate a command on the fly, you can always resort to something like this (optimize or change as needed):
Code: Select all
and.l #$FFFF, d0
lsl.l #2, d0
lsr.w #2, d0
or.w #$4000, d0
swap d0
Sik is pronounced as "seek", not as "sick".
Re: VDP Tools ? (calc)
Yes it is a mess, but it is also very versatile. You can replicate any possible combination of instructions and modifiers to do anything you like. You could do that or.w #$4000,d0 with the macro too, and make it "easier to edit"
Re: VDP Tools ? (calc)
Thanks, cool these macros