feat(reconstruction): complete binary-backed C recovery

Replace the partial mechanics transcriptions with a separate, readable C11
reconstruction of the complete Win16 image while preserving the original raw
Ghidra export as immutable evidence. Cover all ordinary and overlapping entry
points, Borland runtime behavior, Win16 imports, segmented data, callbacks,
resources, indirect control flow, physics, rendering, persistence, and
startup/shutdown lifecycles.

Add deterministic extraction and audit tooling plus address-linked ledgers for
functions, imports, DGROUP ranges and objects, relocations, resources, and
callbacks. The final gate records zero raw, partial, restored, unknown,
blocked, or unclassified required units. Keep the semantic-fidelity boundary
explicit: the portable C is not claimed to reproduce a byte-identical Borland
NE build.

Add strict focused harnesses for every reconstructed C unit, exact resource
round-trip checks, and a 16-bit Borland Real48 reference probe. No Rust source
or Cargo metadata is changed in this phase.

Test Plan:
- `bash original/tools/test_reconstructed_c.sh` -- passed
- `bash original/tools/probe_real48_reference.sh` -- passed bit-for-bit
- `python3 original/tools/audit_reconstruction.py --require-complete` -- passed
- `git diff --cached --check` -- passed
- `git diff HEAD -- '*.rs' Cargo.toml Cargo.lock` -- empty
This commit is contained in:
2026-08-23 16:41:17 +02:00
parent aef404c834
commit 8b99e9607c
253 changed files with 79031 additions and 51 deletions
+37
View File
@@ -0,0 +1,37 @@
#ifndef TDKPIN_NUMERIC_H
#define TDKPIN_NUMERIC_H
#include "tdkpin_segmented.h"
typedef struct {
Win16FarPtr start;
uint16_t length;
} BorlandFormattedSlice;
typedef struct {
int32_t value;
Win16FarPtr cursor;
uint16_t remaining;
bool failed;
} BorlandParseI32Result;
typedef struct {
int32_t value;
uint16_t error_position;
} BorlandValI32Result;
BorlandFormattedSlice borland_format_u32_backward(
Win16FarPtr end, uint32_t value, uint16_t base); /* 1020:1562 */
BorlandFormattedSlice borland_format_i32_decimal_backward(
Win16FarPtr end, int32_t value); /* 1020:1546 */
void borland_format_i32_short_string(
int16_t maximum_length,
Win16FarPtr destination,
int16_t field_width,
int32_t value); /* 1020:1629 */
BorlandParseI32Result borland_parse_i32_span(
Win16FarPtr text, uint16_t length); /* 1020:1582 */
BorlandValI32Result borland_val_i32_short_string(
Win16FarPtr string); /* 1020:1674 */
#endif