LIB2 / FILE VIEW

USER_MANUAL.md

DOWNLOAD ORIGINAL ↓

# KEYBOARD / generation 1 — User manual

**Library:** `src/lib2/keyboard/1/`  
**Edition:** 2026-11-18, source/document review (documentation only)  
**Qualification:** Older source-derived keyboard generation; independent native and PB-2000C/AI-1000 runtime qualification remains open.

## What this member does

Historical K540 key-matrix decoding and a card-local keyboard event/session adapter with CAPS handling.

## Public interfaces

| Entry point or group | Inputs, outputs and behavior |
|---|---|
| `K540_INIT / K540_RESET` | Initialize or clear borrowed KEYMD mode RAM; use reset on exit. |
| `K540_GET` | Blocking key press/release; `$17` event class, `$0` key, `$13` CAPS mode. |
| `K540_MODE` | Read current KEYMD mode into `$13`. |
| `K540_RAW` | Low-level key matrix service; exact event semantics require source review. |
| `KBD_INIT / KBD_EVENT / KBD_RESET / KBD_RELEASE` | Thin session-adapter labels to K540 functions. |

## How to integrate

Include `keyv540.inc` once, implementation `keyv540.s` and optionally `keyboard.s`; initialize card-local session, call `KBD_EVENT`/`K540_GET`, act on event class, reset before returning to any host keyboard handler.

**Composition sketch (not an independently assembled client):**

```asm
#INCLUDE (lib2/keyboard/1/keyv540.inc)
; Supply the dependencies, RAM, bank context and symbols described above.
        CAL     K540_INIT
```

## Environment, dependencies and memory

Borrowed KEYMD RAM1 `09E4h`; cannot overlap host CRTKY/KEYMD ownership. Valid stack, card ROM access and power/BRK policy from caller.

## Limits and evidence

Older generation does not establish keyboard/3 one-shot SHIFT behavior. Do not assume a hardware-qualified dual-machine keyboard service.

**This documentation does not introduce a new build or runtime PASS.** Source equivalence, native assembler parity, emulator execution and physical-machine evidence remain distinct.

## Actual source and further reference

- [This exact member folder in Google Drive](https://drive.google.com/drive/folders/1IUJ4bzTQPNaMrU5frCK3wd60TSVIZsza)
- Source modules: `keyv540.inc`, `keyv540.s`, `keyboard.s`.
- Further contracts/source notes: keyv540.inc. These may include dated donor paths or older acceptance statements.
- For a new consumer, pin exact source files and hashes, verify full include closure, inspect register/bank/resource conflicts and test the resulting application on each claimed target.

*Praeteritum ad futurum servamus.*