package sim_8086 Register :: struct { fullname: string, bytename: string, value: struct #raw_union { using _: struct { low, high: byte, }, full: u16, }, code: u8, } WordSize :: enum { None, LastBit, FourthBit, Always8, Always16, } None :: struct {} Disp8 :: i8 Disp16 :: i16 Displacement :: union { None, Disp8, Disp16 } RegisterId :: distinct u8 Immediate8 :: distinct i8 Immediate16 :: distinct i16 ImmediateU8 :: distinct u8 MemoryAddr :: struct { addr_id: u8, displacement: Displacement, } DirectAddress :: distinct i16 SegmentRegister :: distinct i8 Jump :: distinct i8 VariablePort :: struct {} ShiftRotate :: distinct bool Repeat :: string Intersegment :: struct { ip: i16, cs: i16, } DirectWithinSegment :: distinct u16 Operand :: union { None, RegisterId, Immediate8, ImmediateU8, Immediate16, MemoryAddr, DirectAddress, SegmentRegister, Jump, VariablePort, ShiftRotate, Repeat, DirectWithinSegment, Intersegment, } OperandInfo :: enum { None, Register, SegmentRegister, RegisterMemory, Immediate, ImmediateUnsigned, Accumulator, DirectAddress, Jump, VariablePort, ShiftRotate, Repeat, DirectWithinSegment, Intersegment, } RegisterEncodingBits :: enum { None, FirstByteLast3, SecondByteMiddle3, SecondByteLast3, FirstByteMiddle3, } InstructionInfo :: struct { mask: u8, encoding: u8, opname: Op, desc: string, src: OperandInfo, dst: OperandInfo, word_size: WordSize, reg_info: RegisterEncodingBits, has_flip: bool, has_sign_extension: bool, check_second_encoding: bool, consume_extra_bytes: int, shift_rotate_flag: bool, } Instruction :: struct { opname: Op, src: Operand, dst: Operand, info: InstructionInfo, is_word: bool, indirect_intersegment: bool, has_segment: Maybe(Register), has_lock: bool, bytes_read: int, raw_data: []u8, debug_msg: string, }