MAMEWorld >> Programming
Previous thread Previous  View all threads Index   Next thread Next   Flat Mode Flat  

SMurf
MAME Fan
Reged: 05/08/11
Posts: 3
Send PM
Sega System 16b Sprites (e.g. Out Run)
05/09/11 06:33 PM


Hello,

I'm trying to get to grips with the way drivers work, with a view to perhaps writing my own in the near future (if I can ever get the hang of all those crazy macros!). I've had a look at the different ways in which tile sets can be stored, but now want to look at actual variable-size sprites.

As a visually impressive (for oldies ) game I have always been impressed by the fluidity of the graphics on Out Run. Although my Atari ST nearer the time had the same CPU, it did not have any coprocessors nor did it run quite that fast, so the same game was a damp, chirpy squib.

My understanding of the "gfx2" memory region defined by the driver so far is thus:-

  • It consists of the ROMs mpr-10371.9, mpr-10373.10, mpr-10375.11, mpr-10377.12, mpr-10372.13, mpr-10374.14, mpr-10376.15 and mpr-10378.16 (in that order);

  • The ROMs are byte interleaved in groups of four (first 512KB = 10371/3/5/7, second 512KB = 10372/4/6/8);

  • The sprites are in a 4-bit (16 colour) packed format, such that e.g. pixel 1 = (byte >> 4) and pixel 2 = (byte & 0xF);

  • A sprite scanline ends with a pixel with the colour 15, in either half of the byte;

  • Pixels with the colour 0 are not drawn (transparent).


Based on what I had learnt, I sought to make a kind of sprite viewer in C, which loads the first four ROMs in the list, interleaves them in memory and then attempts to draw based on the rules above.

Unfortunately, I seem to be "off" slightly. It looks like some pairs of pixels are reversed for some reason, and I get a blank scanline between each sprite scanline.

I can't really see where I've gone wrong. I thought it might be some sort of endian issue, so I tried mixing up the interleaving but this only produces either slightly better or slightly worse results. I think I'm missing something fundamental.

Can anyone with experience in System 16B sprites help me out?







Entire thread
Subject Posted by Posted on
* Sega System 16b Sprites (e.g. Out Run) SMurf 05/09/11 06:33 PM
. * Re: Sega System 16b Sprites (e.g. Out Run) Phil Bennett  05/12/11 01:24 PM
. * Re: Sega System 16b Sprites (e.g. Out Run) SMurf  05/15/11 11:36 PM
. * Re: Sega System 16b Sprites (e.g. Out Run) Phil Bennett  05/16/11 02:13 PM
. * Re: Sega System 16b Sprites (e.g. Out Run) SMurf  05/17/11 01:36 AM

Extra information Permissions
Moderator:  Pi 
0 registered and 45 anonymous users are browsing this forum.
You cannot start new topics
You cannot reply to topics
HTML is enabled
UBBCode is enabled
Thread views: 4131