$2131 bit 6: Color Halve

Strictly for discussing ZSNES development and for submitting code. You can also join us on IRC at irc.libera.chat in #zsnes.
Please, no requests here.

Moderator: ZSNES Mods

Post Reply
byuu

$2131 bit 6: Color Halve

Post by byuu »

I recently did some tests to determine if the color-halve from bit 6 of $2131 occurs before or after the color add/sub. The results of my tests were that it occurs afterwards. I also determined that ZSNES does the color-halve before, which results in an off-by-one color luminance when both the source and dest colors being added/subtracted have the lowest bit set.
This isn't really important, and isn't all that noticeable, but since we have the information available, I thought someone may wish to implement this into ZSNES.

To go into details about my test:
The results are here.

My test went under the following discrepancy between when the color data is halved:

Code: Select all

color 0 = {
  (15 >> 1) + (0 >> 1) = 7 + 0 =  7 -- before
  15 + 0 = (15 >> 1)           =  7 -- after
}

color 1 = {
  (15 >> 1) + (1 >> 1) = 7 + 0 =  7 -- before
  15 + 1 = (16 >> 1)           =  8 -- after
}


Therefore, by splitting the screen in half vertically, and drawing the top half with the palette color being blue:15, and the add/sub color being blue:0, and the bottom half being palette color blue:15, and the add/sub color being blue:1, I should be able to tell when the color halve occurs.

If the color was halved before color add/sub, then the result color for both the top and bottom halves of the screen would be the same: blue:7. If the color was halved after the color add/sub, then the top half would be blue:7, and the bottom half blue:8.

After creating the test ROM and loading it on my copier, I have confirmed it is the latter: color-halve occurs *after* color add/sub.

On a real SNES, there are two unique colors on the screen. In ZSNES, there is only one, confirming that ZSNES does the color-halve before adding/subtracting the pixel data.

---

Please let me know if there is a more appropriate place I should send things like this in the future (-- or if I shouldn't submit such findings at all).
Nach
ZSNES Developer
ZSNES Developer
Posts: 3904
Joined: Tue Jul 27, 2004 10:54 pm
Location: Solar powered park bench
Contact:

Post by Nach »

Continue posting stuff here, perhaps someone on the ZSNES team who is capable of implementing this stuff will.
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
DataPath
Lurker
Posts: 128
Joined: Wed Jul 28, 2004 1:35 am
Contact:

Post by DataPath »

Agreed. I really think all the work that Byuusan is doing is great.
FistOfFury
Hazed
Posts: 84
Joined: Wed Aug 25, 2004 1:25 pm

Post by FistOfFury »

How did you figure that stuff out? Wow, you should stick around and post more of your genius, it will help out alot
illegal eagle
Savestate Pimp
Posts: 129
Joined: Thu Jul 29, 2004 2:15 pm
Contact:

Post by illegal eagle »

FistOfFury wrote:How did you figure that stuff out?
With lots of SNES & SNES ASM knowledge, a copier and a SNES. :wink:
"Other people can give you more suggestions as I just lost all my motivation to respond further to this post."
[i] - Nightcrawler[/i]

[url=http://www.geocities.com/illegal_eagle_2003/]vSNES v2.00[/url]: My SNES savestate viewer.
byuu

Post by byuu »

Complementing me for ten minutes' work is an insult in comparison to the thousands of hours of real work done by all of the various emulation authors that stop by here. TRAC, _demo_, anomie, Overload, Nach, etc. are the real geniuses.
I hope that doesn't sound rude, I just feel bad to be the one taking praise while so many others are doing far more complex work at the same time.

Nonetheless, I thank you for the kind words. I've been programming for the SNES since '97, so I came into the field with plenty of knowledge of the SNES hardware. The aforementioned people are helping me along greatly as well.
The copier helps a lot, too.
FistOfFury
Hazed
Posts: 84
Joined: Wed Aug 25, 2004 1:25 pm

Post by FistOfFury »

No one is overlooking the good work that the guys you mentioned did. I'm just saying, no matter how long it took, it's just a compliment
byuu

Post by byuu »

Yeah... sorry, I'm not used to getting compliments, so I'm really not sure how to respond. I come from the translation scene, after all ;)
Thanks again :D
Dmog
Lurker
Posts: 192
Joined: Tue Aug 31, 2004 6:03 pm

Post by Dmog »

Yeah, byuusan you may not consider yourself an Snes omniscient but you seem to know your stuff, and the work you've done is great.

Also, it's nice to see some research done on the Snes itself, instead on the various cart chips.
pagefault
ZSNES Developer
ZSNES Developer
Posts: 812
Joined: Tue Aug 17, 2004 5:24 am
Location: In your garden

Post by pagefault »

Thanks I will make the necessary changes in ZSNES.
kieran_
Mugwump
Posts: 824
Joined: Fri Jul 30, 2004 9:05 pm

Post by kieran_ »

I would also like to add my compliments. keep up the good work.
byuu

Post by byuu »

pagefault wrote:Thanks I will make the necessary changes in ZSNES.
Awesome! Thank you, pagefault. Sorry to bug you on such a minor detail.

By the way, I have a few other things I've noticed. Most of which probably aren't feasible to implement and aren't really used in many games. Would you like me to PM this info to you?
kieran_
Mugwump
Posts: 824
Joined: Fri Jul 30, 2004 9:05 pm

Post by kieran_ »

byuusan wrote:
pagefault wrote:Thanks I will make the necessary changes in ZSNES.
Awesome! Thank you, pagefault. Sorry to bug you on such a minor detail.

By the way, I have a few other things I've noticed. Most of which probably aren't feasible to implement and aren't really used in many games. Would you like me to PM this info to you?
Sorry to step in like this, but it might be better to post it here in the developement forum. Then, many people can comment on your ideas.
Post Reply