OATHKEEPER GRAPHING CALCULATOR

OPEN THE CALCULATOR
Phone or computer: open the standalone tool in a modern browser and bookmark it.
https://www.oathkeeperaistudios.com/demos/calculator/app.html

Windows: download the portable ZIP from the demo page, choose Extract All in
File Explorer, then double-click Calculator.html in the extracted folder.
No installer, terminal or server is needed. The portable edition runs offline.
Ctrl+D bookmarks the local file. If the folder moves, bookmark its new location.

On the standalone instrument, Programs opens the game and four utilities;
Controls holds instructions, worked examples, power and reset, and credits.
Phoenix has touch arrows, Start / Pause and Fire alongside its display. Hold a
direction and Fire together to move and shoot. Home exits to the calculator.
The demonstration page also includes an explanation and the source download.

CALCULATOR
Press a number to start calculating. ENTER evaluates and closes trailing
function parentheses. After an answer, a digit starts a new expression and an
operator continues from the answer. Use the physical keys or type at the LCD.
Return to Home (also Escape or 2nd → MODE) leaves any menu or guest and keeps
your entry. Reset screen clears the current entry and returns to numerical Home.
Stored history, memory and graph settings survive either action.

Y= edits two functions of x. WINDOW sets limits. ZOOM changes the scale;
TRACE selects sampled points with left/right and switches curves with up/down.
GRAPH draws. Press 2nd, then GRAPH for TABLE. Graphs and symbolic calculus use
radians. Numerical Home has its own degree/radian setting under MODE.
The standalone keypad adapts to portrait and landscape phone screens.
Oathkeeper has its own left-hand navigation wheel and scientific key bank.

2nd uses the gold legend for one keypress. ALPHA enters the green letter
above the next key, useful when writing symbolic expressions. MATH includes
scientific and symbolic tools. STAT offers statistics. VARS recalls memory and
the previous numerical answer. 2nd → x⁻¹ opens matrices. STO→ stores the
previous numerical result; 2nd → STO→ recalls it. 2nd → ENTER opens history
and CSV export. New numerical history entries carry their original numerical
value for memory. Saved answers carry their math-engine revision. Earlier-version entries retain
their expressions and archived values in CSV; Home hides their answers until
you press ENTER. Recalculated results can be copied, stored or reused as Ans. APPS and
PRGM open the software menus. The five titles are also directly accessible in
the games and programs lists beside or below the calculator. The modern
workspace uses math.js and Nerdamer; the emulator separately runs KnightOS.

POWER
Use Power off, or press 2nd then the lower-left ON button. The screen blanks,
input is disabled, current worker calculations stop, and the guest clock pauses.
ON wakes the instrument at the calculation Home screen. Power-off also survives a page reload. The stored numerical
answer, memory, graph window and history stay available. In normal operation,
ON provides a direct way home. Browser storage is local to the current origin.
Existing calculator data is migrated when next saved, with the older entry kept.

PLAY AND RUN SOFTWARE
The Z80 emulator runs the five included classic calculator programs
on the open-source KnightOS firmware. Click Play or Open.
Phoenix: Space or Enter starts/pauses, WASD or arrows moves, Ctrl/Shift or 2nd fires.
The four additional programs are Periodic Table, Calendar, CalcSys and Text
Editor. Each launch shows its own controls. Touch users press the instrument
keys. Click the LCD for keyboard control. Hold keys for continuous input.
The guest runs its own CPU, operating system, key scanner and 96×64 display.
F1–F5 match the five graph keys. MODE goes back inside supporting programs;
Escape or Return to Home pauses the guest. Resume reopens the same program
with its screen and session state intact. Starting another title or choosing Restart program restores a fresh image and
clears session files. The bundled programs run on the supplied open firmware.

SOURCE AND BUILD
The download includes this complete static application, src/math-worker.js,
package.json and package-lock.json, build.cjs, the exact browser runtime artifacts,
third-party notices, and the selected KnightOS program/core source and assets.
Run `npm ci` followed by `node build.cjs` from the source directory to rebuild the
math worker (Node.js 20 or newer recommended). Serve public/ using, for example,
`python3 -m http.server 8080 --directory public`, then visit
http://localhost:8080/index.html. No build is required to use the supplied public/.

The exact browser z80e artifact comes from KnightOS/knightos.org commit
40574fa3265fece8ff81170a49a3ef748296237b, tools/z80e.js and tools/z80e.js.mem.
The artifact changes set the memory initializer path from /tools/ to vendor/ and
correct read_cc conditions P/M to test the sign flag (bit 7), not subtract flag
(bit 1). The unchanged original artifact and reproducible patch script are included
in emulator-source/prebuilt/ and patches/. Run python3 patches/patch-z80e.py to
reapply the correction. proof/cpu-conditions.cjs checks all 8 conditions across all
256 flag bytes for JP, CALL and RET: 6,144 passing cases.
Our JavaScript adapter uses numeric C exports and contains no cwrap/eval calls.
It supplies the original runtime logging callbacks and explicitly completes
initialization after the asynchronous memory file load. Key presses and releases
advance real guest CPU cycles so even short mouse taps reach the guest scanner.
A 25 ms timer clocks the CPU separately from display drawing; catch-up is bounded
at 250 ms, and hidden tabs pause the emulation. Input-scan cycles are credited
against scheduled CPU time so typing does not add time to the normal clock.
Binding layout is documented by KnightOS/OpenTI commit
f64bb6f2287f3c69973bb34c28ae973a8db642e5.
The z80e source export is commit 00b5973f6f71dcc5a50203718ebba104ee9a9ce9;
it is supplied for study/modification, not claimed to reproduce that older
precompiled artifact byte-for-byte. The supplied artifact is itself complete
JavaScript and is freely modifiable under z80e's MIT license.

The selected guest ROM contains programs built from the included source and assets.
The current release repacks the previously verified binaries into erased flash.
See guest-source/REBUILD.md and guest-source/build_rom.py for exact prerequisites and commands.
The selected guest kernel identifies itself as 0.6.7-29-gccbbb16 and its source
matches commit ccbbb1669ae8e35fe2bfcb2f212750ef4d31f2c8. Program sources and exact
upstream identities are recorded in guest-source/source-map.json. Filesystem
curation removes unrelated software and embeds per-program licenses. All runtime
kernel, library, program and icon binaries match the author-distributed 2015 snapshot;
the filesystem is curated anew.

CREDITS AND RIGHTS
This standalone web adaptation adds the interface, integration and examples.
The calculator interface and integration are licensed under MIT.
math.js 15.2.0: Jos de Jong and contributors, Apache-2.0.
Nerdamer 1.1.13: Martin Donk and contributors, MIT.
z80e and OpenTI emulator, KnightOS kernel and core utilities: KnightOS Group
and contributors, MIT. Source download: the separate ZEXALL and ZEXDOC test
programs are GPL-2.0-or-later. Their assembly sources, copyright notices
and GPL version 2 are in emulator-source/z80e/gpl/.
Calendar: Willem Sonke, MIT. Phoenix: Patrick Davidson, public domain, KnightOS
port by Drew DeVault/contributors. See licenses/THIRD-PARTY-NOTICES.txt
for all retained copyright notices, complete licenses and exact source URLs.


OFFLINE BUILD AND CHECKS
On Linux x86-64 the included dependency tree can build the worker offline:
python3 proof/build-worker-from-public-source.py /path/to/oathkeeper-calculator-source.zip
The script restores the published esbuild executable in a temporary directory.
Build the static keypad with python3 build_keypad.py after editing its key map.
Run node proof/keypad-check.cjs and node proof/worker-boundaries.cjs to check the
guest scan map and representative numeric, graph and symbolic results.
Run node proof/guest-input.cjs for keyboard ownership, power and guest controls.
The mathematical domains and limits are described in docs/math-behavior.md.

BUILD THE PRACTICAL EDITIONS
The source tree includes public/app.html, public/practical.css, and
public/practical.js. The practical view shares the original math and emulator
engines, displays, and key bindings with the demonstration. After editing the
device HTML in public/index.html, run python3 build_practical.py from this
source directory to regenerate public/app.html.

To rebuild the portable package from the complete downloaded source ZIP:
python3 build_portable.py --source /path/to/oathkeeper-calculator-source.zip --output /path/to/oathkeeper-calculator-portable.zip
The ZIP packages Calculator.html, the notices, the exact complete editable
source and the portable builder. The downloadable archives sit beside the
hosted web files and are intentionally outside the version they package.
