MAMEWorld >> EmuChat
Previous thread Previous  View all threads Index   Next thread Next   Threaded Mode Threaded  

Pages: 1

Naoki
Reged: 11/10/09
Posts: 1998
Loc: United Kingdom
Send PM


MAME's Output
#270739 - 12/11/11 11:03 PM


Using MAME Hooker, I've been going through various output-supporting games. One thing which I can never seem to understand is how LED segment displays work in MAME. Are they binary translated into decimal?



----
On a quest for Digital 573 and Dancing Stage EuroMix 2

By gods I've found it!



Naoki
Reged: 11/10/09
Posts: 1998
Loc: United Kingdom
Send PM


Re: MAME's Output new [Re: Naoki]
#270741 - 12/11/11 11:20 PM


Ok, doing a little work on it, I'm assuming my theory was the case. Mainly because:

On the NeoGeo BIOS, I had a number on screen showing "1 22 88". The MAME Hoker output showed 6, 91, 91, 127, 127. I quickly realized this was 7 bit binary and decoded the numbers into:
0000110
1011011
1011011
1111111
1111111

To figure out what this meant in terms of what the display segment showed, I took a guess and assumed it went in a spiral pattern towards the center, so:

Code:


1
__________
| |
32 | | 2
|___64___|
| |
16 | | 4
----------
8




Using this method I acheived the same display on paper which the NG bios showed.

So, my findings are correct right?



----
On a quest for Digital 573 and Dancing Stage EuroMix 2

By gods I've found it!



krick
Get Fuzzy
Reged: 02/09/04
Posts: 4235
Send PM


Re: MAME's Output new [Re: Naoki]
#270742 - 12/12/11 12:08 AM


Looking at the source for rendlay.c, you definitely have the order correct. The representation is an 8-bit bitmap where a one indicates an "on" segment. The first seven bits represent the segments you've identified, while the eighth bit is used for a decimal point segment.


Code:

//-------------------------------------------------
// draw_led7seg - draw a 7-segment LCD
//-------------------------------------------------

void layout_element::component::draw_led7seg(bitmap_t &dest, const rectangle &bounds, int pattern)
{
const rgb_t onpen = MAKE_ARGB(0xff,0xff,0xff,0xff);
const rgb_t offpen = MAKE_ARGB(0xff,0x20,0x20,0x20);

// sizes for computation
int bmwidth = 250;
int bmheight = 400;
int segwidth = 40;
int skewwidth = 40;

// allocate a temporary bitmap for drawing
bitmap_t *tempbitmap = global_alloc(bitmap_t(bmwidth + skewwidth, bmheight, BITMAP_FORMAT_ARGB32));
bitmap_fill(tempbitmap, NULL, MAKE_ARGB(0xff,0x00,0x00,0x00));

// top bar
draw_segment_horizontal(*tempbitmap, 0 + 2*segwidth/3, bmwidth - 2*segwidth/3, 0 + segwidth/2, segwidth, (pattern & (1 << 0)) ? onpen : offpen);

// top-right bar
draw_segment_vertical(*tempbitmap, 0 + 2*segwidth/3, bmheight/2 - segwidth/3, bmwidth - segwidth/2, segwidth, (pattern & (1 << 1)) ? onpen : offpen);

// bottom-right bar
draw_segment_vertical(*tempbitmap, bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, bmwidth - segwidth/2, segwidth, (pattern & (1 << 2)) ? onpen : offpen);

// bottom bar
draw_segment_horizontal(*tempbitmap, 0 + 2*segwidth/3, bmwidth - 2*segwidth/3, bmheight - segwidth/2, segwidth, (pattern & (1 << 3)) ? onpen : offpen);

// bottom-left bar
draw_segment_vertical(*tempbitmap, bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, 0 + segwidth/2, segwidth, (pattern & (1 << 4)) ? onpen : offpen);

// top-left bar
draw_segment_vertical(*tempbitmap, 0 + 2*segwidth/3, bmheight/2 - segwidth/3, 0 + segwidth/2, segwidth, (pattern & (1 << 5)) ? onpen : offpen);

// middle bar
draw_segment_horizontal(*tempbitmap, 0 + 2*segwidth/3, bmwidth - 2*segwidth/3, bmheight/2, segwidth, (pattern & (1 << 6)) ? onpen : offpen);

// apply skew
apply_skew(*tempbitmap, 40);

// decimal point
draw_segment_decimal(*tempbitmap, bmwidth + segwidth/2, bmheight - segwidth/2, segwidth, (pattern & (1 << 7)) ? onpen : offpen);

// resample to the target size
render_resample_argb_bitmap_hq(dest.base, dest.rowpixels, dest.width, dest.height, tempbitmap, NULL, &m_color);

global_free(tempbitmap);
}




GroovyMAME support forum on BYOAC



Naoki
Reged: 11/10/09
Posts: 1998
Loc: United Kingdom
Send PM


Re: MAME's Output new [Re: krick]
#270743 - 12/12/11 12:30 AM Attachment: 16-Seg].png 7 KB (0 downloads)


So, with Beatmania IIDX which uses 16-Seg displays, I'm assuming the process is similar, but not sure on order, but my guess would be:

[ATTACHED IMAGE]

Attachment



----
On a quest for Digital 573 and Dancing Stage EuroMix 2

By gods I've found it!



Naoki
Reged: 11/10/09
Posts: 1998
Loc: United Kingdom
Send PM


Re: MAME's Output new [Re: Naoki]
#270745 - 12/12/11 01:07 AM


I think I could be wrong with my suggestion since testing it on Beatmania IIDX returns:

Code:


-----
| |
| |
|/ |
-----



When powered, but with testing it changes to:

Code:


-----
| |
| |
| |
-----




----
On a quest for Digital 573 and Dancing Stage EuroMix 2

By gods I've found it!



krick
Get Fuzzy
Reged: 02/09/04
Posts: 4235
Send PM


Re: MAME's Output new [Re: Naoki]
#270749 - 12/12/11 02:04 AM


Take a look at the source for rendlay.c because there are two 16-segment LED functions, as well as two 14-segment LED functions...

http://mamedev.org/source/src/emu/rendlay.c.html



GroovyMAME support forum on BYOAC



Naoki
Reged: 11/10/09
Posts: 1998
Loc: United Kingdom
Send PM


Re: MAME's Output new [Re: krick]
#270750 - 12/12/11 02:10 AM Attachment: 16-Seg2.png 6 KB (1 downloads)


It's alright now. I went through the pain stakingly long manual process of elimination but I finally have usable info. The inner process is just double on the opposite side

EDIT: Actually I think 8192 and 16384 are in the wrong places, but just swap the numbers in each other's place and it's right.

[ATTACHED IMAGE]

Attachment

Edited by Naoki (12/12/11 02:20 AM)



----
On a quest for Digital 573 and Dancing Stage EuroMix 2

By gods I've found it!



RetroRepair
MAME Fan
Reged: 12/21/09
Posts: 259
Send PM


Re: MAME's Output new [Re: Naoki]
#271008 - 12/15/11 04:36 PM


I think this thread has potential, I'd be interested to see other outputs explained.

I'd also be interested to see more outputs hooked up.



http://www.youtube.com/retrorepair


Pages: 1

MAMEWorld >> EmuChat
Previous thread Previous  View all threads Index   Next thread Next   Threaded Mode Threaded  

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