Commit Graph

3 Commits

Author SHA1 Message Date
nmlgc aea5a20de9 [Translation unit catch-up] [th04] hflip_lut_generate()
Part of P0138, funded by [Anonymous] and Blue Bolt.
2021-04-21 17:45:20 +02:00
nmlgc 0f75a77dee [Research] Discover a workaround to word-align code segments from Turbo C++
Turns out that this is one of the effects of the -WX option ("Create
DPMI application")… along with generally messing up code generation.
Nothing we can't work around though, luckily! Finally getting to cross
that off the list of reasons that prevent decompilation.

Part of P0137, funded by [Anonymous].
2021-04-03 20:19:41 +02:00
nmlgc 8835d59eda [Build] [th03] Keep hflip_lut_generate() in ASM due to alignment issues
Nooooo, gotta throw away that decompilation for the stupidest of
reasons :( Turns out that a function may also be "undecompilable" if
the original code layout places it at a word-aligned address, but the
last byte of the previous function in just one of the original binaries
(TH03's MAIN.EXE, in this case) also lies at a word-aligned address.
There's simply no way to enforce per-function word alignment in Turbo
C++ alone. You *could* fake it with `#pragma codestring`, but of course
that won't work for functions that are part of the SHARED segment, and
where the alignment previously would have been correct. Conditionally
emitting that codestring would work, but then we'd also have to compile
that translation unit at least twice.

Now, I could have created a dummy .ASM file that just contains a single
zero-length but word-aligned SHARED segment, which could be placed
anywhere on the link command line where word alignment is needed… but
the decompilation of this function was a mess anyway, and probably
helped nobody.

Part of P0127, funded by [Anonymous].
2020-11-16 20:01:34 +01:00