SESSION.md 1.9 KB

Session checkpoint — Turbo-Modula-2 16→64 MCD translator + mc4x VM

Date: 13 sept. 17:4x. Working dir: /home/eric/Projets/Projets-Modula2/MyWork/M2compiler/Resources/mc64 (real absolute roots vary; use find when resolving .MCD inputs).

State: WORKING

  • trans8to64 : 16-bit Foo.MCD -> 64-bit Foo64.MCD (mc64 VM image).
    • Build: gm2 -fiso -o trans8to64 trans8to64.mod FileIO.o Console.o (add -g for dbg build).
    • Extended.MCD -> clean rc=0 now (was aborting rc=134). All 9 spec modules translate; only MCODE.MCD fails BY DESIGN (114-B entry stub, no 304-byte descriptor plane).
  • mcint : 64-bit VM that loads a translated image and runs it.
    • Build (full object set — do NOT prune): gm2 -fiso -o mcint mcint.mod Loader2.o Interpreter.o Instruction.o Local.o Stack.o Memory.o Global.o Extended.o Console.o FileIO.o
    • Verified: mcint /tmp/Stack64h.MCD -> rc=0 (end-to-end).

Last bug fixed (this session)

gm2 FOR j := 0 TO vcnt - 1 with vcnt = 0 underflows an binds loop 65536x -> Get16/descriptor overrun on Extended.MCD (rc=134). Fix: wrap each of the two var-sizes loops in IF vcnt > 0 THEN ... END in trans8to64.mod (read+write both), and the proc-scan loop in IF nEnt >= 2 THEN. Also patched Interpreter.mod 0CDH: default/out-of-range case now Push (eot + t) (was Push (eot)) — honours 16-bit return offset.

Known limits / next

  • Extended64/Array/Local translate but are dcnt=1 (depend on loader-chain modules); cannot run standalone under mcint yet -> needs dependency-chain loading.
  • Original 16-bit stack images themselves run under the 16-bit VM, not mcint.

Files

  • mc64/trans8to64.mod, mc64/Interpreter.mod, mc64/mcint.mod — the code.
  • Binaries: trans8to64, trans8to64dbg, mcint.
  • Test outputs: /tmp/Stack64h.MCD, /tmp/Extended64g.MCD, /tmp/Array64*.MCD...