-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Description
When running tests that call InitZobristTables (which fills 1536+ bytes of random data using a PRNG loop), the simulator reports an unsupported opcode error:
The OpCode 5A @ address 44F6 is not supported.
Steps to Reproduce
-
Build the Chess project:
make build -
Run any test that calls InitZobristTables, e.g.:
docker run --rm -v "$PWD":/code ghcr.io/barryw/sim6502:v3.6.0 -s /code/tests/ai_zobrist.6502 -
The first suite (Zobrist PRNG) passes, but when Zobrist Tables suite runs and calls InitZobristTables, the error occurs.
Analysis
- Opcode $5A is PHY (Push Y to stack) - a 65C02 instruction
- The code at address $44F6 in the symbol file is inside ZobristPRNG
- The actual assembled code at that location is valid 6502 (
lda $fb= $A5 $FB) - Tests that don't call InitZobristTables work fine
- Tests that call only ZobristPRNG (without the full table init loop) also work
This suggests the issue may be related to:
- Execution reaching an unexpected memory location after many iterations
- Some state corruption during long-running loops
- Address calculation issue in the simulator
Expected Behavior
InitZobristTables should complete successfully - it's standard 6502 code with no 65C02 instructions.
Environment
- sim6502 version: v3.6.0
- Platform: macOS (ARM64, running via Docker with linux/amd64 emulation)
- Source code: Standard 6502 assembly (no 65C02 mode)
Workaround
Tests that need Zobrist functionality can use ZobristPRNG directly or work with pre-seeded values rather than calling the full InitZobristTables.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels