Commit Graph

37 Commits

Author SHA1 Message Date
nmlgc 042b7802bf [Reverse-engineering] [th04/th05] Resident structure
And yes, you can get it in your own tool by simply #including
th04/th04.hpp or th05/th05.hpp.

Completes P0065, funded by Touhou Patch Center.
2020-01-03 21:43:43 +01:00
nmlgc 8b01c60f44 [Maintenance] Move PC-98 hardware constants to a separate include file
SPRITE16 would also like to refer to those later.

Part of P0061, funded by Touhou Patch Center.
2019-12-05 21:38:39 +01:00
nmlgc 619203a1c9 [Position independence] [th02/th03/th04/th05] Color palettes
Part of P0060, funded by Touhou Patch Center.
2019-11-28 23:23:29 +01:00
nmlgc 7887f53ea8 [Maintenance] Move the playfield constants to a separate .inc file
With both 16- and 32-bit build parts soon having full dependency
tracking, having more small includes wins out over having fewer, larger
ones – and also, over having to fix tons of macro conflicts that stem
from most .inc files assuming the context of the big .asm files.

Case in point, including ReC98.inc doesn't work right now without
defining a .MODEL, which is counter-productive for ASM compilation
units.

Part of P0035, funded by zorg.
2019-09-24 22:00:48 +02:00
nmlgc 290935fe3e [Reverse-engineering] [th04/th05] Player character display
Including options and the death explosions.

Part of P0035, funded by zorg.
2019-09-24 21:58:09 +02:00
nmlgc 68c9a3c79c [Reverse-engineering] [th02/th04/th05] Single-plane sprite display calls
Require understanding a hardware detail, so let's do them all at once.

Part of P0035, funded by zorg.
2019-09-24 21:58:03 +02:00
nmlgc fac879f8e6 [Reverse-engineering] [th05] Number display using the bold gaiji font
Many thanks to http://bytepointer.com/tasm/index.htm for providing a
better searchable resource for TASM's default `LEA imm16` → `MOV imm16`
optimization, which we initially had to hack around here.

Funded by -Tom-.
2019-03-06 19:32:38 +01:00
nmlgc c241af414f [Reverse-engineering] Current difficulty
Funded by -Tom-.
2019-03-01 23:07:42 +01:00
nmlgc c00b87ed4f [Reverse-engineering] [th04/th05] Redrawing dirty stage background tiles
Funded by -Tom-.
2018-12-30 00:16:16 +01:00
nmlgc 20d05c1653 [Reverse-engineering] [th04/th05] Rendering all stage background tiles at once
Funded by -Tom-.
2018-12-29 18:34:51 +01:00
nmlgc e1e4f819ed [Reverse-engineering] [th02/th04/th05] Stage background tile ring buffer
Funded by -Tom-.
2018-12-29 17:03:24 +01:00
nmlgc bc3c85f09a [Reverse-engineering] [th04/th05] GRCG/EGC-powered VRAM writes
Funded by zorg.
2018-12-25 23:45:24 +01:00
nmlgc 41622254a8 [Reverse-engineering] EGC register writes
Funded by zorg.
2018-12-25 23:45:24 +01:00
nmlgc fa39c23fad [Reverse-engineering] [th03] CDG loading 2018-10-16 00:47:58 +02:00
nmlgc c592464121 [Reverse-engineering] [th03/th04/th05] Basic keyboard input functions
Funded by zorg.
2018-09-11 19:34:19 +02:00
nmlgc 145ecaaa54 Rename all code segments to names that Turbo C++ would generate
Well, duh, of course, we *can* do this in order to allow decompilation to be
started at the end (not the beginning) of any segment. In fact, if we hadn't
done this, we would have had to start by moving _TEXT out to libraries....
2015-02-21 12:47:24 +01:00
nmlgc c2a8c221f2 Let Turbo C++ link in the Borland C/C++ runtime for the main EXE files
This took long enough, so we're not covering the COM files right now. Like, I
can't even tell how you're supposed to work around the forced word alignment
for the _TEXT segment. Guess we'll just have to decompile all of these in one
go, just like we did with ZUNSOFT.COM.

Also, it really seems as if we're merely trading one ugly workaround for
another in our quest for identical binaries.
2015-02-19 10:22:00 +01:00
nmlgc 2d5d38426f Finally use standard segment names everywhere
And I guess we just have to ignore and disable that segment alignment warning
for TH01. It's not like this changes anything in the binary.
2015-02-18 14:04:43 +01:00
nmlgc f0ab47fd18 [Reduction] Hardware text colors and effects
Turns out we're not quite done with reduction yet, as there still are a bunch
of macros in master.h that #define PC-98-specific hardware constants and I/O
ports.
2014-12-20 22:36:38 +01:00
nmlgc 181d2920af [Reverse-engineering] Symbols for PMD and MMD API calls 2014-11-27 19:35:54 +01:00
nmlgc f54b85577d [Reverse-engineering] Slot-based PI file loading and freeing 2014-11-18 17:56:13 +01:00
nmlgc 225d8f2a28 Identify all function pointers referenced from code
> introduce a new macro to halve the lines of a far function pointer
  assignment, hoping that this commit will end up deleting more lines than it
  adds, because TH03 has lots of those
> oh wait, these games mainly use near function pointers
> unearth even more new functions in the process

Seriously, how many more functions are still hidden in this codebase? And all
that just because IDA was not smart enough to begin with.
2014-11-14 01:57:40 +01:00
nmlgc 84180b9cd9 [Reduction] #685: ldtrunc 2014-11-09 14:49:18 +01:00
nmlgc 015ceec3e1 [Reduction] #569: xcvt
... and even with EMUL being set up and working, TASM still needs to be hacked
into actually emitting emulator calls for certain instructions.
2014-11-02 06:55:48 +01:00
nmlgc 4ac17ac2a5 Trick TASM into not creating 32-bit default segments
So that's the - admittedly rather weird - solution to the problem that has
been plaguing this project ever since the beginning of the reduction step.
Without any 32-bit dummy segments in the compiled object files, more linkers
will be able to build this project, one of them being JWlink
(http://sourceforge.net/projects/jwlink/).

Still can't rename dseg to _DATA though, as TASM stupidly refuses to accept
any ALIGN directives above a segment's alignment attribute value. TH01's
floating-point data slices already require larger alignments, and we're very
likely to have even more of those in the future.

Also, we're finally defining the Borland C++ model symbols directly in the
code, rather than in my unpublished build batch files. :)
2014-10-31 08:17:54 +01:00
nmlgc 48088875ca [Reduction] #561-562: scantol
Also finally getting a macro for the recurring "pop cx if LDATA" case.
2014-10-30 09:38:46 +01:00
nmlgc c4aee8a236 [Reduction] #556-558: open 2014-10-27 02:50:32 +01:00
nmlgc 16b4e1d240 [Reduction] #540: close
Now with DOS error codes.
2014-10-15 08:39:22 +02:00
nmlgc 3457818399 [Reduction] #533-536: fopen
More flags and constants, despite reminding me why exactly I haven't done this
all along.
2014-10-13 06:12:09 +02:00
nmlgc afdd1c06e0 [Reduction] #532: fmode
Yup, finally adding the opening flags as well.
2014-10-11 23:56:44 +02:00
nmlgc b4794ec1d9 [Reduction] #240: cutline 2014-08-28 05:14:54 +02:00
nmlgc 40de176f2c [Reduction] #191: bcloser 2014-08-26 20:54:57 +02:00
nmlgc b7aa7291db [Reduction] #182: bgm_read_sdata
[Binary change] Order of 2 relocations in all modified executables.
2014-08-26 06:07:19 +02:00
nmlgc 674ecce1c3 [Reduction] #171: _bgm_bell_org
[Binary change] db 0 → nop before the function in every affected executable.
2014-08-25 04:49:19 +02:00
nmlgc 193ca02550 [Reduction] #130: ___write
Doing one of these C monstrosities a day seems like a good habit. And hey,
ZUNSOFT.COM has already shrunk by over a third.
2014-08-22 19:28:05 +02:00
nmlgc fbb78b9dd0 Replace the compatibility NOPs with a macro 2014-08-22 18:03:40 +02:00
nmlgc 4e9ad18af1 Move common directives and includes to a separate include file
Note that .386 needs to come before .MODEL, and is therefore not included in
ReC98.inc. Causes, um, weird label errors otherwise.
2014-08-22 18:01:06 +02:00