Skip to content

v0.3.0

Latest

Choose a tag to compare

@github-actions github-actions released this 07 Sep 06:39
v0.3.0
3d4b473

NanoCore v0.3.0

Correctness pass over the emulator, assembler, and docs.

Fixed

  • Emulator panic on out-of-range register operands. An operand byte ≥ 16 indexed past the 16-register file and crashed the process (index out of bounds: the len is 16 but the index is 255). Register operands are now masked to R0–R15, matching how packed two-register operands already worked. Reachable from any hand-written .ncb, a jump into .DB data, or a misaligned PC.
  • Hex literals were parsed by a byte-decoder. 0xF was rejected outright (even digit counts only) and 0x1234 silently truncated to 0x12. Short forms now assemble correctly and out-of-range values are a proper error. Same fix applies to address entry in the TUI, where 0xF silently became 0x00.
  • Undefined labels reported the wrong error. JMP nowhere said Invalid value 'nowhere'; it now says Undefined label 'nowhere'. Malformed numeric literals (JMP 0xZZ) keep their own message.
  • Runaway programs exited 0. A program that never halted printed a force-halt notice and reported success. It now raises MaxCyclesExceeded and exits 1.
  • STORE operand order was documented backwards in the README and on the website — STORE addr Rd does not assemble; the correct form is STORE Rd addr. The website also described STR with its operands reversed.
  • programs/screen.ncb was missing — the only example program without a compiled binary.

Added

  • --max-cycles <N> to raise or lower the 1024-cycle budget. screen.nca already uses 689 of the default.
  • EmulatorError::MaxCyclesExceeded { cycles }.

Changed

  • Dropped the hex dependency in favour of u8::from_str_radix.
  • Op::instruction_len no longer has a catch-all arm. Adding an opcode without giving it a length is now a compile error rather than a silent 1-byte default that desynchronises the PC.

Breaking

  • EmulatorError gained a variant — exhaustive matches need a new arm.
  • NanoCore gained a public max_cycles field — struct-literal construction breaks; use NanoCore::new().
  • NanoCore::run() now returns Err(MaxCyclesExceeded) where it previously returned Ok(()). Programs that relied on silently hitting the cap will start failing; pass --max-cycles to raise it.