Megadrive multipart demo

Want to create a team or share a project ?

Moderator: Mask of Destiny

Fonzie
Genny lover
Posts: 323
Joined: Tue Aug 29, 2006 11:17 am
Contact:

Post by Fonzie » Sat Jan 06, 2007 10:52 am

Do you want an oldskool-style demo where you merely go from one part to the other in a predetermined order
Yeah, i think it could be good... i mean, one impressive screen per demo only... need to be rythmed by the same sound track i think...

Like you, i wont use interupts (i was too shocked by segacd hardware interupts-timings problems, no need them anymore LOL).
"Maybe the games from the original could be remade for the Genesis/Sega CD. "
Umm, then we need to tell ppl to dont use hint... too complex to drive with accurency on segacd.
I think it would be interesting to do something like Cascade Cassette 50.
Ho, you think? Well... maybe it is too much effort to make a gameplay code... But it could had some interest from the viewer... Anyinput?
but I can try composing something with MML.
Ho, nice :D Uushen driver is now z80 based?
Maybe we can use mvs tracker too :)

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

Post by Pascal » Sat Jan 06, 2007 7:22 pm

hey ! it's megadrive anniversary , why doing on segacd ;);)

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) » Mon Jan 08, 2007 9:35 am

Yesterday I was messing with my demo thingy, I noticed that 256KB is getting tight for me (PCM, FMV maybe), 512KB maybe (If we get no more than 8 people).
What about VBL and HBL ? My demo is VBL timed. My VBL routine is simple ADDQ.L #1, (VTIMER) timer.
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

Fonzie
Genny lover
Posts: 323
Joined: Tue Aug 29, 2006 11:17 am
Contact:

Post by Fonzie » Mon Jan 08, 2007 8:58 pm

Yo TMEE.

If your demo is just VBL timed, you should rather use VDP's Vflag... For that just wait for Vdrawing and loop until Vnothing happen :)

I was using VBL to increment a counter before, but then i found more handy to go for Vflag watching, it is so more stable.

As for the 256KB extend... well... If there is space, why not... but to be fair, you would have to negociate the additional space by providing something impressive ;)

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

Post by ob1 » Mon Jan 08, 2007 10:28 pm

I'd like to submit something but don't know yet if I'd be brave enough. For now, don't count me in.

Do we have a deadline yet ?

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) » Tue Jan 09, 2007 6:28 am

Fonzie wrote:Yo TMEE.

If your demo is just VBL timed, you should rather use VDP's Vflag... For that just wait for Vdrawing and loop until Vnothing happen :)

I was using VBL to increment a counter before, but then i found more handy to go for Vflag watching, it is so more stable.

As for the 256KB extend... well... If there is space, why not... but to be fair, you would have to negociate the additional space by providing something impressive ;)
OK, I'll try that that !!!
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 » Tue Jan 09, 2007 8:45 am

Great !!!
I've just figured it. Here it is, my way :

Code: Select all

GFX_CTRL	equ	$C00004

main:
*	main code goes here

waitVInt:
	move.w	GFX_CTRL,d0
	andi.w	#$0008,d0
	bne	waitVInt

*	code during V blank

waitVIntFinish:
	move.w	GFX_CTRL,d0
	andi.w	#$0008,d0
	beq	waitVIntFinish

	bra	main
or, for the Cish people :

Code: Select all

int main() {
	int * GFX_CTRL = (int *) 0xC00004;

/*	main code goes here*/

	while (!(*GFX_CTRL & 8)) ;

/*	code during V blank	*/

	while (*GFX_CTRL & 8)	;
}

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

Re: Megadrive multipart demo

Post by ob1 » Tue Jan 09, 2007 9:01 am

Fonzie wrote:This rom header can reroot hint and vint using vectors in ram to each demo.
Just figured out this too.

The header would be

Code: Select all

	dc.l	$00FFFFFC,$200
	dc.l	INT,INT,INT,INT,INT,INT,INT
	dc.l	INT,INT,INT,INT,INT,INT,INT,INT
	dc.l	INT,INT,INT,INT,INT,INT,INT,INT
	dc.l	INT,INT,INT,HBL,INT,$FF0000,INT,INT
	dc.l	INT,INT,INT,INT,INT,INT,INT,INT
	dc.l	INT,INT,INT,INT,INT,INT,INT,INT
	dc.l	INT,INT,INT,INT,INT,INT,INT,INT
	dc.l	INT,INT,INT,INT,INT,INT,INT
and for each demos, we would have something like

Code: Select all

	move.l	#$FF0000,a2
	move.w	#$5280,(a2)+	; addq.l	#1,d0
	move.w	#$4E73,(a2)+	; rte
	move.w	#$816C,GFX_CTRL	; enable V Int
where my V Int code is just

Code: Select all

addq.l	#1,d0
.

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

Post by Pascal » Tue Jan 09, 2007 9:39 am

that's the idea, but it's better to have an variable which hold a pointer to the user vblank function itself. Here's the code i'm using for my interrupts handling (HInt is the same)

Code: Select all

MD_VBlank_Cnt		 ds.l	  1; vblank counter
MD_VBlank_Handler	ds.l	1; *vblank function pointer
MD_HBlank_Handler	ds.l	1; *hblank function pointer

VBL:
	68K_DisableINT
	movem.l	d0-d7/a0-a6,-(a7)
	
	addq.l	#1,MD_VBlank_Cnt
	move.l	MD_VBlank_Handler,a0
	jsr	(a0)

        PAD_Read

	movem.l	(a7)+,d0-d7/a0-a6
	68K_EnableINT
	rte

*******************************************************************************
* MACRO		68K_InstallVBlankHandler	
* DESCRIPTION:	\1: Adress of the function to install as VBlank
* PARAMETERS:	
*******************************************************************************
MD_InstallVBlankHandler macro
	68K_DisableINT
	move.l	\1,MD_VBlank_Handler
	68K_EnableINT
	endm

*******************************************************************************
* MACRO		68K_DisableINT	
* DESCRIPTION:	Disable INT on the 68000
* PARAMETERS:	
*******************************************************************************
68K_DisableINT	macro	
	move.w	sr,-(sp)		; disable interrupt
	or.w	#$700,sr
	endm

*******************************************************************************
* MACRO		68K_EnableINT	
* DESCRIPTION:	Enable INT on the 68000
* PARAMETERS:	
*******************************************************************************
68K_EnableINT	macro
	move.w	(sp)+,sr 
	endm


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

Post by Stef » Tue Jan 09, 2007 1:02 pm

My basic library provides almost all needed basics functions as WaitVSync(), Z80Halt(), VDP_UploadTile(), ShowFPS(), DrawString(), IntToStr(), some timers functions...
It also provides a callback for VBlank interrupt and HBlank interrupt, bitmap support, a complete 3D transformation library with camera and 1 (directionnal) light support (for flat shading), but this part is just for fun as performance are quite limited...

Of course, all that stuff brings some overhead compared to a basic and direct use of hardware, but i try to keep the overhead as small i can and development is really easier. You don't have to rewrite all these basics routines. It could be nice to work on this base, of course everyone is free of doing as he want, but that could help in the library growing then developing a real and efficient genesis devkit in future :)

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) » Tue Jan 09, 2007 1:16 pm

I was thinking of relocatable VBL/HBL stuff, In RAM there are 2 routines, one for VBL other for HBL, when either of the ints happen, 68K then jumps to that routine in RAM. Routine itself is a JMP to location of your VBL/HBL routine. Use LEA to get the address of your routine and copy it to RAM. JMP should take 2 bytes and address 4 so 12 bytes are required.

Code: Select all

 MOVE.W #2700, SR ;disable ints

 LEA  RAM_routines, A0
 MOVE.L #$FF0000, A1
 MOVE.W (A0)+, (A1)+
 MOVE.W (A0)+, (A1)+
 MOVE.W (A0)+, (A1)+

 LEA    VBlank, A0 
 MOVE.L   A0, ($FF0002) ;I'm not sure if you can do this like so
 LEA    HBlank, A0
 MOVE.L   A0, ($FF0008)

 MOVE.W #2000, SR ;enable ints

IdleLoop:
 BRA  IdleLoop:

VBlank:
 ADDQ.L #1, (VTIMER)
 RTS

HBlank:
 ADDQ.L #1, (HTIMER)
 RTS

RAM_routines:
 JMP   #000000
 JMP   #000000
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

Mask of Destiny
Very interested
Posts: 615
Joined: Thu Nov 30, 2006 6:30 am

Post by Mask of Destiny » Sat Jan 20, 2007 3:29 pm

Fonzie wrote: Umm, then we need to tell ppl to dont use hint... too complex to drive with accurency on segacd.
If the demo is less than 53K or so, it's not complicated at all. Even if it's bigger than that, all you need to do is move the HInt handler to Genesis RAM.
(i was too shocked by segacd hardware interupts-timings problems, no need them anymore LOL).
I wasn't aware of there being a timing problem apart from HInts or is that all you're referring to. Technically there is a delay in both if all your code is in Word RAM as the vector table in the BIOS points to a series of long jump instructions, but it's not a big issue for VInts.
If your demo is just VBL timed, you should rather use VDP's Vflag... For that just wait for Vdrawing and loop until Vnothing happen

I was using VBL to increment a counter before, but then i found more handy to go for Vflag watching, it is so more stable.
Personally I always found it easier to just do all my per-frame rendering in my VInt handler, but to each his own I suppose.

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 24, 2007 11:24 am

OK, who is writing something ??? I am with some breaks
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

Post Reply