Ver Fonte

step2.1: rename 64-bit images .MCD -> .MC4 per spec sections 8 and 14

Eric Streit há 3 semanas atrás
pai
commit
b0c26bb9f4
29 ficheiros alterados com 41 adições e 41 exclusões
  1. 2 2
      Loader2.mod
  2. BIN
      Loader2.o
  3. 1 1
      MC64.mod
  4. BIN
      MC64.o
  5. 1 1
      SESSION.md
  6. 0 0
      boot.MC4
  7. 1 1
      docs/mc64-spec.md
  8. 14 14
      docs/session-summary.md
  9. 0 0
      example.MC4
  10. BIN
      mc64
  11. BIN
      mcint
  12. 2 2
      mcint.mod
  13. BIN
      mcint.o
  14. BIN
      mkdemo
  15. 3 3
      mkdemo.mod
  16. BIN
      mkdemo.o
  17. BIN
      mkdep
  18. 8 8
      mkdep.mod
  19. BIN
      mkdep.o
  20. BIN
      mkdtest
  21. 4 4
      mkdtest.mod
  22. BIN
      mkdtest.o
  23. BIN
      mkread
  24. 3 3
      mkread.mod
  25. BIN
      mkread.o
  26. 0 0
      readtest.MC4
  27. BIN
      trans8to64
  28. 2 2
      trans8to64.mod
  29. BIN
      trans8to64.o

+ 2 - 2
Loader2.mod

@@ -31,7 +31,7 @@ VAR
   buf : ARRAY [0 .. 65535] OF CHAR ;
   buf : ARRAY [0 .. 65535] OF CHAR ;
   f : FIO.File ;
   f : FIO.File ;
 
 
-(* Load one translated .MCD image into module `slot`.  The image and its
+(* Load one translated .MC4 image into module `slot`.  The image and its
    zero-filled data window (plus globals) are placed at `next` and `next` is
    zero-filled data window (plus globals) are placed at `next` and `next` is
    advanced past them, so several modules share the arena without overlap
    advanced past them, so several modules share the arena without overlap
    (multi-window arena).  The requested module lives at MTBL slot `dcnt`,
    (multi-window arena).  The requested module lives at MTBL slot `dcnt`,
@@ -154,7 +154,7 @@ BEGIN
     fname [k] := '.' ;
     fname [k] := '.' ;
     fname [k + 1] := 'M' ;
     fname [k + 1] := 'M' ;
     fname [k + 2] := 'C' ;
     fname [k + 2] := 'C' ;
-    fname [k + 3] := 'D' ;
+    fname [k + 3] := '4' ;
     fname [k + 4] := 0C ;
     fname [k + 4] := 0C ;
     LoadOne (j - 1, fname, next, FALSE) ;
     LoadOne (j - 1, fname, next, FALSE) ;
   END ;
   END ;

BIN
Loader2.o


+ 1 - 1
MC64.mod

@@ -8,7 +8,7 @@ FROM Console IMPORT WriteString, WriteLn ;
 BEGIN
 BEGIN
   Init () ;
   Init () ;
   InitModuleTable () ;
   InitModuleTable () ;
-  Call ("boot.mc4") ;
+  Call ("boot.MC4") ;
   WriteString ("[vm end]") ;
   WriteString ("[vm end]") ;
   WriteLn ;
   WriteLn ;
 END MC64.
 END MC64.

BIN
MC64.o


+ 1 - 1
SESSION.md

@@ -32,6 +32,6 @@ Why stopped: the 64-bit loader binds ONE module window into slot 0 and hard-fenc
   (NOT the foreign FIO.o used in a lost earlier glob). Build rc != 0 => stop, restore.
   (NOT the foreign FIO.o used in a lost earlier glob). Build rc != 0 => stop, restore.
 
 
 ## Regression that stayed green (from earlier verified runs this tree)
 ## Regression that stayed green (from earlier verified runs this tree)
-  Stack.MCD -> trans8to64 -> Stack64.MCD -> mcint : rc=0
+  Stack.MCD -> trans8to64 -> Stack64.MC4 -> mcint : rc=0
   9-spec translator regression: Stack, Array, Local, Extended, Instruction, Loader,
   9-spec translator regression: Stack, Array, Local, Extended, Instruction, Loader,
   Console, FileIO, MCODE-stub: 8 ok / 1 skip (the translator never regresses these).
   Console, FileIO, MCODE-stub: 8 ok / 1 skip (the translator never regresses these).

+ 0 - 0
boot.mc4 → boot.MC4


+ 1 - 1
docs/mc64-spec.md

@@ -790,7 +790,7 @@ source relies on.
   `UnixArgs`, …). Vendor `m2pim` modules fail to link against `-fiso` objects.
   `UnixArgs`, …). Vendor `m2pim` modules fail to link against `-fiso` objects.
 - `System.ProgramArgs.ArgChan` is **not usable** in this gm2 build: `TextRead` on it
 - `System.ProgramArgs.ArgChan` is **not usable** in this gm2 build: `TextRead` on it
   blocks forever and `Look` returns a `'.'` filler instead of `endOfInput`. The VM
   blocks forever and `Look` returns a `'.'` filler instead of `endOfInput`. The VM
-  therefore boots a fixed `boot.mc4` (generated by `mkdemo`) instead of parsing argv.
+  therefore boots a fixed `boot.MC4` (generated by `mkdemo`) instead of parsing argv.
 - File I/O uses `StreamFile.Open/Close` + `IOChan.RawRead/RawWrite` (`ChanConsts`
 - File I/O uses `StreamFile.Open/Close` + `IOChan.RawRead/RawWrite` (`ChanConsts`
   `FlagSet{readFlag, oldFlag, rawFlag}` / `{writeFlag, rawFlag}`).
   `FlagSet{readFlag, oldFlag, rawFlag}` / `{writeFlag, rawFlag}`).
 - Screens output writes go to the ISO standard output channel
 - Screens output writes go to the ISO standard output channel

+ 14 - 14
docs/session-summary.md

@@ -9,9 +9,9 @@ Constraints honored so far: no analysis/disassembly of `.MCD` binaries — work
 - `M2compiler/mc64/` — all VM code:
 - `M2compiler/mc64/` — all VM code:
   `Memory, Local, Stack, Console, FileIO, Global, Instruction, Extended, Interpreter,
   `Memory, Local, Stack, Console, FileIO, Global, Instruction, Extended, Interpreter,
   Loader2` (.def + .mod);
   Loader2` (.def + .mod);
-  programs `MC64.mod` (REPL harness), `mkdemo.mod` (`boot.mc4`), `mcint.mod`
-  (`mcint file.MCD` launcher), `mkdtest.mod` (`example.MCD` generator);
-  built: `mkdemo`, `mc64`, `mcint`, `mkdtest`, `boot.mc4`, `example.MCD`.
+  programs `MC64.mod` (REPL harness), `mkdemo.mod` (`boot.MC4`), `mcint.mod`
+  (`mcint file.MC4` launcher), `mkdtest.mod` (`example.MC4` generator);
+  built: `mkdemo`, `mc64`, `mcint`, `mkdtest`, `boot.MC4`, `example.MC4`.
 - `M2compiler/mc64-spec.md` — normative spec (§5.2 frames, §7.1 descriptor layout,
 - `M2compiler/mc64-spec.md` — normative spec (§5.2 frames, §7.1 descriptor layout,
   §8.3 checksum rule, §9.3 SYSTEM ABI, §10 0x12/0x40 sub-dispatches, §11 opcode table,
   §8.3 checksum rule, §9.3 SYSTEM ABI, §10 0x12/0x40 sub-dispatches, §11 opcode table,
   §12 switch/strings, §16 GNU-M2 ISO implementation notes).
   §12 switch/strings, §16 GNU-M2 ISO implementation notes).
@@ -34,10 +34,10 @@ gm2 -fiso -o mkdtest mkdtest.mod FileIO.o Console.o
 ```
 ```
 
 
 ## Verification status (all green)
 ## Verification status (all green)
-- `./mkdemo` -> `boot.mc4` ; `./mc64` -> `Hello MC64!` + `[vm end]` (0) ;
-  `./mcint boot.mc4` -> `Hello MC64!` (0) ; `./mcint` -> usage (0) ;
-  `./mcint nope.MCD` -> Fatal (1).
-- `./mkdtest` -> `example.MCD` (1350 B, MC64 format) ; `./mcint example.MCD` — 24/24
+- `./mkdemo` -> `boot.MC4` ; `./mc64` -> `Hello MC64!` + `[vm end]` (0) ;
+  `./mcint boot.MC4` -> `Hello MC64!` (0) ; `./mcint` -> usage (0) ;
+  `./mcint nope.MC4` -> Fatal (1).
+- `./mkdtest` -> `example.MC4` (1350 B, MC64 format) ; `./mcint example.MC4` — 24/24
   opcode-checks pass (exit 0):
   opcode-checks pass (exit 0):
   loop g:=2g+1 x10 = 2047; add/sub/mul/div/mod; bit_and/or/xor & power2;
   loop g:=2g+1 x10 = 2047; add/sub/mul/div/mod; bit_and/or/xor & power2;
   extended 0x40: drop, uc_add, uc_mul, uc_div, uc_mod, long_negate, build_field_mask;
   extended 0x40: drop, uc_add, uc_mul, uc_div, uc_mod, long_negate, build_field_mask;
@@ -45,12 +45,12 @@ gm2 -fiso -o mkdtest mkdtest.mod FileIO.o Console.o
   copy_block -> "abc"; global/local_dw load/store; load_global_dw;
   copy_block -> "abc"; global/local_dw load/store; load_global_dw;
   forward jp_fwd; jpfalse_back loops; proc_call into decimal `print_num`
   forward jp_fwd; jpfalse_back loops; proc_call into decimal `print_num`
   (enter/fct_leave, load_param, reserve, udiv/umod, store_indexed_byte).
   (enter/fct_leave, load_param, reserve, udiv/umod, store_indexed_byte).
-  - `./mkread` -> `readtest.MCD` (453 B) ; `./mcint readtest.MCD` — SYSTEM service 2
-  reads stdin lines: `printf 'first line\nsecond line\n' | ./mcint readtest.MCD`
+  - `./mkread` -> `readtest.MC4` (453 B) ; `./mcint readtest.MC4` — SYSTEM service 2
+  reads stdin lines: `printf 'first line\nsecond line\n' | ./mcint readtest.MC4`
   echoes `you said: first line` then `again: second line` (0). Edge cases verified:
   echoes `you said: first line` then `again: second line` (0). Edge cases verified:
   EOF without trailing newline still echoes; empty line -> count 0; immediate EOF -> 0;
   EOF without trailing newline still echoes; empty line -> count 0; immediate EOF -> 0;
   two consecutive reads prove the line mark is consumed (Skip) so the next read starts fresh.
   two consecutive reads prove the line mark is consumed (Skip) so the next read starts fresh.
-- `./mcint boot.mc4` -> `Hello MC64!` (0) ; `./mcint example.MCD` — 24/24 (0).
+- `./mcint boot.MC4` -> `Hello MC64!` (0) ; `./mcint example.MC4` — 24/24 (0).
 - Public-dollar checks: `::` VM accepts THE-SPEC–conformant images only.
 - Public-dollar checks: `::` VM accepts THE-SPEC–conformant images only.
 
 
 ## Key technical facts learned
 ## Key technical facts learned
@@ -89,13 +89,13 @@ gm2 -fiso -o mkdtest mkdtest.mod FileIO.o Console.o
 - SYSTEM service 2 (read line) implemented via ISO `StdChans.StdInChan` +
 - SYSTEM service 2 (read line) implemented via ISO `StdChans.StdInChan` +
   `IOChan.Look/Skip` char loop (avoids `TextRead`'s "current line" blocking);
   `IOChan.Look/Skip` char loop (avoids `TextRead`'s "current line" blocking);
   stores chars up to (not incl.) line mark or EOF, NUL-terminates, pushes byte count.
   stores chars up to (not incl.) line mark or EOF, NUL-terminates, pushes byte count.
-  Documented in spec §9.3; readtest.MCD exercises it.
+  Documented in spec §9.3; readtest.MC4 exercises it.
 
 
 ## Current task state
 ## Current task state
-- Writing an **MCD example file** to exercise the interpreter: **DONE** —
-  `mkdtest.mod` -> `example.MCD`, 24 opcode-checks pass under `./mcint`.
+- Writing an **MC4 example file** to exercise the interpreter: **DONE** —
+  `mkdtest.mod` -> `example.MC4`, 24 opcode-checks pass under `./mcint`.
 - **stdin support for SYSTEM service 2**: **DONE** — implemented in `Interpreter.mod`
 - **stdin support for SYSTEM service 2**: **DONE** — implemented in `Interpreter.mod`
-  (`ReadLine`), `mc64-spec.md` §9.3 updated, `mkread.mod` -> `readtest.MCD` proves
+  (`ReadLine`), `mc64-spec.md` §9.3 updated, `mkread.mod` -> `readtest.MC4` proves
   line reads + line-mark consumption under piped input.
   line reads + line-mark consumption under piped input.
 
 
 ## Next steps / open ideas
 ## Next steps / open ideas

+ 0 - 0
example.MCD → example.MC4


BIN
mc64


BIN
mcint


+ 2 - 2
mcint.mod

@@ -1,7 +1,7 @@
 MODULE mcint ;
 MODULE mcint ;
 
 
 (* Standalone launcher for the MC64 interpreter.
 (* Standalone launcher for the MC64 interpreter.
-   usage: mcint module.MCD
+   usage: mcint module.MC4
    The first program argument is treated as the module file to boot. *)
    The first program argument is treated as the module file to boot. *)
 
 
 FROM Loader2 IMPORT Call ;
 FROM Loader2 IMPORT Call ;
@@ -14,7 +14,7 @@ VAR
 
 
 PROCEDURE Usage ;
 PROCEDURE Usage ;
 BEGIN
 BEGIN
-  WriteString ("usage: mcint module.MCD") ;
+  WriteString ("usage: mcint module.MC4") ;
   WriteLn ;
   WriteLn ;
 END Usage ;
 END Usage ;
 
 

BIN
mcint.o


BIN
mkdemo


+ 3 - 3
mkdemo.mod

@@ -1,6 +1,6 @@
 MODULE mkdemo ;
 MODULE mkdemo ;
 
 
-(* Generates boot.mc4, a single-module MC64 image that prints
+(* Generates boot.MC4, a single-module MC64 image that prints
    "Hello MC64!" via the SYSTEM write-string service (§9.3). *)
    "Hello MC64!" via the SYSTEM write-string service (§9.3). *)
 
 
 FROM FileIO IMPORT WriteFile ;
 FROM FileIO IMPORT WriteFile ;
@@ -102,7 +102,7 @@ BEGIN
   END ;
   END ;
   Put32 (HeaderSize + DescChecksum, sum) ;
   Put32 (HeaderSize + DescChecksum, sum) ;
 
 
-  IF NOT WriteFile ("boot.mc4", buf, FileSize) THEN
-    Fatal ("mkdemo: cannot write boot.mc4") ;
+  IF NOT WriteFile ("boot.MC4", buf, FileSize) THEN
+    Fatal ("mkdemo: cannot write boot.MC4") ;
   END ;
   END ;
 END mkdemo.
 END mkdemo.

BIN
mkdemo.o


BIN
mkdep


+ 8 - 8
mkdep.mod

@@ -1,12 +1,12 @@
 MODULE mkdep ;
 MODULE mkdep ;
 
 
 (* Synthetic two-module MC64 test for the Loader2 dep-chain :
 (* Synthetic two-module MC64 test for the Loader2 dep-chain :
-   - STAK.MCD : dependency-free sidecar.  proc0 = empty TOINIT,
+   - STAK.MC4 : dependency-free sidecar.  proc0 = empty TOINIT,
      proc1 = writes a host string (proves an extern call reached
      proc1 = writes a host string (proves an extern call reached
      the dependency's code via MTBL slot 0 + cross-module call/leave).
      the dependency's code via MTBL slot 0 + cross-module call/leave).
-   - DEP.MCD  : main module, dcnt=1, dep name "STAK".  TOINIT
+   - DEP.MC4  : main module, dcnt=1, dep name "STAK".  TOINIT
      extern-calls STAK.proc1, then end_program.
      extern-calls STAK.proc1, then end_program.
-   Run : mkdep ; then  mcint DEP.MCD   from the dir holding STAK.MCD.
+   Run : mkdep ; then  mcint DEP.MC4   from the dir holding STAK.MC4.
    Expect one line from the STAK proc, exit 0. *)
    Expect one line from the STAK proc, exit 0. *)
 
 
 FROM FileIO IMPORT WriteFile ;
 FROM FileIO IMPORT WriteFile ;
@@ -137,12 +137,12 @@ BEGIN
   END ;
   END ;
   Put32 (HeaderSize + DescChecksum, sum) ;
   Put32 (HeaderSize + DescChecksum, sum) ;
 
 
-  IF NOT WriteFile ("STAK.MCD", buf, HeaderSize + pcimg) THEN
-    Fatal ("mkdep: cannot write STAK.MCD") ;
+  IF NOT WriteFile ("STAK.MC4", buf, HeaderSize + pcimg) THEN
+    Fatal ("mkdep: cannot write STAK.MC4") ;
   END ;
   END ;
 END Stak ;
 END Stak ;
 
 
-PROCEDURE Dep ;  (* build DEP.MCD *)
+PROCEDURE Dep ;  (* build DEP.MC4 *)
 VAR st0, dep : CARDINAL ;
 VAR st0, dep : CARDINAL ;
 BEGIN
 BEGIN
   which := tDep ;
   which := tDep ;
@@ -188,8 +188,8 @@ BEGIN
   END ;
   END ;
   Put32 (HeaderSize + DescChecksum, sum) ;
   Put32 (HeaderSize + DescChecksum, sum) ;
 
 
-  IF NOT WriteFile ("DEP.MCD", buf, HeaderSize + pcimg) THEN
-    Fatal ("mkdep: cannot write DEP.MCD") ;
+  IF NOT WriteFile ("DEP.MC4", buf, HeaderSize + pcimg) THEN
+    Fatal ("mkdep: cannot write DEP.MC4") ;
   END ;
   END ;
 END Dep ;
 END Dep ;
 
 

BIN
mkdep.o


BIN
mkdtest


+ 4 - 4
mkdtest.mod

@@ -1,7 +1,7 @@
 MODULE mkdtest ;
 MODULE mkdtest ;
 
 
-(* Generates example.MCD, a single-module MC64 image that exercises far
-   more of the interpreter than boot.mc4 :
+(* Generates example.MC4, a single-module MC64 image that exercises far
+   more of the interpreter than boot.MC4 :
 
 
      proc0 (TOINIT, main) :
      proc0 (TOINIT, main) :
        - a CARDINAL do-while loop  g := g*2+1  (10 iterations)  -> 2047
        - a CARDINAL do-while loop  g := g*2+1  (10 iterations)  -> 2047
@@ -341,7 +341,7 @@ BEGIN
   END ;
   END ;
   Put32 (HeaderSize + DescChecksum, sum) ;
   Put32 (HeaderSize + DescChecksum, sum) ;
 
 
-  IF NOT WriteFile ("example.MCD", buf, HeaderSize + pcimg) THEN
-    Fatal ("mkdtest: cannot write example.MCD") ;
+  IF NOT WriteFile ("example.MC4", buf, HeaderSize + pcimg) THEN
+    Fatal ("mkdtest: cannot write example.MC4") ;
   END ;
   END ;
 END mkdtest.
 END mkdtest.

BIN
mkdtest.o


BIN
mkread


+ 3 - 3
mkread.mod

@@ -1,6 +1,6 @@
 MODULE mkread ;
 MODULE mkread ;
 
 
-(* Generates readtest.MCD, a single-module MC64 image that reads two lines
+(* Generates readtest.MC4, a single-module MC64 image that reads two lines
    from the host standard input via SYSTEM service 2 and echoes both back:
    from the host standard input via SYSTEM service 2 and echoes both back:
 
 
      reserve 128 bytes  ; store_global 1        ; input buffer
      reserve 128 bytes  ; store_global 1        ; input buffer
@@ -139,7 +139,7 @@ BEGIN
   END ;
   END ;
   Put32 (HeaderSize + DescChecksum, sum) ;
   Put32 (HeaderSize + DescChecksum, sum) ;
 
 
-  IF NOT WriteFile ("readtest.MCD", buf, HeaderSize + ilen) THEN
-    Fatal ("mkread: cannot write readtest.MCD") ;
+  IF NOT WriteFile ("readtest.MC4", buf, HeaderSize + ilen) THEN
+    Fatal ("mkread: cannot write readtest.MC4") ;
   END ;
   END ;
 END mkread.
 END mkread.

BIN
mkread.o


+ 0 - 0
readtest.MCD → readtest.MC4


BIN
trans8to64


+ 2 - 2
trans8to64.mod

@@ -1,7 +1,7 @@
 MODULE trans8to64 ;
 MODULE trans8to64 ;
 
 
 (* trans8to64 : translate a classic 16-bit Turbo Modula-2 .MCD binary
 (* trans8to64 : translate a classic 16-bit Turbo Modula-2 .MCD binary
-   into a 64-bit MC64 .MCD image that mcint can boot.
+   into a 64-bit MC64 .MC4 image that mcint can boot.
 
 
    16-bit file layout (little-endian) ::
    16-bit file layout (little-endian) ::
       header   : 16 bytes
       header   : 16 bytes
@@ -329,7 +329,7 @@ END AddEnt ;
 
 
 PROCEDURE Usage ;
 PROCEDURE Usage ;
 BEGIN
 BEGIN
-  WriteString ("usage: trans8to64 in.MCD out.MCD") ;
+  WriteString ("usage: trans8to64 in.MCD out.MC4") ;
   WriteLn ;
   WriteLn ;
 END Usage ;
 END Usage ;
 
 

BIN
trans8to64.o