Commit Graph

3 Commits

Author SHA1 Message Date
nmlgc b6e0330ff6 [Decompilation] [th03] Sprite display calls
Yes, decompilation, of something that was so obviously originally
written in ASM. We're still left with two un-decompilable instructions
here, but I'm amazed at how nicely I was able to abstract away all of
the gory register details, leading to pretty clear, readable, and dare
I say *portable* code?! Turbo C++ was once again pretty helpful here:

• `static_cast<char>(_BX) = _AL` actually compiles into `MOV BL, AL`,
  as you would have intended,
• and no-op assignments like _DI = _DI are optimized away, allowing
  us to leave them in for clarity, so that we can have all parameter
  assignments for the SPRITE16 display call in a single place.

I love this compiler.

Part of P0060, funded by Touhou Patch Center.
2019-11-28 23:14:21 +01:00
nmlgc 6c4852f789 [Position independence] False positives in master.lib GRCG function calls
Yup, function parameters that can clearly be identified as coordinates
are by far the fastest way to raise the calculated position
independence percentage. Kinda makes it sound like useless work, which
I'm only doing because it's dictated by some counting algorithm on a
website, but decompilation will want to un-hex all of these values
anyway. We're merely doing that right now, across all games.

Part of P0058, funded by -Tom-.
2019-11-14 00:51:48 +01:00
nmlgc c09446a1f4 [Reverse-engineering] [th03] SPRITE16 calls
Aha! TH03's in-game graphics run in line-doubled 640×200 simply because
that's what this SPRITE16.COM version was written for, making use of
the PC-98 EGC for optimized blitting.

Doesn't seem all *too* optimized though, given that it chooses to
effectively draw every sprite twice, just in case it might overlap with
something that's already in VRAM. It first clears the previous VRAM
content at the drawing position according to the sprite's alpha mask,
then ORs in the actual sprite data. The EGC can do monochrome alpha-
tested blitting just as well as the GRCG, but once the sprite data
covers all bitplanes, ORing is apparently the best it can do by itself?
More technical details on the raster operations in the next push!

Completes P0056, funded by rosenrose and [Anonymous].
2019-11-06 23:36:47 +01:00