Inline-Asm Island

Signals & Audio

Native C values cross an opaque patch of hand-written machine code without losing their width state or register contents.

loading core…

Self-running — verified CRC 260B.

Click the screen, then play. (Tab away and it pauses.)

The boundary under test

The 65816 decodes immediate operands according to the live M flag, but inline assembly is opaque to the compiler's width-state analysis. This probe keeps native-width C values live across an island that saves P, switches to A8, clobbers A and flags, switches to A16, then restores P.

A8 bytes: e2 20 a9 5aSEP #$20; LDA #$5A.

A16 bytes: c2 20 a9 ff 00REP #$20; LDA #$00FF.

Result: host, default, a16, and xy16 all return 0x260B. No compiler defect was found.

Why raw bytes matter

A width-unaware disassembler can consume the following opcode as the high byte of an A8 immediate. The compiler gate therefore checks the exact object bytes and separately proves that generated C code re-establishes M16 after the island.

Compiler stress-test #125, Round 7. Source and full test record live in llvm-mos-65816.