ソースを参照

Document the milestone: one status table, not two

`v-TP3-BP-CONTRACT` is tagged but absent from the milestone table in
`SUMMARY.md`, so the tag named a milestone the index did not mention.  Added.

The bigger problem was `README.md`'s own status table, which had drifted six
milestones behind while still reading as authoritative.  It claimed "no
compiled program has been executed yet" and "CmdRun is a stub and the runtime
blob does not exist" through five tagged milestones in which all three of those
became false, and it named a `tpshell` size from four milestones earlier.

That is the same failure this project has now catalogued ten times -- a
restated constant that is only right until the next change and is never
noticed expiring -- except that here the duplicated thing is the whole status
table, and the two copies were the status table and `SUMMARY.md`.  So the table
is not re-synced; it is removed.  `README.md` now says where the state lives
and gives a short list of what is and is not true, each line checked against
the code rather than remembered: CmdRun is still a stub (`Shell.mod:736`
prints "Interpreter pending"), Compiler.CodeByteAt exists, RT_Entry addresses
entries by name, and the six unimplemented features are the ones `SUMMARY.md`
lists with reasons.

The `R` row of the key table said `prints "Interpreter pending"`; the string
has a second clause, so the row now quotes it exactly.  A paraphrase of a
string in a status document is a claim that rots when the string changes.

README's Layout section also listed four of the nine modules that exist.  It
now lists all of them, and says that the disassembly in Resources/ is the
ground truth -- which is the single most important thing a reader needs to know
and was not written down anywhere in this file.

No code touched.  run_all.sh: 12 checks, ALL PASS.
Eric Streit 1 週間 前
親
コミット
9d5a794469
2 ファイル変更、50 行追加、20 行削除
  1. 49 20
      README.md
  2. 1 0
      SUMMARY.md

+ 49 - 20
README.md

@@ -5,22 +5,32 @@ Recreating **Turbo Pascal 3.0** (shell, editor, compiler, interpreter) in
 and behaviours are reconstructed from the disassembled TP3.0 source
 (`Resources/`) and the reference manual.
 
-## Status
-
-| Milestone | Tag | Status |
-|---|---|---|
-| Main-menu shell | `v0.1-shell` | done |
-| WordStar-style editor | `v0.2-editor` | done |
-| Shell/editor polish (Ctrl-K-D quit) | `v-TP3-SHELL-EDITOR-QUIT` | done |
-| Compiler skeleton + two-phase build | `v-TP3-SHELL-COMPILES` | done |
-| Parser `Skip` bug class (9 sites) | `v-TP3-PARSER-FIXES` | done |
-| Standard procedures + `rel16` fix | `v-TP3-STDPROCS` | done |
-| Runtime blob, linker, `CmdRun` interpreter | — | **not started** |
-
-Current state: `tpshell` builds clean (120792 bytes); the compiler front end
-parses and emits 8086 for 17 of 23 fixtures, verified by hex-dumping the
-image. **No compiled program has been executed yet** — `CmdRun` is a stub and
-the runtime blob does not exist. See `SUMMARY.md` for the verified detail.
+## State
+
+**Where things are: `SUMMARY.md`.** It holds the milestone table, the list of
+checks and what each one cannot see, and the numbers behind every claim.
+
+There used to be a milestone table here as well, and it drifted six milestones
+behind while still reading as authoritative: it said "no compiled program has
+been executed yet" and "`CmdRun` is a stub and the runtime blob does not exist"
+through five tagged milestones in which those three things all became true. A
+second copy of a status table is a claim about the world that expires silently
+and is never noticed expiring, so there is one now, and this file says where it
+is.
+
+In short, current as of `v-TP3-BP-CONTRACT`:
+
+- The shell and the WordStar-style editor are done.
+- The compiler front end and 8086 code generator are done for the language
+  subset the fixtures cover, and the emitted `.COM` images **run**: 21 fixtures
+  boot in `qemu-system-i386` and print exactly their expected bytes, and 35
+  further cases call the runtime's own entries directly.
+- **The shell's `R` key is still a stub.** There is no in-process 8086
+  interpreter, so nothing runs a `.COM` from inside `tpshell` itself; execution
+  happens only under the test harness.
+- `string` *variables*, nested procedures, `var` parameters, range and index
+  checks, typed constants and `array` at its point of use are not implemented.
+  `SUMMARY.md` lists them with the reason for each.
 
 ## Build
 
@@ -35,6 +45,9 @@ make
 
 The shell runs in raw mode: it needs a real ANSI terminal, no wrappers.
 
+To run the checks: `cd shell && bash tests/run_all.sh`. It is not part of
+`make`, because it needs qemu and takes a few minutes.
+
 ## Layout
 
 - `shell/Term.def|mod` — raw termios keyboard + ANSI screen primitives
@@ -49,12 +62,28 @@ The shell runs in raw mode: it needs a real ANSI terminal, no wrappers.
 - `shell/Editor.def|mod` — WordStar-style full-screen editor.
 - `shell/Shell.mod` — TP3.0 main-menu dispatcher (`kmenu`/`kcmdtab`),
   work-file load/save with `.BAK` rotation, directory listing, options menu.
-- `shell/Makefile` — see notes below.
-- `SUMMARY.md` — state summary and reflection notes per milestone.
+- `shell/Compiler.def|mod` — lexer, parser, symbol table and the 8086 code
+  generator. `Compiler.CodeByteAt` exists so a test can read the emitted image.
+- `shell/Runtime.def|mod` — the 8086 runtime library, built as a byte blob at
+  run time and copied to the front of every image. Its entries are addressed by
+  name from `Runtime.def`; the emitter procedures are audited name-against-decode.
+- `shell/Linker.def|mod` — assembles `[JMP rel16][runtime][header][program]`
+  and writes a real DOS `.COM` when the Destination option is `COM`.
+- `shell/Makefile` — the authoritative build recipe; two-phase link, see
+  `SUMMARY.md`.
+- `shell/tests/` — the harnesses. `run_all.sh` runs them, `nonvacuity.sh`
+  proves each one can go red. `tests/fixtures/expected.tsv` is the live
+  fixture matrix and is asserted against, not copied into prose.
+- `SUMMARY.md` — **the state document**: milestones, checks, numbers, and what
+  is still missing.
+- `TP3-COMPILER.md` — how the compiler works, the build recipe, and the
+  codegen bug classes with their fixes.
+- `TP3-EDITOR.md` — the editor's key handling and screen layout.
 - `RESUME-TP3.md` — book-derived reference for the 8086 code the TP3 compiler
   generates (source of the compiler phase).
 - `Resources/` — OCR of "Au coeur de Turbo Pascal", TP3.0 manual and the
-  disassembled TPSRC1-10.
+  disassembled TPSRC1-10. **The disassembly is the ground truth**: when our
+  behaviour and the book disagree, the disassembly wins.
 
 ## Shell (TP3.0 main menu)
 
@@ -71,7 +100,7 @@ Exact TP3.0 screen: `Logged drive`, `Active directory`, `Work file`,
 | `M` | set main file |
 | `E` | edit work file |
 | `C` | compile (wired: TP3 error report + editor jumps to the error) |
-| `R` | run — **stub**, prints "Interpreter pending" |
+| `R` | run — **stub**, prints `Interpreter pending - compiled code is in memory` |
 | `S` | save with `^Z` EOF; old version → `.BAK` |
 | `D` | directory listing, DOS `*.*` mask, `k bytes free` |
 | `O` | options submenu (compile target, Code/Data/Stack, params) |

+ 1 - 0
SUMMARY.md

@@ -21,6 +21,7 @@ manual, not guessed.
 | Linker: real DOS `.COM` writer + independent byte checker | `v-TP3-COM-IMAGE` | done, executed |
 | Measured encodings: ModR/M table, runtime audit, golden disassembly, `[BP+off]` | `v-TP3-MEASURED-EMITTERS` | done, executed |
 | Execution: a boot sector, qemu, and a claim about behaviour | `v-TP3-EXECUTION` | done, **21/21 fixtures run, exact output** |
+| Runtime entries under qemu, and the register contract stated | `v-TP3-BP-CONTRACT` | done, **36/36 entry checks; `wrchar`/`wrbool` no longer destroy BP** |
 | `CmdRun` (the `R` key), in-process 8086 interpreter | — | **not started** |
 
 ## Build