Theme Park revisited

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
anomie
Lurker
Posts: 151
Joined: Tue Dec 07, 2004 1:40 am

Theme Park revisited

Post by anomie »

A little while back, someone pointed out to me that Theme Park still wasn't quire right. So i look, and sure enough the alignment isn't quote right between BG1 and the other BGs and OBJ. Recall that Theme Park writes $ff then $03 to $2110, then writes $00 to $210d exactly once and yet expects BG1HOFS to have the value $0000, not $0003. Previous investigation had discovered that changing the ROM to write $83 to $2110 would make the real SNES have BG1HOFS=$0080, at the time mistakenly interpreted as $0083.

Further investigation reveals that the value jumps by 8s: any of $80-$87 leads to BG1HOFS being $0080, while $88 suddenly jumps to $0088. A little more testing reveals that the real formula for BGnxOFS registers is:

Code: Select all

Current = (Byte<<8) | (Prev&~7) | ((Current>>8)&7);
with Prev shared among all 8 registers.

OTOH, the M7* registers still seem to use the old formula:

Code: Select all

Current = (Byte<<8) | M7Prev;
with M7Prev again shared. OTOH, we still don't know the exact details of the Mode 7 calculations, particularly the observed offset quantization under extreme magnification, a few details of offsets ourside the standard -1024 to 1023 range, and the bit-accuracy of the scaling formulas...
Lord Nightmare
Rookie
Posts: 14
Joined: Fri Nov 26, 2004 7:50 pm
Location: PA, USA
Contact:

Post by Lord Nightmare »

anomie: US. Patent 5,327,158
Has to do with mode 7 calculations and stuff...
It scares the hell out of me...

Lord Nightmare
"When life gives you zombies... *CHA-CHIK* ...you make zombie-ade!"
byuu

Post by byuu »

Well, luckily (if you will), it says at the bottom that this was just a reference design, and that the final implementation could be (and probably is) different.
Current = (Byte<<8) | (Prev&~7) | ((Current>>8)&7);
Ugh ... have to change those things again ...
Nice find.
anomie
Lurker
Posts: 151
Joined: Tue Dec 07, 2004 1:40 am

Post by anomie »

Lord Nightmare wrote:anomie: US. Patent 5,327,158
Has to do with mode 7 calculations and stuff...
It scares the hell out of me...
Even if the patent has detailed enough technical details, the interesting corner cases are still probably different...
Post Reply