Browse Source

docs: record the array-subscript rung (ladder 14330)

CALC-COMPILE.md: the rung table gains v-TP3-CALC-ARRVAR (b41c669,
ERR 1 14330), the session state says twenty rungs, the baseline is the
run just made (76/76 compile, 65/65 executed under both oracles,
non-vacuity 96/96), and the next-session plan marks 1-D subscripts done
(2-D and `with` still open) and names write field widths as the next
rung.

SUMMARY.md: the intro now stops at ERR 1 14330 and lists variable array
subscripts among the landed features.
Eric Streit 2 ngày trước cách đây
mục cha
commit
4278c5cdf6
2 tập tin đã thay đổi với 34 bổ sung và 25 xóa
  1. 29 21
      CALC-COMPILE.md
  2. 5 4
      SUMMARY.md

+ 29 - 21
CALC-COMPILE.md

@@ -97,7 +97,7 @@ Current rung (measured today, normalised position):
 
 | position | blocker |
 |---|---|
-| **14195** | `XPos[Count]` in `DisplayP` — a variable array subscript (`ERR 102`) |
+| **14330** | `writeln(I:2)` in `DisplayP` — a write field width (`ERR 1`) |
 
 Rungs behind it (now passed):
 
@@ -117,12 +117,13 @@ Rungs behind it (now passed):
 | 12672 | `KeyPressed` | `INT 21h AH=0B`, in Exec86 and bootcom too |
 | 12901 | `var` parameters | by reference + DupTest shadowing (`t73_varparam`) |
 | 13052 | comma-separated CASE labels | plus real CASE ranges (`t74_caselist`) |
+| 14195 | variable array subscripts | scaled addressing, 1 byte or 2 (`t75_arrvar`) |
 
 Rungs ahead:
 
 | position | blocker |
 |---|---|
-| 14195 | variable array subscripts (scaled addressing); then the rest of `CALC.INC` |
+| 14330 | write field widths (`expr:width`); then the rest of `CALC.INC` |
 
 Corrections the measurements force, worth stating plainly because the stage list
 below was written before them:
@@ -396,13 +397,13 @@ ladder order (each stage removes the blocker the previous one exposed).
 
 ### Session state — where to resume
 
-Last touched 2026-10-21. **Nineteen rungs are landed across three sessions**
+Last touched 2026-10-21. **Twenty rungs are landed across three sessions**
 (Stages 1-4, sets, enums, record types, array declarations, element/field
 access, file types, the calling convention and string value parameters,
-`Length`, the CRT identifiers, `Kbd`, `KeyPressed`, `var` parameters, and the
-CASE labels).  The ladder row has moved from the first typed constant at 7791
-to **14195, inside `CALC.INC`'s `DisplayP` — `XPos[Count]`, a variable array
-subscript**.
+`Length`, the CRT identifiers, `Kbd`, `KeyPressed`, `var` parameters, the CASE
+labels, and variable array subscripts).  The ladder row has moved from the
+first typed constant at 7791 to **14330, inside `CALC.INC`'s `DisplayP` —
+`writeln(I:2)`, a write field width**.
 
 The rung commits and their tags, in order (each is one rung with its own
 fixture, red proof, and — where the harness allows — execution under qemu and
@@ -428,10 +429,11 @@ Exec86):
 | `89c6ca6` | `v-TP3-CALC-CRT2` | `ERR 41 12672` (`KeyPressed`) |
 | `033eb8e` | `v-TP3-CALC-KEYPRESSED` | `ERR 41 12901` (`IBMCh`'s `var` parameter) |
 | `5eb82c4` | `v-TP3-CALC-VARPARAM` | `ERR 1 13052` (comma-separated CASE labels) |
-| `8a265e7` | `v-TP3-CALC-CASELIST` | **`ERR 102 14195`** (variable array subscript) |
+| `8a265e7` | `v-TP3-CALC-CASELIST` | `ERR 102 14195` (variable array subscript) |
+| `b41c669` | `v-TP3-CALC-ARRVAR` | **`ERR 1 14330`** (write field width) |
 
-- **Code HEAD** `8a265e7` (`v-TP3-CALC-CASELIST`); this commit only updates
-  this document.  Nothing pushed; `origin/master` is behind by twelve code
+- **Code HEAD** `b41c669` (`v-TP3-CALC-ARRVAR`); this commit only updates
+  this document.  Nothing pushed; `origin/master` is behind by thirteen code
   commits.  Two non-ladder commits in the same period are the terminal-config
   work (`v-TP3-TERMCFG`) and the editor key map (`v-TP3-EDITORKEYS`); they do
   not move the ladder and are documented in `TERMINAL.md`.
@@ -533,10 +535,10 @@ Exec86):
   byte-for-byte the same for INTEGER locals, so the compile matrix would have
   been green and only `t40_readln` (and later CALC) would have noticed.
 - **Verified baseline, run on the code HEAD above:** `./tests/run_all.sh` →
-  **OVERALL: ALL PASS**, compile matrix **75/75**, CALC ladder **1/1** at
-  `ERR 102 14195`, terminal config **4/4**, 64 `.COM` linked and **64 executed
+  **OVERALL: ALL PASS**, compile matrix **76/76**, CALC ladder **1/1** at
+  `ERR 1 14330`, terminal config **4/4**, 64 `.COM` linked and **65 executed
   under both qemu and Exec86** (`t64_arrays` is compile-only: its image is past
-  the 8 KB boot-sector read).  `tests/nonvacuity.sh`: **95 ok, 0 failed**.
+  the 8 KB boot-sector read).  `tests/nonvacuity.sh`: **96 ok, 0 failed**.
 - **`tests/nonvacuity.sh`:** re-run after this commit's cases (the set
   membership bit among them); see the commit message for the count. It is not in
   the default `run_all.sh` and must be run **manually** after touching any check.
@@ -572,8 +574,8 @@ Exec86):
 
 ### Next session — the concrete plan
 
-The ladder is at `ERR 102 14195`, **`XPos[Count]`, a variable array
-subscript**.  Everything
+The ladder is at `ERR 1 14330`, **`writeln(I:2)`, a write field
+width**.  Everything
 below is ordered by what the ladder will hit next, not by the original stage
 numbers (the measurements have reordered them repeatedly).  Each item is the
 same shape as the rungs already landed: one focused change, one fixture that is
@@ -598,12 +600,12 @@ commit.
    `IoResult`; `read`/`write` with a leading file argument).  Runtime entries
    doing `INT 21h` open/create/read/write/close, text-mode newline and `^Z`.
    The file *types* and variables are already in place (`FileVarSize`).
-4. **Variable array subscripts — THE NEXT RUNG (14195).**  `XPos[Count]`,
-   `Sheet[FX,FY]`, `b[i]`: a constant index folds into `boff`, but a run-time
-   index needs the element size applied (`base + (i - lo) * elemsize`) before
-   the element's address is formed.  String subscripts already do the
-   one-byte case (v-TP3-STRIDX-VAR); arrays need the scale and the row stride
-   for the second dimension.  `with` follows on the same addressing work.
+4. **Variable array subscripts — DONE, 1-D** (`v-TP3-CALC-ARRVAR`): a
+   run-time index is `(i - lo) * elemsize` from the base, with the element's
+   address in DI; one and two bytes are loaded/stored.  **Still open:** a
+   SECOND run-time subscript (`Sheet[FX,FY]`, row stride) and a field of a
+   DI-addressed record, which need the element type to travel with the
+   expression.  `with` follows on the same addressing work.
 5. **Pointers and the heap** (`^T`, `New`, `Dispose`, `Buffer^[i]`), 4-byte
    (offset then segment); the heap must hold `Pages` (16,281 bytes).
 6. **`var` parameters by reference — DONE** (`v-TP3-CALC-VARPARAM`).  The slot
@@ -634,6 +636,12 @@ Then the two that are *outside* the ladder and gate the goal as stated:
     original" (data low, code high) vs a dynamic data base with fixups, and
     re-baseline `t43_codewindow` in the same commit.  This is the only stage
     that blocks *emitting* the whole program.
+14. **Write field widths — THE NEXT RUNG (14330).**  `writeln(I:2)`, then
+    `Real:width:decimals`.  IoCall parses the expression and then demands `,`
+    or `)`, so the `:` is ENoSemi.  The integer writer needs a width (pad with
+    spaces on the left); the real writer needs width and decimals.  A string's
+    width also pads/truncates.
+
 13. **Raise the execution harness's read.**  `tests/exec/bootcom.s` reads 16
     sectors (8192 bytes); `t64_arrays` is already compile-only for that reason,
     and CALC's measured `.COM` is **27,901 bytes**.  Without this, "executable

+ 5 - 4
SUMMARY.md

@@ -2037,16 +2037,17 @@ census of what `CALC.PAS` actually needs and the reference measurements from
 the original `TURBO.COM`. Two tracks run in parallel: the ladder (front-end,
 verifiable on small fixtures) and the layout (§3, the only thing that stops
 the compiler *emitting* a 16,560-byte program). The ratchet and front-end
-features through **comma-separated CASE labels** are landed: the ladder
+features through **variable array subscripts** are landed: the ladder
 (`tests/calc_ladder.sh` + `tests/fixtures/calc_ladder.tsv`, run by `run_all.sh`;
-CALC.PAS now stops at `ERR 102` at pos 14195, `XPos[Count]` in `DisplayP`), the `{$I}` include,
+CALC.PAS now stops at `ERR 1` at pos 14330, `writeln(I:2)` in `DisplayP`), the `{$I}` include,
 `^X`/`#nn`, scalar typed constants, sets, enums, records (CellRec = 80),
 subranges, arrays, element/field access, file types, string value parameters,
 `Length`, the CRT identifiers (`ClrScr`/`GotoXY`/`ClrEol`/`LowVideo`/
 `NormVideo`/`Delay`), `Kbd`, `KeyPressed` (`INT 21h AH=0B`), `var` parameters
 (by reference; `t73_varparam`), comma-separated CASE labels and real CASE
-ranges (`t74_caselist`), and `INT 10h`+`C6` in Exec86 (fixtures through
-`t74_caselist`). The next rung is variable array subscripts; then the remaining string
+ranges (`t74_caselist`), variable array subscripts scaled by the element size
+(`t75_arrvar`), and `INT 10h`+`C6` in Exec86 (fixtures through `t75_arrvar`).
+The next rung is write field widths; then the remaining string
 builtins, file operations, variable-index subscripts + `with`, pointers, `var`
 params, reals, recursion, and the layout change. Items 1-4 below are
 independent of both.