MAMEWorld >> EmuChat
View all threads Index   Threaded Mode Threaded  

Pages: 1

caius
MAME Fan
Reged: 10/09/06
Posts: 78
Send PM


How to change refresh rate in MAME drivers?
#244615 - 01/26/11 01:23 AM


Hi all,
I have done some measurements on various PCBs about their VSync (or refresh rate, it's the same).Fot this purpose I used the famous EL4583 Sync separator plus my frequency counter and a low-pass filter with cut-off frequency of 72.4 Hz.
Now I'd want to try new correct values in a MAME build.So my question is:
what is he precise portion of code I have to change?Some time ago, before source code reorganization, it was simple but now I really don't know where to look.
Thanks in advance



R. Belmont
Cuckoo for IGAvania
Reged: 09/21/03
Posts: 9713
Loc: ECV-197 The Orville
Send PM


Re: How to change refresh rate in MAME drivers? new [Re: caius]
#244671 - 01/26/11 06:17 PM


> Now I'd want to try new correct values in a MAME build.So my question is:
> what is he precise portion of code I have to change?Some time ago, before source code
> reorganization, it was simple but now I really don't know where to look.
> Thanks in advance

Depends on the driver. They'll either have an MCFG_SCREEN_REFRESH_RATE(59.94) line in which case it's exactly like how that parameter's worked since forever, or an MCFG_SCREEN_RAW_PARAMS() line, in which case you shouldn't touch it



caius
MAME Fan
Reged: 10/09/06
Posts: 78
Send PM


Re: How to change refresh rate in MAME drivers? new [Re: R. Belmont]
#244682 - 01/26/11 09:40 PM



> or an
> MCFG_SCREEN_RAW_PARAMS() line, in which case you shouldn't touch it

So, drivers with this cannot be changed?Why?Maybe because it's related to more games grouped in a system (like Namco System 1, konami GX, etc..)?

P.S:
For example, Altered Beast refresh rate is 60.054389 Hz.Looking into segas16b.c source code I found:

MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK_25MHz/4, 400, 0, 320, 262, 0, 224)

From this line is calculated 60.054389 Hz?



couriersud
Reged: 03/27/07
Posts: 214
Send PM


Re: How to change refresh rate in MAME drivers? new [Re: caius]
#244683 - 01/26/11 09:45 PM


> > or an
> > MCFG_SCREEN_RAW_PARAMS() line, in which case you shouldn't touch it
>
> So, drivers with this cannot be changed?Why?Maybe because it's related to more games
> grouped in a system (like Namco System 1, konami GX, etc..)?

The MFCG_SCREEN_RAW_PARAMS line usually is a "translation" of the game schematics video section. The refresh rate is derived from the parameters in there - the same as on the real board.

Should your measurements reveal different values to the refresh rate displayed in the mame ui, we are of course interested to hear about it.



caius
MAME Fan
Reged: 10/09/06
Posts: 78
Send PM


Re: How to change refresh rate in MAME drivers? new [Re: couriersud]
#244694 - 01/26/11 10:49 PM



> The MFCG_SCREEN_RAW_PARAMS line usually is a "translation" of the game schematics
> video section. The refresh rate is derived from the parameters in there - the same as
> on the real board.
>
> Should your measurements reveal different values to the refresh rate displayed in the
> mame ui, we are of course interested to hear about it.

Ok, thanks for the explanation.
For example I Measured the Vsync of a Pyros oginal Toaplan at
54.879 Hz, in MAME it's at 54.000000 Hz.looking at wardner.c
there is:

MCFG_SCREEN_REFRESH_RATE( (XTAL_14MHz / 2) / (446 * 286) )

How I change it?

Obviosuly I'll send to Smitdogg the results of my measurements.



R. Belmont
Cuckoo for IGAvania
Reged: 09/21/03
Posts: 9713
Loc: ECV-197 The Orville
Send PM


Re: How to change refresh rate in MAME drivers? new [Re: caius]
#244695 - 01/26/11 10:52 PM


> Ok, thanks for the explanation.
> For example I Measured the Vsync of a Pyros oginal Toaplan at
> 54.879 Hz, in MAME it's at 54.000000 Hz.looking at wardner.c
> there is:
>
> MCFG_SCREEN_REFRESH_RATE( (XTAL_14MHz / 2) / (446 * 286) )

That's showing you how it's calculated: 7 MHz pixel clock divided by 446 horizontal pixels (including hblank) times 286 vertical scanlines (including vblank).



mogli
MAME Fan
Reged: 01/26/08
Posts: 1956
Send PM


Re: How to change refresh rate in MAME drivers? new [Re: R. Belmont]
#244701 - 01/27/11 12:18 AM


> > Ok, thanks for the explanation.
> > For example I Measured the Vsync of a Pyros oginal Toaplan at
> > 54.879 Hz, in MAME it's at 54.000000 Hz.looking at wardner.c
> > there is:
> >
> > MCFG_SCREEN_REFRESH_RATE( (XTAL_14MHz / 2) / (446 * 286) )
>
> That's showing you how it's calculated: 7 MHz pixel clock divided by 446 horizontal
> pixels (including hblank) times 286 vertical scanlines (including vblank).

....I thought the 'lines drawn' are perpendicular to each axis. So, while the "446 horizontal pixels" makes sense, as how far across to draw; the '286' is how many horizontal lines are drawn. That is, on a graph, lines drawn on the X axis are *vertical*....



Consider it high comedy....sincere tragedy....whatever...don't take it personally.

The Culture




drewcifer
One bad Mutha-(shut yo' mouth!)
Reged: 07/01/04
Posts: 428
Loc: Sweden
Send PM


Re: How to change refresh rate in MAME drivers? new [Re: R. Belmont]
#244702 - 01/27/11 12:35 AM


> > Ok, thanks for the explanation.
> > For example I Measured the Vsync of a Pyros oginal Toaplan at
> > 54.879 Hz, in MAME it's at 54.000000 Hz.looking at wardner.c
> > there is:
> >
> > MCFG_SCREEN_REFRESH_RATE( (XTAL_14MHz / 2) / (446 * 286) )
>
> That's showing you how it's calculated: 7 MHz pixel clock divided by 446 horizontal
> pixels (including hblank) times 286 vertical scanlines (including vblank).

It looks like it's integer arithmetic though, so it's only getting 54.0 instead of the proper 54.879.

I'm guessing a couple of .0's and a typecast are in order:
MCFG_SCREEN_REFRESH_RATE( ((double)XTAL_14MHz / 2.0) / (446.0 * 286.0) )

Nice to see your sync measuring device is working perfectly, caius!

Andrew



R. Belmont
Cuckoo for IGAvania
Reged: 09/21/03
Posts: 9713
Loc: ECV-197 The Orville
Send PM


Re: How to change refresh rate in MAME drivers? new [Re: drewcifer]
#244706 - 01/27/11 12:56 AM


> > > MCFG_SCREEN_REFRESH_RATE( (XTAL_14MHz / 2) / (446 * 286) )
> >
> > That's showing you how it's calculated: 7 MHz pixel clock divided by 446 horizontal
> > pixels (including hblank) times 286 vertical scanlines (including vblank).
>
> It looks like it's integer arithmetic though, so it's only getting 54.0 instead of
> the proper 54.879.

Good call. If you make it use FP math it does match the measured 54.87.



R. Belmont
Cuckoo for IGAvania
Reged: 09/21/03
Posts: 9713
Loc: ECV-197 The Orville
Send PM


Re: How to change refresh rate in MAME drivers? new [Re: mogli]
#244708 - 01/27/11 12:59 AM


> > > MCFG_SCREEN_REFRESH_RATE( (XTAL_14MHz / 2) / (446 * 286) )
> >
> > That's showing you how it's calculated: 7 MHz pixel clock divided by 446 horizontal
> > pixels (including hblank) times 286 vertical scanlines (including vblank).
>
> ....I thought the 'lines drawn' are perpendicular to each axis. So, while the "446
> horizontal pixels" makes sense, as how far across to draw; the '286' is how many
> horizontal lines are drawn. That is, on a graph, lines drawn on the X axis are
> *vertical*....

I don't quite get what you're saying here. Yes, the 286 is how many horizontal lines ("scanlines" in TV technical parlance) are drawn. That's why the math is how it is.



AWJ
Reged: 03/08/05
Posts: 936
Loc: Ottawa, Ontario
Send PM


Re: How to change refresh rate in MAME drivers? new [Re: R. Belmont]
#244709 - 01/27/11 01:01 AM


> > > > MCFG_SCREEN_REFRESH_RATE( (XTAL_14MHz / 2) / (446 * 286) )
> > >
> > > That's showing you how it's calculated: 7 MHz pixel clock divided by 446
> horizontal
> > > pixels (including hblank) times 286 vertical scanlines (including vblank).
> >
> > It looks like it's integer arithmetic though, so it's only getting 54.0 instead of
> > the proper 54.879.
>
> Good call. If you make it use FP math it does match the measured 54.87.

Or better yet, just convert it to raw params... and do twincobr.c while you're at it since it's got the exact same formula for refresh rate.



caius
MAME Fan
Reged: 10/09/06
Posts: 78
Send PM


Re: How to change refresh rate in MAME drivers? new [Re: drewcifer]
#244710 - 01/27/11 01:10 AM



> Nice to see your sync measuring device is working perfectly, caius!
>
> Andrew

Yes, with the help of Guru (yes, always him) I solved my trouble.It was needed to use a low-pass filter (I built one with a cut-off frequency of 72.4 Hz.Now the readings are very stable and precise!



AWJ
Reged: 03/08/05
Posts: 936
Loc: Ottawa, Ontario
Send PM


Re: How to change refresh rate in MAME drivers? new [Re: caius]
#244711 - 01/27/11 01:15 AM


> > Nice to see your sync measuring device is working perfectly, caius!
> >
> > Andrew
>
> Yes, with the help of Guru (yes, always him) I solved my trouble.It was needed to use
> a low-pass filter (I built one with a cut-off frequency of 72.4 Hz.Now the readings
> are very stable and precise!

Is your device fast enough to measure horizontal sync as well? Knowing the exact vertical frequency of a board is nice, but even better is knowing the number of scanlines in a frame and the VBlank duration.



caius
MAME Fan
Reged: 10/09/06
Posts: 78
Send PM


Re: How to change refresh rate in MAME drivers? new [Re: AWJ]
#244716 - 01/27/11 01:53 AM



> Is your device fast enough to measure horizontal sync as well? Knowing the exact
> vertical frequency of a board is nice, but even better is knowing the number of
> scanlines in a frame and the VBlank duration.

Yes, I can measure also the horizontal Sync (uusally 15.70 KHz) probing the PIN14 of the EL4583 Sync separator IC.If you need some measurements feel free to ask.



AWJ
Reged: 03/08/05
Posts: 936
Loc: Ottawa, Ontario
Send PM


Re: How to change refresh rate in MAME drivers? new [Re: caius]
#244722 - 01/27/11 02:30 AM


> > Is your device fast enough to measure horizontal sync as well? Knowing the exact
> > vertical frequency of a board is nice, but even better is knowing the number of
> > scanlines in a frame and the VBlank duration.
>
> Yes, I can measure also the horizontal Sync (uusally 15.70 KHz) probing the PIN14 of
> the EL4583 Sync separator IC.If you need some measurements feel free to ask.

Can your setup determine the exact (integer) number of HSyncs per VSync? In other words, the total number of scanlines (visible + blank) in a frame.

If you have any cave.c or toaplan2.c PCBs I'd like to see measurements from them.



mogli
MAME Fan
Reged: 01/26/08
Posts: 1956
Send PM


Re: How to change refresh rate in MAME drivers? new [Re: R. Belmont]
#244734 - 01/27/11 06:13 AM


> > > > MCFG_SCREEN_REFRESH_RATE( (XTAL_14MHz / 2) / (446 * 286) )
> > >
> > > That's showing you how it's calculated: 7 MHz pixel clock divided by 446
> horizontal
> > > pixels (including hblank) times 286 vertical scanlines (including vblank).
> >
> > ....I thought the 'lines drawn' are perpendicular to each axis. So, while the "446
> > horizontal pixels" makes sense, as how far across to draw; the '286' is how many
> > horizontal lines are drawn. That is, on a graph, lines drawn on the X axis are
> > *vertical*....
>
> I don't quite get what you're saying here. Yes, the 286 is how many horizontal lines
> ("scanlines" in TV technical parlance) are drawn. That's why the math is how it is.

Well, above, you said "286 vertical scanlines". And I'm saying this because it seems, even after all these years, that most people think that the first number = horizontal lines drawn.



Consider it high comedy....sincere tragedy....whatever...don't take it personally.

The Culture




mogli
MAME Fan
Reged: 01/26/08
Posts: 1956
Send PM


Yeah, operative words: in a frame (nt) new [Re: caius]
#244738 - 01/27/11 07:49 AM





Consider it high comedy....sincere tragedy....whatever...don't take it personally.

The Culture




9ofzeven
MAME Fan
Reged: 09/02/05
Posts: 124
Loc: Austria
Send PM


Re: How to change refresh rate in MAME drivers? new [Re: caius]
#244743 - 01/27/11 11:44 AM


> Hi all,
> I have done some measurements on various PCBs about their VSync (or refresh rate,
> it's the same).Fot this purpose I used the famous EL4583 Sync separator plus my
> frequency counter and a low-pass filter with cut-off frequency of 72.4 Hz.

Can you publish the schematics and components of this device?

And a more general question (to the devs): How reliable is the current documentation of clock frequencies in MAME? Would it make sense to have more people measure their PCBs?



caius
MAME Fan
Reged: 10/09/06
Posts: 78
Send PM


Re: How to change refresh rate in MAME drivers? new [Re: 9ofzeven]
#244744 - 01/27/11 12:21 PM



> Can you publish the schematics and components of this device?
>
> And a more general question (to the devs): How reliable is the current documentation
> of clock frequencies in MAME? Would it make sense to have more people measure their
> PCBs?

Sure.The circuit I built is this :

http://img692.imageshack.us/img692/8206/snap1nx.jpg

The circuit uses the EL4583 Sync separator IC form Elantec, I buy this on Ebay in DIL package (it's quite hard to find in DIL because now they are made only in SOP package)
Then in order to make the readings of the Vsync on PIN5 of the EL4583 stable and precise, I added to the input of my frequency counter a simple low-pass filter with a 22KOhm resistor and a 0.1uF capacitor:

http://img522.imageshack.us/img522/8172/lowpassfilter.png

Maybe you don't need this low-pass filter if your frequency counter has already one.



caius
MAME Fan
Reged: 10/09/06
Posts: 78
Send PM


Re: How to change refresh rate in MAME drivers? new [Re: AWJ]
#244747 - 01/27/11 01:09 PM



>
> Can your setup determine the exact (integer) number of HSyncs per VSync? In other
> words, the total number of scanlines (visible + blank) in a frame.
>

I don't know..please, tell me how I can measure or calculate this?I repeat , I can measure exact Vsync and Hsync frequency.


> If you have any cave.c or toaplan2.c PCBs I'd like to see measurements from them.

I don't have any of these PCBs, sorry.



9ofzeven
MAME Fan
Reged: 09/02/05
Posts: 124
Loc: Austria
Send PM


Re: How to change refresh rate in MAME drivers? new [Re: caius]
#244825 - 01/28/11 11:33 AM


> > Can you publish the schematics and components of this device?
> >
> > And a more general question (to the devs): How reliable is the current
> documentation
> > of clock frequencies in MAME? Would it make sense to have more people measure their
> > PCBs?
>
> Sure.The circuit I built is this :
>
> http://img692.imageshack.us/img692/8206/snap1nx.jpg
>
> The circuit uses the EL4583 Sync separator IC form Elantec, I buy this on Ebay in DIL
> package (it's quite hard to find in DIL because now they are made only in SOP
> package)
> Then in order to make the readings of the Vsync on PIN5 of the EL4583 stable and
> precise, I added to the input of my frequency counter a simple low-pass filter with a
> 22KOhm resistor and a 0.1uF capacitor:
>
> http://img522.imageshack.us/img522/8172/lowpassfilter.png
>
> Maybe you don't need this low-pass filter if your frequency counter has already one.

Wow, thanks! I will keep this for reference.



R. Belmont
Cuckoo for IGAvania
Reged: 09/21/03
Posts: 9713
Loc: ECV-197 The Orville
Send PM


Re: How to change refresh rate in MAME drivers? new [Re: mogli]
#245236 - 01/31/11 11:27 PM


> Well, above, you said "286 vertical scanlines". And I'm saying this because it seems,
> even after all these years, that most people think that the first number = horizontal
> lines drawn.

Yes, and that is correct. The total vertical resolution is 286 lines (including vblank). I sense I've hit some kind of obscure bugaboo of yours, but my terminology is correct.



Vas Crabb
BOFH
Reged: 12/13/05
Posts: 4457
Loc: Melbourne, Australia
Send PM


Re: How to change refresh rate in MAME drivers? new [Re: R. Belmont]
#245442 - 02/02/11 11:39 AM


> Yes, and that is correct. The total vertical resolution is 286 lines (including
> vblank). I sense I've hit some kind of obscure bugaboo of yours, but my terminology
> is correct.

It's because resolution of various video tape systems is quoted in "television lines" which is actually counting the number of alternating black and white vertical lines you can pull out of it. The number of horizontal lines is, of course, determined by whether it's PAL, NTSC or SECAM.



mogli
MAME Fan
Reged: 01/26/08
Posts: 1956
Send PM


Re: How to change refresh rate in MAME drivers? new [Re: R. Belmont]
#245673 - 02/04/11 07:58 AM


> > Well, above, you said "286 vertical scanlines". And I'm saying this because it
> seems,
> > even after all these years, that most people think that the first number =
> horizontal
> > lines drawn.
>
> Yes, and that is correct. The total vertical resolution is 286 lines (including
> vblank). I sense I've hit some kind of obscure bugaboo of yours, but my terminology
> is correct.

Resolution is pixels - in this case, along the vertical number line, 286 vertical pixels. Lines drawn from those pixels (or trace points) are perpendicular to the axis, so there are 286 horizontal lines.



Consider it high comedy....sincere tragedy....whatever...don't take it personally.

The Culture



Pages: 1

MAMEWorld >> EmuChat
View all threads Index   Threaded Mode Threaded  

Extra information Permissions
Moderator:  Robbbert, Tafoid 
0 registered and 26 anonymous users are browsing this forum.
You cannot start new topics
You cannot reply to topics
HTML is enabled
UBBCode is enabled
Thread views: 2493