class

Swanium::Core::Cpu

Inherits Reference < Object

Synchronous NEC V30 execution state. The opcode subset here establishes the 8086-compatible data, stack, ALU, and branch paths used by the first headless programs; unsupported instructions stop deterministically.

Constants

LONG_REP_INTERRUPT_RETURN_CYCLE_THRESHOLD = 256_u32

Constructors

Instance methods

fault_opcode
Source
flags
Source
halted
Source
halted=(halted : Bool)
Source
last_trace
Source
maskable_interrupt_allowed?

Consumes the one-instruction maskable-interrupt delay following STI and SS loads. Called by the machine only at instruction boundaries.

Source
registers

Register and flag objects remain observable for instruction tracing and debugger views, but replacing either object would bypass restore and make CPU snapshots non-atomic.

Source
reset(code_segment : UInt16, instruction_pointer : UInt16) : Nil
Source
restore(snapshot : CpuSnapshot) : Nil
Source
service_interrupt(bus : MemoryBus, vector : UInt8) : UInt32

Accept an interrupt through the standard V30 real-mode vector table. Device masking is owned by the hardware bus; this method deliberately also serves software interrupts and exceptions.

Source
service_interrupt_at_ip(bus : MemoryBus, vector : UInt8, saved_ip : UInt16) : UInt32

Long REP strings are interruptible on the V30. The scanline-framed driver executes the string atomically, so it supplies this saved IP to make IRET restart the prefix/opcode with its remaining CX/SI/DI state.

Source
snapshot
Source
step(bus : MemoryBus) : UInt32
Source
take_interrupt_return_override_ip
Source
trap_interrupt_allowed?

POPF/IRET enabling TF suppress INT 1 at the immediately following boundary, matching the V30's corresponding IF-delay behaviour.

Source