|
|
@@ -9,9 +9,9 @@ Constraints honored so far: no analysis/disassembly of `.MCD` binaries — work
|
|
|
- `M2compiler/mc64/` — all VM code:
|
|
|
`Memory, Local, Stack, Console, FileIO, Global, Instruction, Extended, Interpreter,
|
|
|
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,
|
|
|
§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).
|
|
|
@@ -34,10 +34,10 @@ gm2 -fiso -o mkdtest mkdtest.mod FileIO.o Console.o
|
|
|
```
|
|
|
|
|
|
## 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):
|
|
|
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;
|
|
|
@@ -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;
|
|
|
forward jp_fwd; jpfalse_back loops; proc_call into decimal `print_num`
|
|
|
(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:
|
|
|
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.
|
|
|
-- `./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.
|
|
|
|
|
|
## 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` +
|
|
|
`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.
|
|
|
- Documented in spec §9.3; readtest.MCD exercises it.
|
|
|
+ Documented in spec §9.3; readtest.MC4 exercises it.
|
|
|
|
|
|
## 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`
|
|
|
- (`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.
|
|
|
|
|
|
## Next steps / open ideas
|