Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ jobs:
run: |
"$CLANG" --version
python -m unittest discover -s tools/llvm-src32 -p 'test_*.py' -v
- name: Foundation shell (testbench, PCG screen)
run: python -m unittest discover -s foundation/tests/shell -v

# sol コンパイラ / VM / LSP、WAX ツール、Foundation WAX ローダのホストテスト。
# sol の Foundation 実行テストは testbench を使う。
Expand Down
1 change: 1 addition & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
- sol VS Code 拡張(`tools/vscode-sol-syntax/` で実行): `npm run compile`、`npx vsce package --no-dependencies`
- PCG scroll: `cargo test --test vdp_pcg_scroll`
- Foundation WAX ローダ(ホスト): `python3 -m unittest discover -s foundation/tests/wax`。testbench での実行は `tools/llvm-src32/test_toolchain.py` の `test_foundation_wax_loader`
- Foundation シェル(testbench、PCG 画面の比較): `python3 -m unittest discover -s foundation/tests/shell`(`src32_testbench` と Clang が必要)
- WASM SDK package builder: `python3 -m unittest discover -s sdk/wasm-expansion-card -p 'test_*.py' -v`
- WASM starter/example: `cargo build --manifest-path templates/wasm-expansion-card/Cargo.toml --release --target wasm32-unknown-unknown` と同じ形式で example の manifest も build。
- sol ゲストの実行確認は、必要に応じて `tools/solc/solc.py compile` → `tools/asm/asm.py` → `src32_testbench` またはエミュレータの順に行います。
Expand Down
9 changes: 9 additions & 0 deletions MEMORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -1058,3 +1058,12 @@
- Release (CD): .github/workflows/release.yml. Pushing a `v*` tag builds cpt32 / cpt32-tool / src32_testbench in release mode for linux-x86_64, windows-x86_64 and macos-arm64 (archive also carries README, licenses, config.example.yaml, assets/bios.rom) plus both VS Code .vsix files, and publishes them with softprops/action-gh-release (tags containing `-` become prereleases). PRs touching release.yml and workflow_dispatch run the builds without publishing. CI's `vscode-extensions` job also packages the .vsix on every PR.
- `toolchain` and `solc` run with `if: !cancelled()` after `rust`, so a failing integration test does not hide them; they only need the uploaded testbench artifact.
- dos_smoke hex tests can hang on CI runners (seen on dos_pipeline_hex_returns_to_shell_at_default_cycles_per_frame: keys for "EXIT" never reach the guest, CPU halted with IRQC pending=0x0001 enable=0x0008). connect_pec_input applies host key events on a separate `pec-input` thread, so the test races with the guest; under CPU contention an input edge can be lost. Not reproducible locally in 3 full runs. Same symptom as the known 800-cycle failure.

## Foundation minimal shell on PCG (2026-10-22)
- foundation/shell/shell.c implements the parts of doc/spec_Foundation_shell.md that need no fs, IPC or proc_spawn: lexing/syntax §3–§4 (whole line checked before anything runs), variables §5.1, line editor §9.2, messages §11.1, builtins CLS/ECHO/SET/VER/MEM/PS/HELP/EXIT and bare CD. fs-dependent features report FND_E_UNSUPPORTED; command lookup reports `command not found`. foundation/README.md "シェル" lists what is provisional.
- Provisional console: no console service exists (needs phase 2 IPC), so foundation/lib/fnd/con_pcg.c is linked into the shell and drives PCG mode 1 (80x30, 8x8) and the PeC FIFO directly. The boot image (foundation/boot) grants VDP 0x80000000–0x8000FFFF, VRAM 0x10000000–0x10002FFF and PeC input to slot 4 via the new grants argument of fnd_proc_spawn_wax (§10.3 windows; VRAM/PCMRAM exclusive -> FND_E_BUSY). The spec says the shell has caps=0 and no MMIO: remove the grants once the console service exists. MMIO regions carry `mmio=1` so §5.4 pointer checks skip them and exit does not zero them.
- Line editing uses only ST_WRITE controls: console BS at column 0 goes to the end of the previous row, so redraws are "print tail, blanks, BS back". Keep that BS rule if the console is rewritten.
- `--protected` used to emit one WAX block per `.ORG` gap (alignment padding between globals), so any C program with several globals hit "protected WAX allows at most 7 blocks". driver.py protected_blocks now fills gaps between same-permission blocks with zeros (regression in test_protected_wax_output). Zero-initialized globals are stored in the image (shell ~220 KiB).
- Spawning the 220 KiB shell with interrupts off loses ticks, so tests stop at tick 3000 but need ~200+ frames; tests/shell uses 260 frames.
- src32_testbench gained `--type FRAME=TEXT` (HID usages, US layout, escapes \n \b \L \R \U \D \H \E \X \C \; sleeps 50 ms after sending because the PeC input thread applies events asynchronously) and `--dump-pcg` (visible 30 rows honoring SCREEN_MODE and SCROLL_Y). foundation/tests/shell compares whole screens: about 40 s on the release testbench, 4.5 min on debug (CI).
- The PCG font comes only from config.yaml `pcg.font`; without it the GUI shows no glyphs (VRAM text is still right).
2 changes: 1 addition & 1 deletion doc/foundation_os_plan.md
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ libfnd とサービスのプロトコルは [API 仕様](spec_Foundation_API.md)
| 3 プロセス | `proc_spawn`/`exit`/`wait`、所有権表、`FNDBOOT` の同梱モジュール | 起動・終了を繰り返しても RAM とハンドルが漏れない。WAX v3 §8 の領域ケースのうち v2 で可能なもの |
| 4 ディスク | `blk_io`(転送先の検証)、disk サービス、DSFS 読み取りマウント | FDD 読み込み中も他スレッドが進む。不正バッファでは `E_ACCESS` になり RAM は変化しない |
| 5 FS2 | 仕様、ホストツール、ゲストの読み取り → 書き込み | ホストの fsck とゲストの結果が一致する。書込中断後はDIRTYでmountを拒否し、fsckの検査・修復可能範囲を確認する |
| 6 シェル | libfnd、shell、外部コマンド、stage1 からのディスク起動 | ディスクから起動して `DIR`、`TYPE`、アプリ起動を確認する |
| 6 シェル | libfnd、shell、外部コマンド、stage1 からのディスク起動 | ディスクから起動して `DIR`、`TYPE`、アプリ起動を確認する(fs なしで動く部分を先に実装済み: [`foundation/shell`](../foundation/README.md#シェル)。コンソールはシェルにリンクした暫定版で、PCG に表示する) |
| 7 拡張 | WAX v3/WAL(libfnd の WAL 化)、再配置可能な WAX、`/tmp`、拡張カードのドライバ | WAX v3 §8 の全ケース(ローダは実装済み: `foundation/kernel/wax.c`、`tests/wax`。v2 PROTECTED も同じ経路で読み込む。v3 を生成するツールチェーンと libfnd の WAL 化は未着手) |

各フェーズでは、テストに通った focused check と、実行していない確認を分けて報告します。
Expand Down
2 changes: 1 addition & 1 deletion doc/spec_Foundation_API.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Foundation API 仕様 v1

Revision 0.1、2026-10-22。Status: **ドラフト(主要な設計判断は確定、未実装)**。本書は Foundation OS のサービス間プロトコルと、アプリ向けライブラリ libfnd の API を定めます。対象は、ストリーム(ファイル、コンソール、デバイス)、fs サービスのセッションとパス操作、ディレクトリの列挙、コンソールの入出力、起動ブロックと標準ストリーム、プロセスの起動、名前照合、API のエラーコードです。カーネル ABI は [spec_Foundation.md](spec_Foundation.md)、ディスク形式と VFS の意味は [spec_FS2.md](spec_FS2.md)、シェルは [spec_Foundation_shell.md](spec_Foundation_shell.md) を参照してください。本書と [実装案](foundation_os_plan.md) が異なる場合は本書が優先します。
Revision 0.1、2026-10-22。Status: **ドラフト(主要な設計判断は確定、一部実装)**。libfnd のうち起動、標準ストリーム、コンソールの一部、`fnd_strerror` を [`foundation/lib/fnd`](../foundation/README.md#シェル) に実装しています。IPC がまだないので、コンソールはプログラムにリンクする暫定実装です。 本書は Foundation OS のサービス間プロトコルと、アプリ向けライブラリ libfnd の API を定めます。対象は、ストリーム(ファイル、コンソール、デバイス)、fs サービスのセッションとパス操作、ディレクトリの列挙、コンソールの入出力、起動ブロックと標準ストリーム、プロセスの起動、名前照合、API のエラーコードです。カーネル ABI は [spec_Foundation.md](spec_Foundation.md)、ディスク形式と VFS の意味は [spec_FS2.md](spec_FS2.md)、シェルは [spec_Foundation_shell.md](spec_Foundation_shell.md) を参照してください。本書と [実装案](foundation_os_plan.md) が異なる場合は本書が優先します。

「〜しなければならない (MUST)」「〜してはならない (MUST NOT)」「〜してよい (MAY)」は規範的な要求を表します。

Expand Down
2 changes: 1 addition & 1 deletion doc/spec_Foundation_shell.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Foundation シェル仕様 v1

Revision 0.1、2026-10-22。Status: **ドラフト(主要な設計判断は確定、未実装)**。本書は Foundation OS の標準シェル `/bin/shell.wax` の起動、構文、展開、コマンドの解決と実行、リダイレクト、組み込みコマンド、スクリプト、対話入力を定めます。カーネル ABI は [spec_Foundation.md](spec_Foundation.md)、ファイルシステムと VFS は [spec_FS2.md](spec_FS2.md)、背景は [実装案 §7](foundation_os_plan.md) を参照してください。本書と実装案が異なる場合は本書が優先します。
Revision 0.1、2026-10-22。Status: **ドラフト(主要な設計判断は確定、一部実装)**。fs、`proc_spawn`、console サービスがなくても動く部分を [`foundation/shell`](../foundation/README.md#シェル) に実装しています(実装済みの範囲と暫定の扱いは README)。 本書は Foundation OS の標準シェル `/bin/shell.wax` の起動、構文、展開、コマンドの解決と実行、リダイレクト、組み込みコマンド、スクリプト、対話入力を定めます。カーネル ABI は [spec_Foundation.md](spec_Foundation.md)、ファイルシステムと VFS は [spec_FS2.md](spec_FS2.md)、背景は [実装案 §7](foundation_os_plan.md) を参照してください。本書と実装案が異なる場合は本書が優先します。

「〜しなければならない (MUST)」「〜してはならない (MUST NOT)」「〜してよい (MAY)」は規範的な要求を表します。

Expand Down
Loading
Loading