Skip to content

Add remaining illegal opcodes and tests#127

Merged
omarandlorraine merged 3 commits intomre:illegalfrom
mlund:illegal
Jan 27, 2026
Merged

Add remaining illegal opcodes and tests#127
omarandlorraine merged 3 commits intomre:illegalfrom
mlund:illegal

Conversation

@mlund
Copy link

@mlund mlund commented Jan 26, 2026

Completion of #126 by @omarandlorraine. Fixes #125. Note that this targets the illegal branch and should ultimately be merged into main if accepted.

mlund added 2 commits January 26, 2026 08:02
The illegal opcodes implementation caused README doc tests to hang:

1. First example used 0xff as program terminator
   - Previously 0xff was unimplemented (returned None), stopping execution
   - Now 0xff is ISC (INC+SBC) AbsoluteX, causing infinite loop
   - Fix: Use 0x02 (JAM) which explicitly halts the CPU

2. Second example loads euclid.bin which uses BRK (0x00) to terminate
   - BRK jumps to IRQ vector at $FFFE/$FFFF
   - Uninitialized memory contains 0x00, jumping to address $0000
   - This causes infinite loop executing whatever is in low memory
   - Fix: Mark as no_run since it depends on external file anyway
@mlund mlund mentioned this pull request Jan 26, 2026
@omarandlorraine
Copy link
Collaborator

I have one concern and that is that the README test seems to be disabled. Can you shed light on this? I remember you ran into trouble with it, but did you get it running and passing in the end?

@omarandlorraine omarandlorraine linked an issue Jan 27, 2026 that may be closed by this pull request
@omarandlorraine omarandlorraine self-requested a review January 27, 2026 08:52
Copy link
Collaborator

@omarandlorraine omarandlorraine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this is perfect

- Replace BRK with JAM ($02) to halt CPU after illegal opcodes impl
- Fix assembly label structure (algo/algo_ were dead infinite loops)
- Simplify linker.cfg to output raw binary at $0010 (was 64KB image)
- Enable README doc test (remove no_run marker)

The old linker config produced a 64KB memory image with code at $0400,
but README loaded at $0010 causing address mismatch. New config outputs
only the code segment at the correct load address.
@omarandlorraine omarandlorraine merged commit cb29892 into mre:illegal Jan 27, 2026
7 checks passed
@omarandlorraine
Copy link
Collaborator

So that's been merged into my branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

No illegal opcodes

2 participants