Commit Graph

174 Commits

Author SHA1 Message Date
nmlgc 191fd5b76b [Reduction] #543-547: fgetc and friends 2014-10-18 02:20:40 +02:00
nmlgc 489ecc8a96 [Reduction] #542: fprintf 2014-10-17 18:26:56 +02:00
nmlgc 54968ed7a3 [Reduction] #541: Fake floating point conversion 2014-10-16 07:29:53 +02:00
nmlgc 16b4e1d240 [Reduction] #540: close
Now with DOS error codes.
2014-10-15 08:39:22 +02:00
nmlgc d6449b27cf [Reduction] #537-539: sprintf 2014-10-14 04:00:44 +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 658ed9e72b Move "Abnormal program termination" to its own slice
That was the very first function reduced, before I came up with the data slice
model in 59688e23fc.
2014-10-12 18:37:58 +02:00
nmlgc afdd1c06e0 [Reduction] #532: fmode
Yup, finally adding the opening flags as well.
2014-10-11 23:56:44 +02:00
nmlgc 365763c459 [Reduction] #531: conio_type_init
Yup, platform detection by checking whether the date returned by the IBM real-
time clock interrupt is in the 20th or 21st century.
2014-10-10 21:20:22 +02:00
nmlgc 47a6be4db2 [Reduction] #530: delay 2014-10-09 03:51:01 +02:00
nmlgc 9003aea36b [Reduction] #527-529: nec_delay 2014-10-08 04:19:18 +02:00
nmlgc 26e795f0bc [Reduction] #526: ibm_delay
There's also the PC-98-specific nec_delay. Which means that the inclusion of
this function into the games was *ding* entirely pointless.

Man, compilers sucked in the early 90s.
2014-10-06 03:18:36 +02:00
nmlgc 6fb80fba79 [Reduction] #525: conio_type 2014-10-05 02:11:00 +02:00
nmlgc 8b4a461283 [Reduction] #523-524: __rtl_close/__close
Same situation as with __rtl_read/__read and __rtl_write/__write.
2014-10-04 02:59:04 +02:00
nmlgc 05702534bc [Reduction] #521-522: setargv 2014-10-03 18:03:36 +02:00
nmlgc ef57ff6ae8 [Reduction] #519-520: intdos 2014-10-02 17:54:48 +02:00
nmlgc 399e6e3098 [Reduction] #517-518: int86 2014-10-01 16:04:50 +02:00
nmlgc 96c4a77d66 [Reduction] #516: xclose 2014-09-30 20:13:56 +02:00
nmlgc bf364ebfae [Reduction] #515: eof 2014-09-29 07:09:38 +02:00
nmlgc 8a2061bcab [Reduction] #513-514: atol and atoi 2014-09-28 05:05:32 +02:00
nmlgc 8cc3df1eb1 [Reduction] #512: xfclose 2014-09-27 22:51:10 +02:00
nmlgc 86b99b9265 [Reduction] #511: segread 2014-09-26 23:15:24 +02:00
nmlgc bbf47ec102 [Reduction] #509-510: mkname and tmpnam 2014-09-24 23:21:48 +02:00
nmlgc 5aad47cb08 [Reduction] #508: fclose 2014-09-21 13:37:38 +02:00
nmlgc 8ae2349005 [Reduction] #507: filelength 2014-09-20 12:41:18 +02:00
nmlgc 624119866b [Reduction] #505-506: LONGTOA and UTOA 2014-09-19 19:22:51 +02:00
nmlgc cd7b956be6 [Reduction] #501: mbctype
Yup, ZUN makes use of this structure. In combination with master.lib.
2014-09-12 08:34:43 +02:00
nmlgc 9c94cb9e6e [Reduction] #497-498: getdate and gettime 2014-09-08 21:57:20 +02:00
nmlgc 9ff29d3159 [Reduction] #495: localeconv 2014-09-07 22:05:49 +02:00
nmlgc 08092bef2b [Reduction] #493-494: DOS file attribute functions 2014-09-07 19:10:29 +02:00
nmlgc 45f1b0d447 [Reduction] #492: unlink 2014-09-07 19:01:21 +02:00
nmlgc 99b60ff9b9 [Reduction] #473: execl
And thus, we've singled out all Borland C++ runtime functions in all games but
TH01.
2014-09-06 19:08:18 +02:00
nmlgc d575a37e1e [Reduction] #470-472: LoadProg 2014-09-06 19:07:54 +02:00
nmlgc 84b7d0f1ab [Reduction] #467: Far long multiplication
Yeah, the code is identical to the near version, with the only difference
being the PROC directive declaring the function as either near or far. Now, I
could either turn the function body into some kind of macro stored in a
separate file and then instantiate it from both near and far functions... or I
could just copy the original structure. Who cares, anyway.
2014-09-05 10:57:12 +02:00
nmlgc ccc560ab37 [Reduction] #466: searchenv 2014-09-04 20:55:28 +02:00
nmlgc dc9fc37b3f [Reduction] #465: searchstr 2014-09-04 20:55:27 +02:00
nmlgc 97711aac8f [Reduction] #464: mbcjmstojis
"Multi-byte-character-<something>-shift-to-JIS"?
2014-09-04 19:24:14 +02:00
nmlgc c0aa5b8a67 [Reduction] #461-463: fullpath.c 2014-09-04 19:04:39 +02:00
nmlgc af7f0b0ad6 [Reduction] #458-460: Double-byte character set functions 2014-09-03 23:23:25 +02:00
nmlgc bab649b884 [Reduction] #457: getch 2014-09-03 19:30:32 +02:00
nmlgc e54a6ad120 [Reduction] #456: DOSCMD
... I, um, cannot comprehend how the C source code I have for this function
could have been compiled into such an assembly.
2014-09-03 19:13:47 +02:00
nmlgc 92046a8021 [Reduction] #455: getenv 2014-09-03 17:08:02 +02:00
nmlgc 01a126da71 [Reduction] #449: setvbuf 2014-09-03 14:02:14 +02:00
nmlgc 00e419e9da [Reduction] #448: setblock 2014-09-02 23:38:26 +02:00
nmlgc b77f2cfba0 [Reduction] #447: access 2014-09-02 23:26:19 +02:00
nmlgc 23aa61c002 [Reduction] #446: abort
The one with the single underscore, which is just raise + a wrapper around the
one with two underscores.
2014-09-02 21:45:19 +02:00
nmlgc 9d5aa934d4 [Reduction] #445: flushall 2014-09-02 21:44:35 +02:00
nmlgc 429f134a51 [Reduction] #442-444: fseek and ftell 2014-09-02 21:04:29 +02:00
nmlgc 6250206235 [Reduction] #432-440: xxv.cpp
OK, *that's* the last piece of C++ crud shared across all main executables.
According to the object in the library file though, it seems to include one
more dword named
	__DestructorCountPtr
in the BSS segment. Neither games nor the runtime itself seem to use it, and
as a consequence, it doesn't even seem to be included in the games' BSS
segments, given that they all end with the symbols of xx.cpp...
2014-09-01 13:51:23 +02:00
nmlgc f994832a28 [Reduction] #431: toupper
Neither is this one. Also, interesting how IDA didn't identify the function in
one third of the cases.

[Binary change] Order of 2 relocations in TH03's MAINL.EXE, TH04's MAIN.EXE
and MAINE.EXE, and TH05's MAINE.EXE.
2014-09-01 12:01:35 +02:00
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