User avatar
d3m1ck
Posts: 2
Joined: Tue May 07, 2019 4:48 am

last Neo Geo Hardware Palette post

Okay, I have done a boo boo here with my last post, but now I think this will clear things up a bit.

Btw, if this is tl;dr for some, too bad. :P

I am an aspiring developer, and so chose the Neo Geo as one of my platforms to do programs on. As such, I have desired an accurate representation of the Neo Geo's palette to be able to use the anomalies of it to my advantage and to accurately see the results without having to go into the hardware itself.

Due to this, I have been trying to find the "sweet spot" for the Neo-Geo's color DA Converter for some time now because hardware looks different from even the best emulation these days (that award goes to MAME btw).

I discovered the above due to a post I saw about some guy writing a palette editor for the Neo-Geo's CD system in a development forum a while back. One of the users had screenshots of his TV and a palette gradient he programmed on his Neo Geo machine. The taper seemed even on his screen, but since I went ahead and did some heavy maths lifting I know now this is not the case. It seems to taper from the max value to the middle, then skips to a quarter down and skips again (see attachment pic).

I know that the DA converter has not changed through ANY iterations of the hardware, CD system included. Yep, identical give or take a negligible hair off some resistor values, since resistors do degrade well over time naturally.

Segue aside, I remember the Neo-Geo CD version of Sengoku's High Score screen having some weird level clashing in it's background gradients, somewhere in the middle of the taper to it's target brightness not shown on even MAME. I confirmed this on my MV1C.

Because of this, my quest has been to determine if I can indeed replicate that effect by doing some good old fashioned electrical circuit maths and even contributing to MAME's ongoing development along the way.

So, here we go...

Anybody who has any knowledge of resistors know exactly what they're used for: truncating current in a line of electricity flow. The higher the resistor's Ohm value, the more current get's truncated. Infinite resistance denotes a cut in a line, or an open circuit. An Ohm value of 1 denotes virtually no resistance, or a closed circuit.

Pertinent Ohm's Law formulae to use:

Power = Voltage * Current (W=VA)

also-

Voltage = Current * Resistance (V=Ao)

and-

Power = Voltage^2 / Resistance (W=(VV)/o)

where:
o = Ohms
V = Voltage
A = Amps
W = Watts

I have determined that everything is serial to SHAD in arrangement, after countless hours of gruelling trial and error. Also, DAK is parallel to each of the channels, which in turn are parallel to each other, resulting in my formula here.

My formula:

W = (VV) / (1/((1/(RED_R + SHAD)) + (1/(GREEN_R + SHAD)) + (1/(BLUE_R + SHAD)) + (1/DAK_R)))

I have read the schematics and know both DAK and SHAD go through inverters, so ON is OFF and vice versa.

Each resistor in serial is treated as additive and so is 1 when not in use. This will give you the high impedance versions of the palette, but won't give you an accurate representation, so this formula is a way to get the Wattages from their resistor counterparts.

For the Wattage ceilings, I just added the Wattages that coincided with the resistor values that they are related to i. e. .200534 -> 220, .031861 -> 2200, etc. These are denoted with a dash.

Complete compendium of Wattages:

SHAD ON, DAK OFF:

.434160W
.200534W -
.120192W -
.088968W
.064991W -
.054625W
.046211W
.040717W
.031861W -
.029149W
.026567W
.022368W
.020997W
.018560W
.018500W
.017552W
.016582W -
.015816W
.014843W
.014226W
.013582W
.013064W
.011994W
.011588W
.011157W
.010805W
.010342W
.010039W
.009714W
.009446W

SHAD ON, DAK ON:

.432739W
.198939W -
.119617W -
.088652W
.064823W -
.054506W
.046125W
.040650W
.031820W -
.029115W
.026539W
.024655W
.022348W
.020979W
.018546W
.018486W
.017540W -
.016571W
.015806W
.014834W
.014218W
.013575W
.013057W
.011988W
.011583W
.011152W
.010801W
.010338W
.010035W
.009710W
.009442W -

SHAD OFF, DAK OFF:

.619075W
.333333W -
.157895W -
.108069W
.074627W -
.061274W
.050882W
.044300W
.034014W -
.030940W
.028048W
.024630W
.025925W
.023408W
.021911W
.019270W
.019206W -
.018186W
.017147W
.016329W
.015294W
.014640W
.013959W
.013412W
.012287W
.011861W
.011410W
.011042W
.010559W
.010243W
.009905W
.009626W

SHAD OFF, DAK ON:

.612395W
.328947W -
.156903W -
.107604W
.074405W -
.061125W
.050779W
.044222W
.033967W -
.030902W
.028016W
.025898W
.023386W
.021891W
.019255W
.019191W
.018173W -
.017135W
.016318W
.015284W
.014631W
.013951W
.013405W
.012281W
.011856W
.011405W
.011037W
.010554W
.010239W
.009901W
.009623W

So, yeah... Try doing that all by hand like I just did. It blows... These are just the GRAY LEVELS! Yet, a good reference point it be. The dashed ones are the ones I am after here - the rest was just curiosity. Maybe the high impedance levels? Who cares at this point. I just need accurate gray levels for emulators, not re-engineer a whole machine.

Now, percentages need to be generated, and to do that, one must go through all the denoted Wattages and divide by the highest ceiling. After that, apply those same percentages to the number 256 to get the gray value.

My percentages and their 8-bit counterparts:

SHAD ON, DAK OFF:

70.13% 180/256

32.39% 83/256
19.41% 50/256
10.50% 27/256
05.15% 13/256
02.68% 7/256

SHAD ON, DAK ON:

69.90% 179/256

32.13% 82/256
19.32% 49/256
10.47% 27/256
05.14% 13/256
02.83% 7/256

SHAD OFF, DAK OFF:

100% 256/256

53.84% 138/256
25.50% 65/256
12.05% 31/256
05.49% 14/256
03.10% 8/256

SHAD OFF, DAK ON:

98.92% 253/256

53.14% 136/256
25.34% 64/256
12.02% 30/256
05.49% 14/256
02.94% 7/256

Because of this, if Sengoku Denshou applied SHAD to the High Score screen, all this would make sense. The Neo Geo levels without SHAD behave similarly to the SNES' levels, but dip down in the middle and do slight oddities with SHAD applied to the same. Now I understand why MAME assumed SHAD was just a cut in percentage and why it looks different in MAME and other emulations than on real hardware. My attachment reflects just that - those anomalies in the SHAD area and the Normal behaviour of the levels.

I hope this helps the emulator authors out there including the MAME team.
Attachments
Neo Geo HW Levels.png
Neo Geo HW Levels.png (499 Bytes) Viewed 2743 times

Return to “MAME Discussion”