512 colors demo

For anything related to VDP (plane, color, sprite, tiles)

Moderators: BigEvilCorporation, Mask of Destiny

Pascal
Very interested
Posts: 200
Joined: Wed Nov 29, 2006 11:29 am
Location: Belgium
Contact:

Post by Pascal » 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

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


Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Tue Jan 02, 2007 3:36 pm

Try this way :
- prepare your DMA transfert (writing DMA reg values)
- wait for the HBlank (Hblank flag = 1)
- do the DMA

Another better method :
- prepare your DMA transfert (writing DMA reg values)
- test the H counter to be > X
- disable VDP display
- do DMA
- enable VDP

Mickey Mania does that in the stag's race level to maximise the DMA capabilities.
By the way, you don't need to test for the DMA completion.
The 68K is frozen during all the DMA operation in case of a external memory -> VRAM / CRAM / VSRAM DMA.

Anyway 16 colors during a single scanline seems to be a bit optimist, try to lower to 8 colors only.

ob1
Very interested
Posts: 463
Joined: Wed Dec 06, 2006 9:01 am
Location: Aix-en-Provence, France

Post by ob1 » Tue Jan 02, 2007 8:07 pm

Stef wrote:Try this way :
- prepare your DMA transfert (writing DMA reg values)
- wait for the HBlank (Hblank flag = 1)
- do the DMA
Wht a clever way ! I'll try it.
Stef wrote:Anyway 16 colors during a single scanline seems to be a bit optimist, try to lower to 8 colors only.
Ouch !!! It's going to be quite hard, so !!!

TmEE co.(TM)
Very interested
Posts: 2440
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Post by TmEE co.(TM) » Wed Jan 03, 2007 9:32 am

ob1, your site is down... I'm not sure what the text says (I don't understand French) but it is related to "unavailable" I guess.
Mida sa loed ? Nagunii aru ei saa ;)
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Wed Jan 03, 2007 10:56 am

Site isn't down :
http://perso.orange.fr/olivier.brosseron

ob1 forgot to remove the ending point and the URL became wrong.

TmEE co.(TM)
Very interested
Posts: 2440
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Post by TmEE co.(TM) » Wed Jan 03, 2007 2:13 pm

now it works. Too bad that I don't know French language... none of you know Estonian so we're even
Mida sa loed ? Nagunii aru ei saa ;)
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen

ob1
Very interested
Posts: 463
Joined: Wed Dec 06, 2006 9:01 am
Location: Aix-en-Provence, France

Post by ob1 » Wed Jan 03, 2007 4:28 pm

Stef wrote:ob1 forgot to remove the ending point and the URL became wrong.
Thanks Stef' for pointing it out.
It's corrected now.

Post Reply