512 colors demo

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

Moderators: BigEvilCorporation, Mask of Destiny

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

512 colors demo

Post by ob1 » Wed Dec 27, 2006 11:00 am

Damned !
I try hard to run a 512 colors demo, but can't manage to do it. I've read the TmEE 960 demo, but didn't figure out how to use it.
So, here are my datas.
I have 16 tiles, from 00000000 ... 00000000 to FFFFFFFF ... FFFFFFFF. I store it in VRAM 0x0000
I have 512 colors, from 0000, 0002, 0004 ... to 0EEE. It is stored in RAM 0XFF0000
I have plane A 0000, 0001, ... 000F, 2000, 20001, ... 2000F ... to 600F. 64 tiles, 2 lines of tiles, 16 raster lines, that I repeat so that the A plane is full.

Here's my point.
My plane is made of 2 rows of 32 tiles. I repeat this 2 rows to fill the screen. These 2 rows are 16 raster lines height. So, I want the H interrupt to be triggered every 16 lines. So I put

Code: Select all

move.w #$8A10,GFX_CTRL
My palettes are at 0xFF0000. There are 512 colors, or 8 x 64 colors, or 8 x 4 x 16 colors. The palette size is 64 16-bit words : 0x0080 But for the sake of optimisaiton, I'll only go with a 0x40 step. Each 2 rows (remember, 16 raster lines), I want the CRAM to be changed : the first 2 rows use palette at FF0000, the next 2 rows use palette at FF0040, ... and so on.

I want to use DMA.
Address FF0000, FF0040, FF0080 ... become 7F8000, 7F8020, 7F8040, ...
DMA src high and DMA src mid remain the same (977F and 9680). Only DMA src low will change, incrementing by 0x20 every time. 0x20 will be my offset.

When the H int is triggered (so every 16 raster line),
I add the offset to the DMA src low reg (9500).
I switch DMA ON, I trigger DMA to CRAM 0x00.
I finally turn DMA off.

It runs once, I even see it in the GensKmod Debug message, but then, the DMA is never triggered again !!! I enter HBL, the offset is incremented, I see the DMA src low running ... but nothing happens ! My palette remains the same, and the debug message doesn't show anything anymore.

Here's my HBL code :

Code: Select all

HBL:
	add.b	d2,d1           ; d2 is 0x20, d1 was initialized to $9500
	move.w	d1,(a0)		; put DMA src low, a0 = #$GFX_CTRL

	move.w	d3,(a0)		; Set DMA ON, d3 = #$817C
	move.l	d5,(a0)		; Trigger DMA to CRAM 0x00, d5 = C0000080
	move.w	d4,(a0)		; Set DMA OFF, d4 = #816C
	rte
Have I done something wrong ?

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

Post by Stef » Wed Dec 27, 2006 4:43 pm

In a first and fast shot, i don't see any particular mistake but there is many possibilities of error for that type of "demo".
Are you sure you H-Int code executed ? what happen exactly ? blank screen ?

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

Post by ob1 » Wed Dec 27, 2006 5:37 pm

You'll find the whole code on my site :
http://perso.wanadoo.fr/olivier.brosseron/PAL512.ASM

It looks as if after the first DMA, I can't make it anymore.

Thank for interest.

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

Post by ob1 » Wed Dec 27, 2006 5:44 pm

It's 64 words long. Much more than the transfer quantity of 16 as specified in the Sega Genesis Technical Overview. Do I try to DMA too much ?
All my instructions take 120 cycles. Much more than the 36 CPU cycles of the same doc. Are my settings too slow ?

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

Post by ob1 » Thu Dec 28, 2006 9:34 am

It looks as if I was doing bad my DMA to CRAM. Afeter the DMA to CRAM, I can't make any DMA again.
Charles MacDonald points
When doing a transfer to CRAM, the operation is aborted once the address register is larger than 7Fh.
The problem wouldn't be in HBL, but in my DMA.

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

Post by Stef » Thu Dec 28, 2006 9:42 am

Try to shorter your transfert. Anyway normally even in this case you should be able to DMA severals time. What about try to trace your code execution in an emulator ? does it works in emulator ? if not the problem is somewhere else...
Gens with debug feature permit you to trace execution and do some fictives H interrupt.

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

Post by ob1 » Thu Dec 28, 2006 1:26 pm

Wel wel well...
I've manage to do DMA while HBL. Couldn't figure out why it wouldn't run sooner. But I can't get the 512 colors ... The best I have is a multi-colored blanking screen
Fifty-fifty...

I've tried to do DMA from VRAM to CRAM
move.l #$C00000C0,GFX_CTRL ; Trigger DMA to CRAM 0x0000
, and it didn't run either. Guess it should be impossible.

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

Post by ob1 » Thu Dec 28, 2006 2:42 pm

Ok I got it working. It displays ... 256 colors.
Not so bad.
I'm beginning to feel bored.
Guess it's time for a change ...

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

Post by Stef » Fri Dec 29, 2006 10:40 am

What was wrong ?
It can probably be usefull for others :)

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

Post by ob1 » Fri Dec 29, 2006 12:36 pm

I may have put too much on optimisation. DMA transfer size being constant, I get it out of HBL. Maybe it was deleted, or something ....

I don't know what was wrong. I haven't exactly pointed the bug.
Sorry.
Maybe I'll rework on it after my holidays.

For now, I'm currently working on a SEGA Saturn SCU assembler.

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

Post by Stef » Fri Dec 29, 2006 2:18 pm

ob1 wrote:I may have put too much on optimisation. DMA transfer size being constant, I get it out of HBL. Maybe it was deleted, or something ....

I don't know what was wrong. I haven't exactly pointed the bug.
Sorry.
Maybe I'll rework on it after my holidays.

For now, I'm currently working on a SEGA Saturn SCU assembler.
Ok no problems, i was just curious about that :)

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

Post by TmEE co.(TM) » Fri Dec 29, 2006 3:44 pm

I can't help you here, I myself have not messed with DMA... yet...
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: 407
Joined: Wed Dec 06, 2006 9:01 am
Location: Aix-en-Provence, France

Post by ob1 » Tue Jan 02, 2007 7:40 am

I've put the demo on my site : http://perso.wanadoo.fr/olivier.brosseron.
Last edited by ob1 on Wed Jan 03, 2007 4:27 pm, edited 1 time in total.

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

Post by Fonzie » Tue Jan 02, 2007 11:05 am

Yo,
Usualy, any write to CRAM during retrace create a glitch (a pixel of the background color) on the TV... Using DMA really remove all glitches?

I thought about making a tool/engine that reload two colors each line with precise values according to a specialy designed background...
For a fight game, for exemple... If you reload two colors each line, you could get a virtual 224*2+16 colors background with just one palette and one plane used :)

Pascal, i had this idea from your work but but it was working with reloading the entiere palette each line, isn't it?... too slow, i think and would generate a very wierd color aspect.

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

Post by Pascal » Tue Jan 02, 2007 11:42 am

Fonzie wrote: Pascal, i had this idea from your work but but it was working with reloading the entiere palette each line, isn't it?... too slow, i think and would generate a very wierd color aspect.
No actualy i tried to reload an entire palette every 32 pixels (4 tiles) height, but still glitchy on the hard (using dma) so i gave up
Last edited by Pascal on Tue Jan 02, 2007 12:00 pm, edited 1 time in total.

Post Reply