# VT26 — human API / ABI contract, source-exact donor member

**Member:** `lib-set-01/src/lib2/vt/26`  
**Adoption:** donor-exact Chapter 02 Extra x0.31a, PB-2000C emulator-bounded  
**Companion:** `API.json`; source remains the final authority. This document is **not** an assertion of general caller, AI-1000, or physical UART qualification.

## 1. Scope and entry points

`vt26.inc` defines a **stateful, non-reentrant** 24 x 80 text-document viewer for a 4 x 32 PB-2000C LCD window. It does not own the document, serial transport, emulator, firmware or surrounding application. The consumer links all three versioned files **and provides outside symbols**. Normal + inverse output is routed through `vt26_lcd.inc`. An app, not the viewer, responds to SEND event 8 and may use the transport-neutral `export.inc`.

Public and source-visible callable entry labels: `VT_BIND_RAM`, `VT_BIND_RO`, `VT_BIND_ROM`, `VT_BIND_RSEL`, `VT_GET_CHAR`, `VT_CLEAR`, `VT_WRITE`, `VT_INIT`, `VT_CONFIG`, `VT_VIEW`, `VT_OPEN`, `VT_OPEN_AT`, `VT_TX_ERROR`, `VT_EXPORT`; renderer helpers `VT26_PUTC`, `VT26_LCD_PUTZ`, `VT26_LCD_ROM32`, `VT26_GFX_PUTC`. Internal `_VT_*` labels are **not** stable library entry points. Not all entry labels have independent runtime qualification; the donor tested the linked application behavior as a whole.

## 2. Method matrix

| Method | Input / prerequisite | Result / effect |
|---|---|---|
| `VT_BIND_RAM`, `VT_BIND_RO`, `VT_BIND_ROM`, `VT_BIND_RSEL` | `$10/$11` = document base address; properly allocated `_VT_DOC_BASE`, `_VT_DOC_KIND` | Bind a 1,920-byte document view; type 0 writable RAM, 2 read-only RAM, 1 ROM or 3 selectable ROM. Clobbers `$0`, `IX` as source documents. |
| `VT_VIEW` | Bound document; caller workspace, callbacks, key/display services ready | Resets normal inverse/selection/navigation state and enters viewer; returns a semantic event in `$0`. |
| `VT_OPEN` | Existing valid bound document and navigation state | Opens/resumes viewer without resetting the chosen viewport; returns event in `$0`. |
| `VT_OPEN_AT` | `$8` selected row 1..24, document bound | Opens with selected row; invalid input returns `$0=10` without opening. |
| `VT_INIT`, `VT_CONFIG` | None documented beyond ordinary linkage | Both labels share an implementation returning `$0=1`; do not infer broader configuration behavior. |
| `VT_GET_CHAR` | `$2/$3` absolute bound document address | ASCII byte in `$16`; reads ROM versus RAM according to document kind; clobber `$0`, `IX` or `IZ`. |
| `VT_CLEAR` | Writable RAM kind 0 | Fills exactly 1,920 bytes with ASCII space; `$0=0` success, `$0=1` denied for non-writable types. |
| `VT_WRITE` | Source-inspected: `$8` 1-based row, `$9` column, `$10/$11` source pointer, `$12` source-kind selection, `$13` count; writable RAM kind 0 | Copy/clip operation; source returns `$0=0` normal, `$0=1` rejected/clipped. **Not independently tested as a general library method.** |
| `VT_EXPORT` (`export.inc`) | Bound document kind 0..3, `VT_EXP_*` workspace, `VT_OUTBYTE`, `VT_HOST_RAM`, `VT_GET_CHAR`; external serial lifecycle if used | Exactly 24 x (80 bytes + CR LF) = 1,968 bytes to byte sink on success; `$0=0` if accepted, nonzero on sink or binding failure. No serial open/close. |
| `VT_TX_ERROR` | Application-provided `VT_TX_DETAIL`; diagnostic input in `$1/$2/$3` where applicable | Dispatches to caller's unsupported-operation display; no UART operation. |
| `VT26_PUTC` and renderer helpers | `$6` LCD cell, `$16` character or `IZ` string data as relevant; `_VT_INV` allocated; LCD services available | Normal text or inverse DejaVu-derived 6 x 8 glyphs on LCD. **PB-2000C emulator donor evidence only.** |

## 3. Calling convention and returned events

The Chapter 02 native code is HD61700 assembly tested under HD61700 assembler Rev. 0.45. The donor's viewer returns semantic event `$0`: `0` Q / `:q`; `1` MENU; `2` BRK; `3` EXE selection when eligible; `4` `:c` action when eligible; `8` `:t` SEND request after capability check; `9` plain `c`/`C` application COMM event. Some app flow may use other events; **do not invent** an exhaustive universal event table. If SEND is reported, **caller** must dispatch UART, preserve/restore RAM bank, then call `VT_OPEN` to resume if desired. Inverse display state persists across the SEND/resume path, but clears on viewer exit.

Viewer commands include `:h` (three-page built-in help), `:i` (inverse display toggle), `:l` (jump 1..24 with blinking prompt), `:r` (redraw), `:s` (position), `:t` (send request), `:q` (exit); plain `u/d` page four rows, `t` top, `b` bottom. `:c` and EXE are caller-specific and document-kind-sensitive; `:v` / `:e` are not registered in this donor.

The **user guide R003** explains navigation semantics; it is not a guarantee every future consumer binds the same event actions or serial backend.

## 4. Environment, memory, and responsibility

**Document**: fixed 24 x 80 = 1,920 accessible contiguous bytes; caller owns contents, source type, alignment/bank residency, and correct access policy. On the donor, the canvas is a separate read-only RAM object. Do not overlap executable code, UART scratch, trampoline, source buffers or VT state. `VT_WRITE` / `VT_CLEAR` must not modify ROM or read-only canvas.

**Required VT state symbols**: `VT_SELECTED`, `_VT_DOC_BASE` (2 B), `_VT_DOC_KIND`, `_VT_TOP`, `_VT_LEFT`, `_VT_DPTR` (2 B), `_VT_DIDX`, `_VT_INVAL`, `_VT_INLEN`, `_VT_INV`, `_VT_LC_TICK`, `_VT_LC_VIS`; these are **caller-provided**, not allocated by the three `.inc` members.

**For export**: `VT_EXP_PTR` (2 B), `VT_EXP_COL`, `VT_EXP_ROW`; callbacks `VT_OUTBYTE` (input `$16`, return `$0` status), `VT_HOST_RAM` (restore host RAM/bank), and a selected `VT_GET_CHAR` path. `VT_SEND_CAP` returns nonzero to permit semantic SEND. Unsupported-operation path requires `VT_TX_DETAIL` (used by `VT_TX_ERROR`). `VT26_LCD_*` and `VT26_PUTC` depend on existing PB-2000C LCD services (`PUTC`, graphics-controller operations) and caller binding `_VT_INV`.

**Keyboard/platform glue**: source calls `K540_RAW`, `KEY_WAIT`, `INKEY`-derived or firmware-compatible key services; `SYS540_INIT`, `SYS540_HIDE`, `SYS540_STOP`, `SYS540_POLL`, `SYS540_TOGGLE`, `SYS540_PLACE`, `SYS540_SHOW`, plus `CUR_OFF`, `BLANK32` and required key/error constants. These labels **must be supplied or inherited from a compatible platform adapter**; the Chapter 02 `app/vt26_compat.inc`, `app/vt_port.inc` and `app/workspace.inc` are donor-specific **illustrative** bindings, not part of this admitted member. Check full transitive include closure at build time.

**RS232C boundary**: no direct RS232C code in the three files. Donor `:t` application integration uses **RS232C/2** and seven bytes of caller-owned `RS_SCRATCH_RAM`; old RS232C/1 fixed scratch at `27F0h..27F9h` collided with VT executable space and is **not** a safe drop-in replacement. A new consumer must inspect its memory map and serial capability and provide tested callbacks. Physical framing/receipt are outside current evidence.

**Rights**: renderer includes a DejaVu-derived independent bitmap table. Retain font attribution/appropriate license notices and review exact redistribution rights before any public package. Do not include DL-Pascal ROM/disassembly/fonts or Chapter 02 private teaching material.

## 5. Register effects

The member uses HD61700 general registers, pointer registers and caller-selected bank contexts. Explicit source-confirmed narrow examples: `VT_BIND_*` clobbers `$0` and `IX`; `VT_GET_CHAR` writes `$16` and clobbers `$0`, `IX` or `IZ`; `VT_EXPORT` returns `$0` and calls arbitrary consumer callbacks. Other general-register preservation, `UA`, `SX`, `SY`, stack depth and pointer restoration **are not guaranteed across the whole viewer**. `VT26_GFX_PUTC` documents internal push/pop preservation but that does **not** grant a full-VT ABI promise. Save anything a new consumer requires and audit link composition; there is no universal zero-clobber guarantee.

## 6. Errors and edge cases

- `VT_OPEN_AT` rejects row 0 or 25+ with `$0=10`; `:l` rejects out-of-range and missing entry.
- `VT_CLEAR` and `VT_WRITE` deny modifications of non-writable document kinds.
- `VT_EXPORT` propagates nonzero sink failure status and never trims 80-byte rows, and never performs UART open/close.
- `:t` asks `VT_SEND_CAP` and can be declined. It is **not** evidence that a receiver captured all 1,968 bytes; donor only owner-reported emulator behavior.
- Inverse LCD is visual only, does not mutate canvas/serial bytes; bit orientation was corrected in VT26 donor.
- Editor/Help/BRK/full input/serial/physical edge-case matrix is **not exhaustively certified**. Missing external symbols or RAM conflicts are a consumer build/integration failure, not a reason to patch immutable `/26/` source.

## 7. Minimal call pattern (illustrative, not a drop-in ROM)

```asm
; Caller first allocates all VT_* state / viewport / export RAM and
; defines K540_RAW, KEY_WAIT, SYS540_*, LCD, VT_SEND_CAP,
; VT_OUTBYTE, VT_HOST_RAM, VT_TX_DETAIL and application event routing.
; Source closure includes vt26.inc, vt26_lcd.inc and export.inc.

        LDW     $10,VT_CANVAS      ; caller-owned 1,920 B document
        CAL     VT_BIND_RO        ; source kind 2, read-only RAM
        CAL     VT_VIEW           ; returns semantic event in $0
        ; If $0 = 8, caller performs qualified serial session,
        ; invokes VT_EXPORT, restores bank and calls VT_OPEN.
        ; Other events return to caller's menu/application.
```

This sketch is a contract reminder, **not** a claimed assembled or tested new consumer. Follow the real Chapter 02 `app/vt_port.inc` call paths for the donor example.

## 8. Exact source identity and evidence inheritance

| Source | Bytes | SHA-256 |
|---|---:|---|
| `vt26.inc` | 29574 | `27dc76cdf8f34894b25991383e999ec52d03e0ba11e6489acfe847af6c6f0cb9` |
| `vt26_lcd.inc` | 9809 | `c39a081cb5324359598b4c1e939fb95e7d6d7ebb2f8fd17d7f455260c09f642c` |
| `export.inc` | 1947 | `d33eb972b2f295e4f451293eb48f5931acc2de3e8c5ef4061ca5cb8b7f9565c9` |

Donor: [Chapter 02 x0.31a Stable](https://drive.google.com/file/d/1j6VU9-XbC8LoANOSQzpLm7sa4ZRveWOm/view); [Papa Sol curation](https://drive.google.com/file/d/1J4PJfCcMoWKX2SmAjd8vLZTODgtupycD/view); [source-copy SHA audit](https://drive.google.com/file/d/1C3nJwXWvhBjZNLyyug6D2ZftLl8-P_Td/view). The original HD61 Rev. 0.45 native image is 65,536 B, SHA-256 `89df2c3fbd6dbb0b8a158124a5ecad3cd234ade3ace84dcae09a4dcc3b2c4289`. **No library ROM retest was performed or required solely for exact donor source adoption**; separate consumer builds and tests are mandatory.

**Claim boundary**: PB-2000C emulator behavior within the Chapter 02 donor composition, owner-accepted bounded internal Stable. NOT: independent generic API tests, physical PB-2000C, AI-1000, receiver-side UART 1,968-byte capture, public publication license, automatic admission into existing `stable/r012a`, or upgraded VT23/24 consumers. A future dual-machine VT must be **newly versioned and qualified**, not relabeled as this exact VT26 member.

*Praeteritum ad futurum servamus.*
