Commit Graph

415 Commits

Author SHA1 Message Date
nmlgc 877804c739 [JWasm move] Prefixes must be on the same line as the modified instruction 2014-11-19 07:31:59 +01:00
nmlgc e551d590bd [JWasm move] Fix the interrupt vector declarations in c0[data].asm
The leniency! It hurts!
2014-11-19 07:26:12 +01:00
nmlgc af1ce6cad8 [JWasm move] Specify struct names where necessary
It may look redundant and it surely bloats the code, but well, registers don't
have types, so it really *is* good coding style to do this everywhere.
2014-11-19 07:15:10 +01:00
nmlgc f54b85577d [Reverse-engineering] Slot-based PI file loading and freeing 2014-11-18 17:56:13 +01:00
nmlgc b4361e8487 [Reduction] #700-704: pfopen
... and then I end up copying modified versions into the individual game
subdirectories after all, because the changes between games were simply too
drastic. (That's also why I'm counting pfopen() itself twice.)

Only one slice left now, and then we're done with reduction!
2014-11-17 04:54:40 +01:00
nmlgc 62d4593842 [Reduction] #697-699: Packfile interrupt hooking 2014-11-16 04:08:46 +01:00
nmlgc f303222ffc Replace MASTERMOD with a per-game constant
Yup, packfiles finally proved that we really have a different set of changes
to master.lib in every game. Also, there are bound to be more of these game-
specific small changes to otherwise identical code in ZUN's own code.

And hey, no need to define that value in the build scripts anymore.

(I've also considered just copying modified versions into the individual game
subdirectories, but it's not too nice to expect people to diff them in order
to actually understand why these copies exist and where the changes actually
are.)
2014-11-15 02:03:41 +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 8cecebff81 Analyze any remaining byte blobs in code segments
... excluding those in packfile functions and the floating-point hacks, both
of which will follow in the next few days.
2014-11-12 23:11:16 +01:00
nmlgc af5419e350 Fix the directory of the fperror() slices
(Damn, the other commit prepared for today is not getting done, why does IDA
have to be so terrible...!)

Anyway, here's a small consistency edit instead.
2014-11-11 23:42:56 +01:00
nmlgc 87a682dd4f [Reduction] #695-696: User entry points for read() and write()
That's it, segment 0 cleared out in all executables of TH01! Only missing that
last floating-point slice now...
2014-11-10 22:20:59 +01:00
nmlgc 7705bea1f9 [Reduction] #694: scanf 2014-11-10 21:42:09 +01:00
nmlgc 4c30e5e974 [Reduction] #693: scanner 2014-11-10 21:04:32 +01:00
nmlgc 8386db1cb9 [Reduction] #692: coreleft 2014-11-10 19:58:08 +01:00
nmlgc 6ab63bc2ab [Reduction] #691: farcoreleft 2014-11-10 19:19:33 +01:00
nmlgc dfc9361b33 [Reduction] #690: farcalloc 2014-11-10 19:11:34 +01:00
nmlgc 1681595338 [Reduction] #689: Long pointer+scalar addition
This file has been lying around there for almost three months now, because I
initially couldn't describe its functionality...
2014-11-10 19:10:46 +01:00
nmlgc f7cb71193b [Reduction] #686-688: scantod 2014-11-10 01:02:11 +01:00
nmlgc 84180b9cd9 [Reduction] #685: ldtrunc 2014-11-09 14:49:18 +01:00
nmlgc 03139534f7 [Reduction] #684: control87 2014-11-09 13:18:19 +01:00
nmlgc 13b10ef589 [Reduction] #683: access (the one that *actually* has no underscore) 2014-11-09 11:58:33 +01:00
nmlgc 986590f321 [Reduction] #682: ftol
And surprisingly, TH01's OP.EXE ends up as the first game executable that has
its seg000 cleared out.
2014-11-09 01:11:04 +01:00
nmlgc 97221c8bb5 Forgot text_fillca() in TH01's REIIDEN.EXE 2014-11-08 12:46:33 +01:00
nmlgc 408fe19952 [Reduction] #681: ungetc 2014-11-08 11:45:33 +01:00
nmlgc cab8db3ce2 [JWasm move] "addr" is a reserved word 2014-11-07 12:38:54 +01:00
nmlgc 52209cbcdf [JWasm move] Add symbol names to the ENDP and ENDS directives where necessary 2014-11-06 06:45:35 +01:00
nmlgc 4dc9b9ab4a [JWasm move] Don't use the DIST/CALLMODEL constants for procedures and labels
Once you've actually found the right syntax that makes the assembler just use
the default call type of the current memory model for both procedures (where
it's just "PROC" without anything else) and labels (where it's "LABEL PROC"),
these constants become completely unneccessary, even with TASM.
2014-11-05 18:20:02 +01:00
nmlgc 00bacc7af3 [Reduction] #673-680: BERO's Pi loader library
> randomly google "PC-98 ライブラリ"
> 3rd hit: http://www.vector.co.jp/soft/dos/prog/se037608.html
> Oh look, it's the mystery code at the beginning of the TH01 executables!

This library also has dedicated support for transparency, which is used in the
Konngara fight (BOSS8_D*.GRP) and which we couldn't edit during the
development of the static English patches.
But of course, ZUN just had to change the format magic in order to make it
seem unique.
2014-11-04 18:42:43 +01:00
nmlgc 66e293fe4d Forgot puts() in TH01's FUUIN.EXE
-_-
2014-11-03 06:59:02 +01:00
nmlgc 0b34460155 [Reduction] #670-672: e087_Trap
I guess this marks the final demystification of how segment declarations work
and how they are compiled. However, it only really makes sense for anything
outside the TEXT segment, like these floating-point functions. As long as the
slices aren't immediately next to each other, it would still be annoying to
have segment declarations inside of them, since we'd have to copy-paste these
declarations around every INCLUDE directive...
2014-11-02 20:11:20 +01:00
nmlgc 3a1c2fd679 Move the stack segment into its own slice
Saves 141 lines, and we'll need to ASSUME it in the upcoming floating-point
slices.
2014-11-02 19:44:02 +01:00
nmlgc a777ad2ad1 [Reduction] #668-669: pow10 2014-11-02 16:41:47 +01:00
nmlgc 0856fab827 [Reduction] #576-667: emu086.asm 2014-11-02 11:20:05 +01:00
nmlgc 7790ecdb7c [Reduction] #574-575: vprinter
And that would be the final function of the printf() family!
2014-11-02 09:01:46 +01:00
nmlgc 6d422052ca [Reduction] #570-573: realcvt 2014-11-02 08:27:17 +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 bbd8ff96ab [Reduction] #563-568: Floating-point emulator initialization
Finally - and there was indeed no way around switching to JWlink, as ALINK
v1.6 refuses to link the TH01 executables with a nondescript "Undefined base
seg" message once nec_fpinit.asm is included.
2014-11-01 17:09:13 +01:00
nmlgc ae6c844b25 Ensure the correct amount of padding between the TEXTC and DSEG segments
Since DSEG is *supposed* to be aligned to a paragraph boundary, this should
have never mattered. However, JWlink seems to not obey this segment alignment
in some layer of the linking process.
This now guarantees identical builds with TLINK, ALINK and JWlink.
2014-11-01 09:54:57 +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 696d7f9476 Identify the missing BSS slice of xxv.cpp
sigdata.c doesn't specify any alignment, so this is the only position that
makes sense.
2014-10-29 05:41:43 +01:00
nmlgc 935e68f35e [Reduction] #560: puts 2014-10-29 05:34:30 +01:00
nmlgc 2d62776e02 [Reduction] #559: printf 2014-10-28 03:01:42 +01:00
nmlgc c4aee8a236 [Reduction] #556-558: open 2014-10-27 02:50:32 +01:00
nmlgc ebd20ebc88 [Reduction] #554-555: __rtl_open/__open
Same situation as with __rtl_close/__close, __rtl_read/__read and
__rtl_write/__write.
2014-10-26 02:16:29 +02:00
nmlgc d7d9758fac [Reduction] #553: C++ vector_new 2014-10-25 02:53:27 +02:00
nmlgc 2c2977aa69 [Reduction] #552: Far new[] operator 2014-10-24 03:00:29 +02:00
nmlgc 0b6a824296 [Reduction] #551: Far new operator 2014-10-23 02:01:06 +02:00
nmlgc 4c12d226a4 [Reduction] #550: lrotr 2014-10-22 13:45:02 +02:00
nmlgc c9ee6b0aef [Reduction] #549: lrotl 2014-10-21 03:46:42 +02:00