sim86_decode.h (1340B)
1 /* ======================================================================== 2 3 (C) Copyright 2023 by Molly Rocket, Inc., All Rights Reserved. 4 5 This software is provided 'as-is', without any express or implied 6 warranty. In no event will the authors be held liable for any damages 7 arising from the use of this software. 8 9 Please see https://computerenhance.com for more information 10 11 ======================================================================== */ 12 13 enum instruction_bits_usage : u8 14 { 15 Bits_Literal, 16 Bits_MOD, 17 Bits_REG, 18 Bits_RM, 19 Bits_SR, 20 Bits_Disp, 21 Bits_Data, 22 23 Bits_HasDisp, 24 Bits_DispAlwaysW, 25 Bits_HasData, 26 Bits_WMakesDataW, 27 Bits_RMRegAlwaysW, 28 Bits_RelJMPDisp, 29 Bits_D, 30 Bits_S, 31 Bits_W, 32 Bits_V, 33 Bits_Z, 34 35 Bits_Count, 36 }; 37 38 struct instruction_bits 39 { 40 instruction_bits_usage Usage; 41 u8 BitCount; 42 u8 Shift; 43 u8 Value; 44 }; 45 46 struct instruction_format 47 { 48 operation_type Op; 49 instruction_bits Bits[16]; 50 }; 51 52 struct disasm_context 53 { 54 register_index DefaultSegment; 55 u32 AdditionalFlags; 56 }; 57 58 static disasm_context DefaultDisAsmContext(void); 59 static instruction DecodeInstruction(disasm_context *Context, memory *Memory, segmented_access *At); 60 static void UpdateContext(disasm_context *Context, instruction Instruction);