|
|
@@ -10,9 +10,9 @@ native GNU Modula-2 on top of `Term.mod`). That is a separate piece of work and
|
|
|
separate session; nothing here changes it, and nothing here depends on it.
|
|
|
|
|
|
The measurements were taken against the tree at tag `v-TP3-INTERRUPT-RESTORE`
|
|
|
-(`2ae00d1`); the ladder and the stages have moved on since (HEAD is
|
|
|
-`v-TP3-CALC-FILES`, and §1's rung table and the "Session state" section are the
|
|
|
-current figures).
|
|
|
+(`2ae00d1`); the ladder and the stages have moved on since (the layout rung is
|
|
|
+tagged `v-TP3-CALC-LAYOUT`, and §1's rung table and the "Session state" section
|
|
|
+are the current figures).
|
|
|
|
|
|
---
|
|
|
|
|
|
@@ -97,7 +97,7 @@ Current rung (measured today, normalised position):
|
|
|
|
|
|
| position | blocker |
|
|
|
|---|---|
|
|
|
-| **18267** | `Write(Value:FW:DEC)` in `GotoCell` — REAL output/arithmetic (`ERR 102`) |
|
|
|
+| **22253** | `function Exist(FileN : AnyString): boolean;` — function declarations/returns (`ERR 1`) |
|
|
|
|
|
|
Rungs behind it (now passed):
|
|
|
|
|
|
@@ -124,12 +124,15 @@ Rungs behind it (now passed):
|
|
|
| 15201 | string field through DI | `<len><chars>`, truncated (`t79_strfield`) |
|
|
|
| 15272 | REAL constants and copies | measured MBF, 6-byte stores (`t80_realconst`) |
|
|
|
| 15911 | `UpCase` + run-time `in` | set fields through DI in WRITE (`t81`, `t82`) |
|
|
|
+| 18267 | `Write(Value:FW:DEC)` — REAL output | `real_write` (`t84`) |
|
|
|
+| 19847 | run-time set algebra / `Succ` / `Pred` | `set_op`/`set_cmp`/`copy` (`t85`, `t86`) |
|
|
|
+| 20912 | the fixed 4 KiB code window | original layout: code-only `.COM`, high zeroed data base (§3.2) |
|
|
|
|
|
|
Rungs ahead:
|
|
|
|
|
|
| position | blocker |
|
|
|
|---|---|
|
|
|
-| 18267 | REAL output (`FW:DEC`) and real arithmetic; then the rest of the evaluator |
|
|
|
+| 22253 | function declarations/returns (`Exist`), then the rest of CALC's functions |
|
|
|
|
|
|
Corrections the measurements force, worth stating plainly because the stage list
|
|
|
below was written before them:
|
|
|
@@ -210,20 +213,20 @@ predefined constants `true`/`false` (both work today).
|
|
|
|
|
|
---
|
|
|
|
|
|
-## 3. Structural blocker: the memory layout is inverted
|
|
|
+## 3. Structural blocker: the memory layout (RESOLVED 2026-10-22)
|
|
|
|
|
|
-This is not a feature; it is a **hard prerequisite**. CALC's code is 16,560
|
|
|
-bytes (§3.1, measured) and this port refuses to emit more than 4,096. It has
|
|
|
-to be settled as one of the first things, not "before the fifth stage" —
|
|
|
-until it moves, every later stage can only be developed on fixtures a fraction
|
|
|
-of CALC's size, and the ladder cannot advance past the first few rungs.
|
|
|
+This was a **hard prerequisite**: CALC's code is 16,560 bytes (§3.1,
|
|
|
+measured) and the old port refused to emit more than 4,096. **It is now
|
|
|
+resolved; the implementation is in §3.2.** The paragraphs below are the
|
|
|
+historical diagnosis and the reference measurements, kept because they explain
|
|
|
+why the old fixed 4 KiB split was not a capacity problem but a layout one.
|
|
|
|
|
|
-**What this port does today.** `pc` starts at `rtSz` (773) and
|
|
|
-`dataBase := rtSz + 1000H` (4869). Code occupies `[rtSz, dataBase)` and data
|
|
|
-occupies `[dataBase, …)`. The *data* sits above the *code*, so the enforced
|
|
|
-limit is **code ≤ 4 KiB**, reported as TP3 error 98 by `Ebyte` and pinned by
|
|
|
-`t43_codewindow` (`v-TP3-CODEWINDOW`). `MaxCode` is 24,000, so the buffer is
|
|
|
-not the constraint — `dataBase` is.
|
|
|
+**What this port did before the change.** `pc` started at `rtSz` (773) and
|
|
|
+`dataBase := rtSz + 1000H` (4869). Code occupied `[rtSz, dataBase)` and data
|
|
|
+occupied `[dataBase, …)`. The *data* sat immediately above the *code*, so the
|
|
|
+enforced limit was **code ≤ 4 KiB**, reported as TP3 error 98 by `Ebyte` and
|
|
|
+pinned by `t43_codewindow` (`v-TP3-CODEWINDOW`). `MaxCode` is 24,000, so the
|
|
|
+buffer was not the constraint — `dataBase` was.
|
|
|
|
|
|
**What the original does.** `TPSRC7:81-82`:
|
|
|
|
|
|
@@ -330,44 +333,40 @@ recipe above regenerates them, and the numbers are what this document keeps.
|
|
|
|
|
|
**Consequences for this port:**
|
|
|
|
|
|
-1. **Q1 is answered.** The original keeps the data area *below* the program
|
|
|
- code, so the binding limit is data running into the code base — the exact
|
|
|
- opposite of this port, whose `dataBase := rtSz + 1000H` caps **code at
|
|
|
- 4 KiB**. CALC's code is **16,560 bytes**, so the port cannot emit it at all
|
|
|
- today; this is a hard prerequisite, not a nice-to-have.
|
|
|
-2. **`MaxCode = 24,000` is not the binding constraint.** 16,560 + 773 (our
|
|
|
- runtime) = 17,333, comfortably inside 24,000. It is `dataBase` alone that
|
|
|
- must move, and the fix has to be an orientation/layout change rather than a
|
|
|
- bigger buffer — which is what `t43_codewindow` was built to police.
|
|
|
+1. **Q1 is answered — and the first reading was wrong.** The original does
|
|
|
+ **not** put the data area below the code in one segment. `pc` is a **CS**
|
|
|
+ offset (`0x2D7C`) and `dc` is a **DS** offset (`0x0240`): `TPSRC1`'s
|
|
|
+ `initmem` computes `DS = CS + [inline+6]` and puts the heap/stack above the
|
|
|
+ DS data area. Code and data live in **separate segments**, so neither can
|
|
|
+ grow into the other. CALC's code is **16,560 bytes**, which the old fixed
|
|
|
+ 4 KiB window could not emit; that was a port artefact, not a TP3 limit.
|
|
|
+2. **`MaxCode = 24,000` is not the binding constraint for the compile goal.**
|
|
|
+ 16,560 + 3,667 (our current runtime) = 20,227, comfortably inside 24,000.
|
|
|
+ The old `dataBase` alone had to move; `t43_codewindow` was the fixture that
|
|
|
+ policed it and has been re-baselined (§3.2).
|
|
|
3. **The §3 data budget is confirmed, not inferred.** Reported data is
|
|
|
12,032 B against a computed 11,760 B for `Sheet` alone (147 × 80 B
|
|
|
`CellRec`), so the 80-byte `CellRec` sizing is right and the rest
|
|
|
(`Line`, `FileName`, the file variables, scalars) accounts for ~272 B.
|
|
|
4. **TP3's memory model has code and data in separate address spaces**
|
|
|
(`cs 0x0813` vs `ds 0x11D7` in the header, and separate "free" figures).
|
|
|
- A `.COM` collapses them to one segment, so we have to choose one contiguous
|
|
|
- layout; the measurements bound what we must allow: **≥ 16,560 B of code and
|
|
|
- ≥ 12,032 B of data**, with 16,384 B of stack and a heap large enough for
|
|
|
- `Pages` (16,281 B, §3).
|
|
|
-5. **The runtime is 11,341 bytes** in the original. Ours is 773 B. Not needed
|
|
|
- for this goal, but it explains where the original's fixed `pc := $2D7C` /
|
|
|
- `dc := $0240` came from, and why `TPSRC7:81-82` looks the way it does.
|
|
|
-
|
|
|
-**Feasibility, now checkable.** A `.COM` is one 64 KiB segment holding
|
|
|
-`[runtime][code][data]`, with the heap growing up and the stack growing down
|
|
|
-out of what is left. Using the measured figures:
|
|
|
-
|
|
|
-| | runtime | + code | + data | left for heap+stack | after `Pages` (16,281 B) |
|
|
|
-|---|---|---|---|---|---|
|
|
|
-| original | 11,341 | 16,560 | 12,032 | 25,603 | 9,322 for stack |
|
|
|
-| this port | 773 | 16,560 | 12,032 | **36,171** | **19,890** for stack |
|
|
|
-
|
|
|
-So the goal is arithmetically reachable, and the original *proves* it is
|
|
|
-reachable with 10,568 bytes less room than we have — our runtime is that much
|
|
|
-smaller. There is no capacity reason to doubt the layout fix; the only
|
|
|
-question is which of the two orientations to implement. The same table shows
|
|
|
-`MaxCode = 24,000` is fine with 7,440 to spare, and that `TextLimit`'s 488
|
|
|
-bytes of slack (§5) is the one genuinely tight number in the whole budget.
|
|
|
+ The inline `initmem` parameters measure **CS size `06E0h` (28,160 B)**,
|
|
|
+ **DS size `0315h` (12,624 B)**, and **heap/stack `0400h` (16,384 B)**, with
|
|
|
+ `A000h` as the maximum (640 KiB, in paragraphs). A `.COM` still uses
|
|
|
+ separate CS/DS segments; the original proves it.
|
|
|
+5. **The runtime is 11,341 bytes** in the original. Ours is 3,667 B. It
|
|
|
+ explains where the original's fixed `pc := $2D7C` / `dc := $0240` came
|
|
|
+ from, and why `TPSRC7:81-82` looks the way it does.
|
|
|
+
|
|
|
+**Feasibility.** The original's total CS+DS+heap/stack is
|
|
|
+28,160 + 12,624 + 16,384 = 57,168 B, inside the 640 KiB DOS arena because the
|
|
|
+segments are separate. Our boot harness is flat, so the equivalent properties
|
|
|
+are: **code-only `.COM`**, globals outside the file at a fixed high image
|
|
|
+offset, and `initmem` zeroing them. That is what §3.2 implements. It is enough
|
|
|
+to **compile** CALC; running it with the original 16,384-byte minimum stack
|
|
|
+plus the 16,281-byte `Pages` heap is a separate capacity question (the fixed
|
|
|
+data base leaves ~20,478 B between the data end and the stack, not 32,665),
|
|
|
+and is explicitly deferred — the stated goal is the compiler verdict.
|
|
|
|
|
|
**Still open from this experiment:** whether *memory-mode* compilation of CALC
|
|
|
reports "Compiler Overflow #99" as the banner warns. That is one more run of
|
|
|
@@ -381,6 +380,51 @@ each other). They are *not* the code and data sizes, so the book's field list
|
|
|
should not be trusted here — the statistics line and the file layout above are
|
|
|
the authoritative numbers.
|
|
|
|
|
|
+### 3.2 Layout landed (2026-10-22)
|
|
|
+
|
|
|
+The implementation is a **flat-segment equivalent of the original's CS/DS
|
|
|
+separation**, not a literal second segment: the boot harness loads one segment
|
|
|
+and the INT 21h stdin descriptor lives in it, so a separate DS would require
|
|
|
+re-basing every absolute data reference in the compiler and runtime. The
|
|
|
+properties that matter for the compile goal are preserved:
|
|
|
+
|
|
|
+| property | original | this port after the change |
|
|
|
+|---|---|---|
|
|
|
+| `.COM` contents | runtime + program code (CS), no data | runtime + program code, no data |
|
|
|
+| entry | `E9 rel16` over the runtime | `E9 rel16` over the runtime + 16-byte header |
|
|
|
+| globals | separate DS, offsets from `dc` | fixed image `DataStart = 8000h` (memory `8100h`) |
|
|
|
+| globals zeroed | DS data area | `initmem` zeroes `[hdrDS,hdrHeap)` |
|
|
|
+| code limit | CS capacity | `MaxCode = 24,000` (and `CodeMax = 6F00h` before the stdin descriptor) |
|
|
|
+| data limit | DS capacity | address space below the stack |
|
|
|
+| heap/stack | above DS | above `hdrHeap`, down from `SP=FFFEh` |
|
|
|
+
|
|
|
+`Linker.LinkSize` is now `ImageBytes()`, so the file ends at `hdrCS`; it is not
|
|
|
+padded to the data base. `comimage.find_header` locates the header from the
|
|
|
+entry jump (`target - 16`) and requires `hdrDS = 8100h`, `hdrHeap > hdrDS`, and
|
|
|
+`hdrCS - bias == file length`. `t43_codewindow` no longer measures the old
|
|
|
+window: with the data out of the way it reaches the **4,096-byte string pool**
|
|
|
+first and is re-baselined to **`ERR 99 5093`** (reported overflow, not silent
|
|
|
+truncation). The code window itself is pinned by the independent `.COM`
|
|
|
+checker and by every executed fixture.
|
|
|
+
|
|
|
+**Verification against `Resources/TP3/CALC.COM`:**
|
|
|
+
|
|
|
+```
|
|
|
+size 0x6CFD (27,901 B)
|
|
|
+entry E9 4A 2C -> program at 0x2C4D
|
|
|
+runtime in file 0x2C4D (11,341 B)
|
|
|
+program code 0x40B0 (16,560 B)
|
|
|
+inline initmem mode 0006, CS 0813, DS 11D7,
|
|
|
+ CS size 06E0, DS size 0315,
|
|
|
+ heap/stack 0400, max A000
|
|
|
+```
|
|
|
+
|
|
|
+The file is runtime + code, exactly the shape we now emit; the data is in the
|
|
|
+separate DS described by the inline parameters. Our CALC image will be smaller
|
|
|
+in runtime (3,667 B instead of 11,341 B) but has the same code-only, high-data
|
|
|
+shape. The ladder moved **20,912 → 22,253** on this change; the next blocker is
|
|
|
+not layout but `function Exist(FileN : AnyString): boolean;`.
|
|
|
+
|
|
|
---
|
|
|
|
|
|
## 4. Ordered stages
|
|
|
@@ -392,26 +436,25 @@ parallel:
|
|
|
position in CALC and needs no memory-layout change to be developed or
|
|
|
verified — every feature can be exercised on a fixture far smaller than
|
|
|
4 KiB of code.
|
|
|
-- **The layout track** (Stage 16, §3) is the only thing that stops the
|
|
|
- compiler from *emitting* the whole program once the front end accepts it.
|
|
|
- It does not block the ladder, but it is a hard prerequisite for the goal as
|
|
|
- stated, and it changes `dataBase`/`t43_codewindow` — so it belongs to one
|
|
|
- commit of its own, with the re-baselining reasoned in the message.
|
|
|
+- **The layout track** (Stage 16, §3) was the hard prerequisite for
|
|
|
+ *emitting* the whole program once the front end accepts it. **It is DONE**
|
|
|
+ (`v-TP3-CALC-LAYOUT`, §3.2); the ladder is now front-end-bound again.
|
|
|
|
|
|
Ordering rule within the ladder: cheapest-and-most-independent first, then the
|
|
|
ladder order (each stage removes the blocker the previous one exposed).
|
|
|
|
|
|
### Session state — where to resume
|
|
|
|
|
|
-Last touched 2026-10-21. **Twenty-six 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, the CASE
|
|
|
-labels, variable array subscripts, write field widths, WITH with
|
|
|
-n-dimensional subscripts, set-field assignment, string fields through DI, REAL
|
|
|
-constants, UpCase, run-time set membership, and string fields in WRITE). The
|
|
|
-ladder row has moved from the first typed constant at 7791 to **18267, inside
|
|
|
-`CALC.INC`'s `GotoCell` — `Write(Value:FW:DEC)`, real output**.
|
|
|
+Last touched 2026-10-22. The rungs listed below are landed (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, the CASE labels, variable array
|
|
|
+subscripts, write field widths, WITH with n-dimensional subscripts, set-field
|
|
|
+assignment, string fields through DI, REAL constants, UpCase, run-time set
|
|
|
+membership, string fields in WRITE, real output, run-time set algebra,
|
|
|
+`Succ`/`Pred`, and the original memory layout). The ladder has moved from the
|
|
|
+first typed constant at 7,791 to **22,253**, where the first **function**
|
|
|
+declaration appears.
|
|
|
|
|
|
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
|
|
|
@@ -445,12 +488,13 @@ Exec86):
|
|
|
| `a2e5e69` | `v-TP3-CALC-STRFIELD` | `ERR 102 15272` (REAL field) |
|
|
|
| `0946e80` | `v-TP3-CALC-REALCONST` | `ERR 41 15911` (`Upcase`) |
|
|
|
| `17f7f7c` | `v-TP3-CALC-UPCASE` | **`ERR 102 18267`** (real output) |
|
|
|
+| `203f77e` | `v-TP3-CALC-SETOPS` | `ERR 98 20912` (layout limit reached) |
|
|
|
+| *(this commit)* | `v-TP3-CALC-LAYOUT` | **`ERR 1 22253`** (function declarations) |
|
|
|
|
|
|
-- **Code HEAD** `c92d2a8` (`v-TP3-MBF-MUL`); this commit only updates this
|
|
|
- document. Nothing pushed; `origin/master` is behind by twenty-two 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`.
|
|
|
+- **Code HEAD** is the layout rung (`v-TP3-CALC-LAYOUT`). Nothing is pushed.
|
|
|
+ The terminal-config work (`v-TP3-TERMCFG`) and the editor key map
|
|
|
+ (`v-TP3-EDITORKEYS`) are non-ladder commits in the same period and are
|
|
|
+ documented in `TERMINAL.md`.
|
|
|
- **The measuring device:** `tests/fixtures/calc_ladder.tsv` +
|
|
|
`tests/calc_ladder.sh`, wired into `run_all.sh` as `CALC ladder`. The row may
|
|
|
only move forward; every move is recorded in the tsv next to the blocker.
|
|
|
@@ -550,10 +594,10 @@ Exec86):
|
|
|
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 **87/87**, CALC ladder **1/1** at
|
|
|
- `ERR 98 20912`, terminal config **4/4**, 78 `.COM` linked and **76 executed
|
|
|
+ `ERR 1 22253`, terminal config **4/4**, 78 `.COM` linked and **76 executed
|
|
|
under both qemu and Exec86** (`t64_arrays` remains compile-only because it
|
|
|
has no `.out`). `tests/nonvacuity.sh`: **121 ok, 0 failed**. The runtime is
|
|
|
- 3664 bytes (wrintw, real_from_int, real_add, real_sub, real_mul, real_div,
|
|
|
+ 3,667 bytes (wrintw, real_from_int, real_add, real_sub, real_mul, real_div,
|
|
|
real_cmp, real_int, real_fmt, real_val, real_write, set_op, set_cmp,
|
|
|
set_copy; the golden was re-blessed) and `tests/rt_exec.py` passes
|
|
|
**275/275**, including the MBF arithmetic/output/parse cases and eleven
|
|
|
@@ -650,12 +694,10 @@ commit.
|
|
|
|
|
|
Then the two that are *outside* the ladder and gate the goal as stated:
|
|
|
|
|
|
-12. **The layout change (§3)** — re-orient the image so the compiler can emit
|
|
|
- CALC's **16,560 bytes** of code and hold **12,032 bytes** of data; the
|
|
|
- port's `dataBase := rtSz + 1000H` caps code at 4 KiB. Decide "match the
|
|
|
- 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.
|
|
|
+12. **The layout change (§3) — DONE** (`v-TP3-CALC-LAYOUT`). The `.COM` is
|
|
|
+ code-only; globals are at image `8000h` and `initmem` zeroes them. CALC's
|
|
|
+ 16,560 bytes fit the 24,000-byte code buffer, and `t43_codewindow` is
|
|
|
+ re-baselined to the string-pool overflow it now reaches (`ERR 99 5093`).
|
|
|
13. **Write field widths — DONE for integers** (`v-TP3-CALC-WIDTH`, entry 20
|
|
|
`wrintw`). **Still open:** `Real:width:decimals` (CALC's
|
|
|
`Value:FW:DEC`, which waits for real support) and widths on
|
|
|
@@ -764,20 +806,19 @@ Then the two that are *outside* the ladder and gate the goal as stated:
|
|
|
`>`, `>=` and set-expression assignment all work. `Succ`/`Pred` were
|
|
|
the next blocker and are now builtins too. Fixtures
|
|
|
`t85_setops`/`t86_succ`.
|
|
|
- * **NEXT BLOCKER: THE §3 LAYOUT.** CALC now reaches 20912 and fails
|
|
|
- with TP3 error **98 (memory overflow)**: the compiler reserves a
|
|
|
- FIXED 4 KiB code window above the runtime (`dataBase`), and CALC's own
|
|
|
- code has reached it. This is not a missing construct; code and data
|
|
|
- cannot share the 64 KiB .COM segment with a static 4 KiB split.
|
|
|
- Re-orienting the image (data after the actual code, or a far model)
|
|
|
- is the layout change item 12, and is the next rung.
|
|
|
- * **STILL TO COME:** `Str`/`Val` wiring, then real expressions (a 6-byte
|
|
|
- temporary/value model), real comparisons and real function results.
|
|
|
- * **HEADROOM:** the runtime is 3664 bytes and the probe's scaffold starts
|
|
|
- at HDR=0x1100 with RT_BASE=0x0190, so the ceiling is 3952 bytes - about
|
|
|
- 288 bytes left. The boot read allows a .COM up to 0x6F00, so the next
|
|
|
- additions can move HDR again (e.g. 0x2000) with plenty of room below
|
|
|
- the input at 0x7000.
|
|
|
+ * **DONE: THE §3 LAYOUT** (`v-TP3-CALC-LAYOUT`, see §3.2). The `.COM`
|
|
|
+ is code-only, globals live at image `8000h` and are zeroed by
|
|
|
+ `initmem`, and the 4 KiB window is gone. CALC moved
|
|
|
+ **20912 -> 22253**; the new blocker is a **function declaration**,
|
|
|
+ `function Exist(FileN : AnyString): boolean;`, not a layout limit.
|
|
|
+ * **STILL TO COME:** function declarations/returns, then `Str`/`Val`
|
|
|
+ wiring, real expressions (a 6-byte temporary/value model), real
|
|
|
+ comparisons and real function results.
|
|
|
+ * **HEADROOM:** the runtime is 3,667 bytes and the probe's scaffold
|
|
|
+ starts at HDR=0x1100 with RT_BASE=0x0190, so the ceiling is 3,952
|
|
|
+ bytes - about 285 bytes left. The boot read allows a .COM up to
|
|
|
+ 0x6F00, so the next additions can move HDR again (e.g. 0x2000) with
|
|
|
+ plenty of room below the input at 0x7000.
|
|
|
* **Exec86** needed the FE group (INC/DEC r/m8) and CMC/CLC/STC/LAHF/
|
|
|
SAHF for the formatter; t84 is the first fixture that executes the
|
|
|
real conversion under the interpreter, and it cross-checks qemu.
|
|
|
@@ -803,8 +844,9 @@ Then the two that are *outside* the ladder and gate the goal as stated:
|
|
|
that emit such data are listed in `CODE_RESIDENT_CONST` and the clause is
|
|
|
skipped for them.
|
|
|
|
|
|
-**Still open from the plan (§6):** the layout decision above, and Q6 (one
|
|
|
-memory-mode `TURBO` run in dosemu to see whether CALC reports overflow #99).
|
|
|
+**Still open from the plan (§6):** Q6 (one memory-mode `TURBO` run in dosemu to
|
|
|
+see whether CALC reports overflow #99), and the run-time capacity note in
|
|
|
+§3.2. The layout decision is closed.
|
|
|
|
|
|
The per-stage entries below are the historical record of how each landed.
|
|
|
|
|
|
@@ -1085,13 +1127,15 @@ callee's parameters must agree with Stage 10's 2-vs-4-byte accounting, so land
|
|
|
this after parameters — or land the symbol-visibility half first and gate the
|
|
|
rest.
|
|
|
|
|
|
-**Stage 16 — the layout (§3, the layout track).** Re-orient the image so the
|
|
|
-compiler can emit **16,560 B of code** and hold **12,032 B of data** (both
|
|
|
-measured, §3.1), choosing between the two candidate fixes in §3 and
|
|
|
-re-baselining `t43_codewindow` in the same commit. This is the only stage that
|
|
|
-blocks the *goal* rather than the ladder. Then capacity (§5), which follows
|
|
|
-from it: `TextLimit` is 488 bytes from overflowing and should rise with the
|
|
|
-include stage.
|
|
|
+**Stage 16 — the layout (§3, the layout track). DONE
|
|
|
+(`v-TP3-CALC-LAYOUT`).** The data area is no longer immediately above the
|
|
|
+code: globals live at image `8000h` (memory `8100h`), `initmem` zeroes them,
|
|
|
+and the `.COM` is code-only (`LinkSize = ImageBytes`). This emits CALC's
|
|
|
+measured 16,560 B of code inside the 24,000-byte code buffer and removes the
|
|
|
+4 KiB window. `t43_codewindow` is deliberately re-baselined (`ERR 99 5093`,
|
|
|
+the 4 KiB string pool, not the old window); the layout itself is pinned by
|
|
|
+the independent `.COM` checker. See §3.2 for the CALC.COM comparison and the
|
|
|
+remaining run-time capacity note.
|
|
|
|
|
|
---
|
|
|
|
|
|
@@ -1100,9 +1144,9 @@ include stage.
|
|
|
| limit | value | CALC needs | verdict |
|
|
|
|---|---|---|---|
|
|
|
| `TextLimit` (source buffer) | 62,903 | `CALC.PAS` + `CALC.INC`, normalised = **62,415** | **488 bytes of slack** |
|
|
|
-| `MaxCode` | 24,000 | **16,560 B** (measured, §3.1) | enough in itself; `dataBase`'s 4,096 B window is the blocker (§3) |
|
|
|
-| code window (`dataBase − rtSz`) | 4,096 | ≥ 16,560 | **must change orientation** (§3) |
|
|
|
-| data area | unbounded past `dc` | **12,032 B** (measured, §3.1) | must be able to hold it under/over the code |
|
|
|
+| `MaxCode` | 24,000 | 16,560 B program + 3,667 B runtime = **20,227 B** | **OK, 3,773 B spare** (§3.2) |
|
|
|
+| code window | `CodeMax = 6F00h`, capped by `MaxCode` | 20,227 B | **OK**; no data gap (§3.2) |
|
|
|
+| data area | fixed image `8000h`, zeroed by `initmem` | **12,032 B** (measured, §3.1) | **OK for compile**; see the run-time cargo note (§3.2) |
|
|
|
| stack | 16,384 min / 655,360 max | 16,384 min | matches the original's `minstk`/`maxstk` |
|
|
|
| `MaxSym` | 3,000 | 47 routines + locals + params | **inferred** OK, verify |
|
|
|
| `strOff`/`strLen` | `[0..255]` | 57 distinct string literals (67 occurrences) | OK |
|
|
|
@@ -1119,11 +1163,11 @@ as the include, because the include is what consumes the slack.
|
|
|
|
|
|
## 6. Open questions, each with a method
|
|
|
|
|
|
-- **Q1 — RESOLVED (§3.1).** The data area sits below the program code; the
|
|
|
- binding limit is data running into the code base, and this port has it the
|
|
|
- other way round. Remaining as a *decision*, not an unknown: implement
|
|
|
- "match the original" or "dynamic data base", and re-baseline
|
|
|
- `t43_codewindow` in the same commit.
|
|
|
+- **Q1 — RESOLVED (§3.1, §3.2).** The original keeps code and data in
|
|
|
+ **separate CS/DS segments**; `pc` and `dc` are offsets in different
|
|
|
+ segments, not two ends of one segment. Our flat boot harness emulates the
|
|
|
+ property with a code-only `.COM` and a fixed high global area zeroed by
|
|
|
+ `initmem`; the 4 KiB window is gone and `t43_codewindow` is re-baselined.
|
|
|
- **Q2.** Is `{$A-}` really a no-op for `TURBO.COM`? Check `TPSRC` for an `A`
|
|
|
directive before treating it as ignorable.
|
|
|
- **Q3.** `Pages = array[0..200] of string[80]` — confirm the element size is 81
|
|
|
@@ -1156,9 +1200,11 @@ as the include, because the include is what consumes the slack.
|
|
|
|
|
|
- Do not "support" a construct by parsing it and emitting nothing. That is the
|
|
|
`var`-parameter bug and the `{$I}` bug, and both were green.
|
|
|
-- Do not raise `dataBase`/`MaxCode` and call §3 solved; the orientation is the
|
|
|
- question, and `t43_codewindow` exists precisely to catch a silently corrupt
|
|
|
- image.
|
|
|
+- Do not put the data back immediately above the code, and do not pad the
|
|
|
+ `.COM` to the data base: §3 solved the compile goal by keeping the file
|
|
|
+ code-only and the globals at a zeroed high base. `t43_codewindow` is now a
|
|
|
+ string-pool fixture; the layout is pinned by the independent `.COM` checker,
|
|
|
+ not by that fixture.
|
|
|
- Do not implement BCD reals, `Pos`, `Concat`, `Round`, `Trunc` or `goto` for
|
|
|
this goal. CALC uses none of them.
|
|
|
- Do not let this plan absorb `CALC-PORT.md`. Same program, different target,
|