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

StilettoAdministrator
They're always after me Lucky ROMS!
Reged: 03/07/04
Posts: 6472
Send PM
Re: Display information vs screen dumps
05/04/08 09:23 AM


> What does the new attributes in display mean?
> I'm talking about htotal, hbend, hbstart etc.
>
> Take 'amidar' for example. The width is 768 according to the mame info. With rotate
> at 90, that would be that the height value is for the width and the width is for the
> height. That would give a height of 768.
>
> The height of 224 becomes the width and that's correct, but my screen dumps have a
> height of only 256. I'm thinking that the other attributes have something to do with
> it, but I can't figure it out.
>
> Anyone that can help me?

They are raw video parameters. Are you familiar with video "modelines" in Linux, etc?

width, height, refresh should be obvious.
pixclock is the pixel clock.
htotal is the total horizontal lines (htotal = width + right border + hsync + left border)
hbstart is HBLANK (horizontal blank) start, the pixel number in which to start horizontal blanking. Measured from the leading edge of H sync.
hbend is HBLANK (horizontal blank) end, the pixel number in which to end horizontal blanking. Measured from the leading edge of H sync.
vtotal is the total vertical lines (vtotal = height + top border + sync + bottom border)
vbstart is VBLANK (vertical blank) start, the pixel number in which to start vertical blanking. Measured from the leading edge of V sync.
vbend is VBLANK (vertical blank) end, the pixel number in which to end vertical blanking. Measured from the leading edge of V sync.

Amidar has:
width: 768
height: 224
refresh: 60.606061 Hz
pixclock: 18432000 (Hz)
htotal: 1152
hbend: 0
hbstart: 768
vtotal: 264
vbend: 16
vbstart: 240

Given htotal and pixclock, we can derive HFREQ or the horizontal refresh rate
HFREQ = pixclock / htotal = 18432000/1152 = 16000 = 16 kHz
Also, HFREQ = VFREQ * vtotal
so VFREQ = 16000/264 = 60.606061 Hz.

For more info, read info on Linux modelines such as:
http://howto-pages.org/ModeLines/
http://easymamecab.mameworld.net/html/monitor1.htm
http://linuxconsole.sourceforge.net/fbdev/HOWTO/3.html
Modeline calculator (Python): http://svn.pardus.org.tr/uludag/trunk/comar/zorg/zorg/modeline.py

---------------------

Now that you've read all that and understand what HBLANK, VBLANK, HSYNC, VSYNC, and so on are, to understand further Amidar's case, go read the source - this is one of the cases where it's extremely well documented as it was rewritten from schematics.
http://mamedev.org/source/src/mame/video/galaxian.c.html
http://mamedev.org/source/src/mame/drivers/galaxian.c.html

This explains why your screenshot is 256x224 but the "resolution" is 768x224. The screenshot is the actual pixel-by-pixel screen dump, the resolution is including all the timing information (we're going by the 18.342 MHz "master clock" (in the info case the pixel clock), which is divided by three to provide a 6.144 MHz signal that drives the video logic, described as "pixel clock" in the driver. What is 256 times 3? 768.

And remember this basic equation, where HFP = "Horizontal Front Porch", HBP = "Horizontal Back Porch" and HDISP = "Horizontal Displayed pixels", active area, whatever:
HTOTAL=HSYNC+HFP+HDISP+HBP=HBLANK+HDISP
HBLANK=HSYNC+HFP+HBP

Ergo:
44 pixels front porch
32 pixels horizontal sync
44 pixels back porch
6 pixels left border
256 pixels video
2 pixels right border
---
384 pixels total per line

And scaled from 6.144MHz to 18.432MHz?
132 pixels front porch
96 pixels horizontal sync
132 pixels back porch
18 pixels left border
768 pixels video
6 pixels right border
---
1152 pixels total per line

But given the measurements from schematics in the source code, it's actually:
42 pixels front porch
32 pixels horizontal sync
46 pixels back porch
6 pixels left border
256 pixels video
2 pixels right border
---
384 pixels total per line

And scaled from 6.144MHz to 18.432MHz?
126 pixels front porch
96 pixels horizontal sync
138 pixels back porch
18 pixels left border
768 pixels video
6 pixels right border
---
1152 pixels total per line

Or something like that. I probably got the front porch and back porch flipped.

There, I think I got all that right. Late at night when fueled by caffeine and adrenaline, I enjoy taking on questions like these that aren't quite my usual cup of tea. I'm sure Haze or couriersud or someone will be along to nitpick later.

[EDIT] Oh yeah, and Galaxian's resolution was doubled because of the stars:
http://mametesters.org/mantis/bug_view_advanced_page.php?bug_id=199

So... that would be an actual game resolution of 128x112 except the stars are literally 0.5 pixels, so we doubled the resolution for our emulation. I think.

- Stiletto

Edited by Stiletto (05/04/08 11:16 AM)







Entire thread
Subject Posted by Posted on
* Display information vs screen dumps BartA 05/03/08 10:33 PM
. * Regarding the highscore site Heihachi_73  05/26/08 11:30 PM
. * Re: Display information vs screen dumps Heihachi_73  05/26/08 08:54 PM
. * Re: Display information vs screen dumps StilettoAdministrator  05/04/08 09:23 AM
. * Re: Display information vs screen dumps BartA  05/04/08 11:23 AM
. * Re: Display information vs screen dumps R. Belmont  05/04/08 07:30 PM
. * Re: Display information vs screen dumps couriersud  05/04/08 03:11 PM
. * Re: Display information vs screen dumps Olivier Galibert  07/25/08 02:26 AM

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