Commit Graph

174 Commits

Author SHA1 Message Date
nmlgc 49d85b2c0b [Reduction] #430: tolower
... huh? That is certainly not multi-byte safe.
2014-09-01 12:01:34 +02:00
nmlgc 4e16a92b07 [Reduction] #429: ctype 2014-09-01 12:01:32 +02:00
nmlgc 86ea9b69ac [Reduction] #358: kbhit 2014-08-30 06:23:45 +02:00
nmlgc daabf257d1 [Reduction] #357: C++ new[] operator 2014-08-30 04:26:12 +02:00
nmlgc 04b1fd3bcc [Reduction] #355-356: ctor2.asm
OK, looks like we got all of the C++ crap out of the way... e~xcept for
another function in TH01's REIIDEN.EXE, of course.

[Binary change] Order of 2 relocations in TH01's FUUIN.EXE.
2014-08-30 03:50:38 +02:00
nmlgc 73af48ac95 [Reduction] #352-354: ctor3.asm 2014-08-30 02:37:53 +02:00
nmlgc be740fc368 [Reduction] #331-351: strings.cpp
God, this C++ stuff really is a crappy mess. Even had to manually adjust the
alignments at the end of the the TEXTC segment - and no, the ALIGN directive
remains an inadequate tool random bytes, even more so because TASM's
implementation just pads the space with random bytes. But hey, nice to finally
see some reduction outside of seg000.

[Binary change]
* Order of 3 relocations in all of TH04 and TH05's OP.EXE
* Order of 6 relocations in TH03's OP.EXE and MAIN.EXE, and TH05's MAIN.EXE
  and MAINE.EXE
* Order of 9 relocations in all of TH01, TH02's OP.EXE and MAINE.EXE, and
  TH03's MAINL.EXE
* Order of 11 relocations in TH02's MAINE.EXE
2014-08-29 12:47:43 +02:00
nmlgc 588ed7b90b [Reduction] #324-330: new.cpp
[Binary change]
* Order of 2 relocations in all executables of TH02, TH03, TH04 and TH05
* Order of 4 relocations in TH01's FUUIN.EXE
* Inserts a new relocation into TH01's REIIDEN.EXE
2014-08-29 10:50:30 +02:00
nmlgc d49fdce731 [Reduction] #274-323: xx.cpp
Yup. 50 functions in a single module, totalling 12,633 bytes, used in all 15
game executables, and no references to any of that in the remaining game code.

[Binary change]
* Order of 3 relocations in all of THO3, TH04 and TH05, TH02's MAIN.EXE and
  MAINE.EXE, and TH01's OP.EXE and FUUIN.EXE
* Order of 2 relocations in TH02's OP.EXE and TH01's REIIDEN.EXE
* Inserts a new relocation into TH03's MAIN.EXE
2014-08-29 08:03:21 +02:00
nmlgc e2ca057d4b [Reduction] #273: cputype.asm
Don't have the source code for that one either.
2014-08-29 05:58:32 +02:00
nmlgc dd400d7627 [Reduction] #268-272: xmsg.cpp
[Binary change] Order of 6 relocations in every executable except for the TH04
ones.
2014-08-29 04:02:38 +02:00
nmlgc e0762650c6 [Reduction] #264-267: xalloc.cpp 2014-08-29 03:24:39 +02:00
nmlgc e1d78d0e9a [Reduction] #260-263: xxas.cpp
Well. Even after downloading pretty much every (identical) copy of Turbo /
Borland C++ 3, 4, 5 and everything inbetween, I could *not* find the original
source to most of the C++ parts in the runtime. Using the IDA disassemblies
to build their slices is simply the only option.

... Really, though, who cares.
2014-08-29 03:08:23 +02:00
nmlgc a9918e364e [Reduction] #259: C++ delete[] operator
Same for registerbgifont() being a wrapper around registerfarbgifont(). But
at least there, IDA should have noticed something weird. The original delete[]
operator refers to the delete function, so registerbgifont() would have had to
be a wrapper around registerbgidriver(), which of course doesn't make sense,
and IDA claims to *know* these functions...
2014-08-29 01:35:20 +02:00
nmlgc 0493c0c4e4 [Reduction] #258: C++ delete operator
Lol, "registerbgidriver". Just because the original function is nothing but a
wrapper around free(), and registerbgidriver() is also just a wrapper around
registerfarbgidriver().
2014-08-29 01:26:20 +02:00
nmlgc 6ebf0877f7 [Reduction] #257: xfflush 2014-08-28 21:54:04 +02:00
nmlgc 5a05e580e5 [Reduction] #223-224: memmove 2014-08-27 19:47:14 +02:00
nmlgc f3e9147459 [Reduction] #221-222: memset
Two functions, just differing in their order of parameters. It's...
convenient, I guess?
2014-08-27 07:50:37 +02:00
nmlgc 444901acb5 [Reduction] #220: memcpy 2014-08-27 07:15:15 +02:00
nmlgc 39bf07ac61 [Reduction] #219: memcmp 2014-08-27 07:05:29 +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 36a4a02bdc [Reduction] #169-170: fgetn and fread
... yeah, just because ZUN decided to use the C file functions to read
reiiden.cfg for a change. OK, can we *finally* include master.lib's bgm.inc
now?
2014-08-25 04:05:24 +02:00
nmlgc 8f27696514 [Reduction] #168: fputs
One instance. That shouldn't count.
2014-08-24 04:53:19 +02:00
nmlgc 7ad40cceff [Reduction] #164-167: fputc and friends 2014-08-24 04:43:11 +02:00
nmlgc 947e2ea630 [Reduction] #163: ___read 2014-08-23 20:08:41 +02:00
nmlgc 76a12e2608 [Reduction] #161-162: __rtl_read and __read
Lol, these are so similar to __rtl_write and __write that Git's diff treats
reada.asm as a modified copy of writea.asm. Same situation with the CAS file
here, too.
2014-08-23 19:13:31 +02:00
nmlgc 54c9abefee [Reduction] #160: getdcwd 2014-08-23 18:42:30 +02:00
nmlgc 4a36dd15de [Reduction] #159: super_entry_bfnt
[Binary change] Order of 5 relocations in TH05's MAIN.EXE.
2014-08-23 18:09:23 +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 2d1dc1589c [Reduction] #128-129: __rtl_write and __write
Underscores and wrappers, hooray.
__write is not included in the widely available version of WRITEA.CAS, but
it's still part of the same object file.
2014-08-22 02:55:11 +02:00
nmlgc 216413d8a6 [Reduction] #127: lseek
Yup, gotta move all the "handle" definitions away first.
2014-08-22 01:55:05 +02:00
nmlgc 98bf9d9576 Change the name of the entry point to STARTX
Because it just so happens that master.lib's bfnt_header structure contains
an element named "START".
And huh, this suddenly works without changing any assembler or linker
parameters? I swear it didn't when I tried it first.
2014-08-21 22:05:17 +02:00
nmlgc 87fae21127 [Reduction] #114: fperror
OK, one more Borland C function I noticed while I was covering signals.
2014-08-21 21:33:04 +02:00
nmlgc 8e4683cd1e [Reduction] #109-113: Signal handling
> "OK, the signal slice is pretty large, let's do it tomorrow"
> stay there for the majority of the day

Oh well, at least it paid off. I *really* should work towards PI loading now,
though.
2014-08-21 21:28:18 +02:00
nmlgc a244c30cd9 [Reduction] #104-105: _dos_getdrive and _dos_setdrive 2014-08-20 21:38:31 +02:00
nmlgc 69672b819a [Reduction] #103: DOSENV 2014-08-20 21:22:56 +02:00
nmlgc 8ca6964330 [Reduction] #102: ErrorMessage 2014-08-20 20:38:08 +02:00
nmlgc e6e1e3a937 [Reduction] #101: Far struct copy 2014-08-20 20:35:18 +02:00
nmlgc 68e1dc8596 [Reduction] #100: fflush 2014-08-20 19:46:47 +02:00
nmlgc 33fa958a30 [Reduction] #98-99: getvect and setvect
Yeah, getvect.asm also includes setvect(). They really could have chosen a
better naming scheme.
2014-08-20 18:09:26 +02:00
nmlgc ea547e4841 [Reduction] #92-97: exit 2014-08-20 17:53:02 +02:00
nmlgc 9d23be1a92 [Reduction] #91: stpcpy 2014-08-20 17:03:08 +02:00
nmlgc f39d9165da [Reduction] #81: ioctl 2014-08-20 14:02:31 +02:00
nmlgc b90a1e2320 [Reduction] #80: chmod
Yup, getting rid of all the definitions for "func", so that we can restore the
master.lib macro with the same name.
2014-08-20 14:02:29 +02:00
nmlgc e9701c491d [Reduction] #79: atexit
Once again, random misreferences in one executable slow down the development.
And that function doesn't even seem to be called anywhere.
2014-08-20 14:02:27 +02:00
nmlgc ce00b0b534 [Reduction] #70-78: C start up code
Finally!

[Binary change] Order of the first three relocations in every executable.
Two more relocations in the TH01 executables.
2014-08-20 14:02:26 +02:00
nmlgc 30d44e6822 [Reduction] #66-69: Near data segment space allocation
Neither should that one.
2014-08-19 19:54:53 +02:00
nmlgc bb2c6c6efe [Reduction] #53-65: Near heap functions
Come on, that shouldn't even count.
2014-08-19 19:52:11 +02:00
nmlgc 8082ba0434 [Reduction] #52: setupio
Thanks, ZUNSOFT.COM, for turning this function into a mess.

[Binary change] Two relocations in every executable... *except* for TH01's
REIIDEN.EXE.
2014-08-18 19:50:20 +02:00
nmlgc dcb2726799 [Reduction] #51: Standard FILE structures
[Binary change] Relocations in TH01's FUUIN.EXE. (...)
2014-08-18 16:58:24 +02:00
nmlgc 11a91d0e45 [Reduction] #50: setenvp 2014-08-18 14:33:24 +02:00
nmlgc aaba4d6149 Fix the declaration of errno
Hooray for underscore confusion. Should have copy-pasted the correct one all
along...
2014-08-17 13:57:24 +02:00
nmlgc 5fb4445ada [Reduction] #48-49: exec
[Binary change] Relocations in TH01's FUUIN.EXE.
2014-08-17 13:57:03 +02:00
nmlgc d4b766ee4e [Reduction] #45-47: Far data segment space allocation 2014-08-15 21:48:43 +02:00
nmlgc d5a80ee363 [Reduction] #42: Long shift right 2014-08-14 20:07:02 +02:00
nmlgc 554d0325d5 [Reduction] #41: Long pointer comparison 2014-08-14 20:07:00 +02:00
nmlgc 859e48a59f [Reduction] #40: Long multiplication 2014-08-14 20:06:58 +02:00
nmlgc 3e34084a8d [Reduction] #39: Long pointer subtraction 2014-08-14 20:06:57 +02:00
nmlgc ca18919ee7 [Reduction] #38: Long division 2014-08-14 20:06:55 +02:00
nmlgc bf4edcec28 [Reduction] #37: Long shift left 2014-08-14 20:06:54 +02:00
nmlgc fc9dacd180 [Reduction] #36: Huge pointer addition 2014-08-14 19:55:26 +02:00
nmlgc 3b911b3c20 [Reduction] #35: _isatty 2014-08-14 19:55:23 +02:00
nmlgc 4e3bd76348 [Reduction] #33-34: __IOERROR and __DOSERROR 2014-08-14 15:56:57 +02:00
nmlgc 5764275549 [Reduction] #26: strrchr
Marking the first function that was originally written in C, which means that
there are no original label names we could preserve.
2014-08-14 12:22:44 +02:00
nmlgc a3ab75cd34 [Reduction] #25: _strcat 2014-08-14 12:22:37 +02:00
nmlgc adf8e137d9 [Reduction] #24: _strcmp
[Binary change] Relocation order in TH01's REIIDEN.EXE... do they depend on
some kind of RNG?
2014-08-14 12:22:31 +02:00
nmlgc 111fc05e58 [Reduction] #19-23: Far heap checking functions
They're only used as part of TH01's debugging functionality.
2014-08-14 12:22:23 +02:00
nmlgc 18f77cb7da Include RULES.ASI from every executable's dump file.
Having thought this over for a while, I've decided to stay with the "include
slice" model for now, due to various bugs and other reasons.

We need to compile for the 386 CPU, but this causes TASM to automatically
default every segment to 32-bit mode, which of course is not what we want (and
no, .MODEL USE16 sadly does not help either). Appending USE16 to every segment
declaration in all included files seems to work, but for some reason, this
messes up certain jump instructions. WTF? And even if it did work, we would
still have to do this for every single file we include.

The alternative would be to build proper libraries and let the linker merge
all the code. This would add a lot of unwarranted complexity to the build
process. Not to mention all the EXTERN statements we'd have to maintain.

Ultimately, all of the C runtime ASM code is going to vanish anyway once we've
completed the reduction step. Once we're there, we can simply link to the
original version of the library. These initial dumps are not pretty, and I see
no point in wasting time on making intermediary stages of development look
pretty.

Since including RULES.ASI from every slice seems a bit inefficient (and even
potentiall harmful, considering the age of the development tools we have to
work with), we'll only include it once at the top of every main dump file.

[Binary change] Relocations in TH01's REIIDEN.EXE, again.
2014-08-14 09:54:00 +02:00
nmlgc 43f280ab55 [Reduction] #6-18: Far heap functions
Wow, what a slice. Lots of code, and it comes with its own data declarations
inside the code segment! Since all these functions were originally contained
in one code file, it makes sense to do all 13 in one commit. This removes all
erroneous references to the 'NULL CHECK' string.

[Binary change] This also changes some relocations in TH01's REIIDEN.EXE.
2014-08-13 14:40:41 +02:00
nmlgc 130a5c587d [Reduction] #4: _strcpy 2014-08-10 07:52:56 +02:00
nmlgc 23674951e5 [Reduction] #3: _stricmp 2014-08-10 07:52:29 +02:00
nmlgc 4dba5673cb [Reduction] #2: _strlen
Yes, I do have the .CAS files. However, even though they contain the assembly
source, they're actually C source, and we're not that far yet.
2014-08-10 07:51:36 +02:00
nmlgc 713ad758b6 [Reduction] #1: __abort
It begins. And this already shows that the inclusion of TH01's ZUNSOFT.COM
will double the size of all Borland C routines we slice out, because we have
to cover both large and tiny memory models...
2014-08-10 07:50:38 +02:00