Repository navigation
examples: make 30_stream_test portable to eZ80 (pointer-typed descriptor field) - #378
Merged
Merged
Conversation
…tor field
The BufStream descriptor kept the buffer address in a u16 cell of a byte
array (`var p: ^u16 = s; p[0] = b`). On Z80 that works (16-bit pointers);
on eZ80 ADL the 24-bit pointer truncates to bank 0, the writes miss buf,
and the asserts at lines 63 and 75 read 0 instead of 42/20.
Give the descriptor a struct with a pointer-typed field instead:
struct BufStream { data: ^u8, pos: u16, cap: u16 }
global stream: BufStream
bufstream_init/write_u8/pos now take ^BufStream and use s.data/s.pos/s.cap,
so the program is correct on both targets with the same four asserts and
expected values. No compiler changes.
Oracle evidence: the showcase_stream_oracle_test.go driver needed no
change — the packed struct layout on the 16-bit oracle targets is still
the 6 bytes [data:2][pos:2][cap:2] it already checked, and the test still
verifies the same full 64-byte buffer and relocated-pointer descriptor on
VM and native Z80 across all five capacities. The reviewed record in
docs/grace-integration-338/reviewed-updates.json gets the new source
SHA256 and an accurate boundary describing the struct descriptor.
Gates: Z80 asserts 4/4; eZ80 sweep (scripts/agon/ez80_sweep.sh) 4/4
asserts pass, 0 fail (was 2/4); go test ./pkg/pipeline -run Showcase;
go test ./pkg/nanz; run_stable_pipeline.py --profile fast (2 shards,
exit 0 both).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01N957godRAhTkyy1mTB6roS
PR tests: 🟢 passCommit:
Deep pipeline domains and the full assertion corpus run on release tags, nightly and manual audits. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Before this change,
30_stream_test.nanzstored&bufin a u16 cell of a byte-array descriptor. Under the eZ80 ADL ABI (ADR 0054) that truncates the pointer to bank 0, so two asserts failed on eZ80.The descriptor is now a struct:
struct BufStream { data: ^u8, pos: u16, cap: u16 }.showcase_stream_oracle_test.gochecks the same behaviour unchanged. The pinned record inreviewed-updates.jsonhas an updated hash and boundary text.Example source only; no compiler change. Written by a GLM worker session (claude-z) and reviewed by the coordinator.
🤖 Generated with Claude Code
https://claude.ai/code/session_01N957godRAhTkyy1mTB6roS