📄 decode.c
字号:
if (CHECK_DATA_ACCESS()) x86emu_check_data_access((u16)get_data_segment(), offset);#endif return (*sys_rdl)((get_data_segment() << 4) + offset);}/****************************************************************************PARAMETERS:segment - Segment to load data fromoffset - Offset to load data fromRETURNS:Byte value read from the absolute memory location.NOTE: Do not inline this function as (*sys_rdX) is already inline!****************************************************************************/u8 fetch_data_byte_abs( uint segment, uint offset){#ifdef DEBUG_EMU_VGA if (CHECK_DATA_ACCESS()) x86emu_check_data_access(segment, offset);#endif return (*sys_rdb)(((u32)segment << 4) + offset);}/****************************************************************************PARAMETERS:segment - Segment to load data fromoffset - Offset to load data fromRETURNS:Word value read from the absolute memory location.NOTE: Do not inline this function as (*sys_rdX) is already inline!****************************************************************************/u16 fetch_data_word_abs( uint segment, uint offset){#ifdef DEBUG_EMU_VGA if (CHECK_DATA_ACCESS()) x86emu_check_data_access(segment, offset);#endif return (*sys_rdw)(((u32)segment << 4) + offset);}/****************************************************************************PARAMETERS:segment - Segment to load data fromoffset - Offset to load data fromRETURNS:Long value read from the absolute memory location.NOTE: Do not inline this function as (*sys_rdX) is already inline!****************************************************************************/u32 fetch_data_long_abs( uint segment, uint offset){#ifdef DEBUG_EMU_VGA if (CHECK_DATA_ACCESS()) x86emu_check_data_access(segment, offset);#endif return (*sys_rdl)(((u32)segment << 4) + offset);}/****************************************************************************PARAMETERS:offset - Offset to store data atval - Value to storeREMARKS:Writes a word value to an segmented memory location. The segment used isthe current 'default' segment, which may have been overridden.NOTE: Do not inline this function as (*sys_wrX) is already inline!****************************************************************************/void store_data_byte( uint offset, u8 val){#ifdef DEBUG_EMU_VGA if (CHECK_DATA_ACCESS()) x86emu_check_data_access((u16)get_data_segment(), offset);#endif (*sys_wrb)((get_data_segment() << 4) + offset, val);}/****************************************************************************PARAMETERS:offset - Offset to store data atval - Value to storeREMARKS:Writes a word value to an segmented memory location. The segment used isthe current 'default' segment, which may have been overridden.NOTE: Do not inline this function as (*sys_wrX) is already inline!****************************************************************************/void store_data_word( uint offset, u16 val){#ifdef DEBUG_EMU_VGA if (CHECK_DATA_ACCESS()) x86emu_check_data_access((u16)get_data_segment(), offset);#endif (*sys_wrw)((get_data_segment() << 4) + offset, val);}/****************************************************************************PARAMETERS:offset - Offset to store data atval - Value to storeREMARKS:Writes a long value to an segmented memory location. The segment used isthe current 'default' segment, which may have been overridden.NOTE: Do not inline this function as (*sys_wrX) is already inline!****************************************************************************/void store_data_long( uint offset, u32 val){#ifdef DEBUG_EMU_VGA if (CHECK_DATA_ACCESS()) x86emu_check_data_access((u16)get_data_segment(), offset);#endif (*sys_wrl)((get_data_segment() << 4) + offset, val);}/****************************************************************************PARAMETERS:segment - Segment to store data atoffset - Offset to store data atval - Value to storeREMARKS:Writes a byte value to an absolute memory location.NOTE: Do not inline this function as (*sys_wrX) is already inline!****************************************************************************/void store_data_byte_abs( uint segment, uint offset, u8 val){#ifdef DEBUG_EMU_VGA if (CHECK_DATA_ACCESS()) x86emu_check_data_access(segment, offset);#endif (*sys_wrb)(((u32)segment << 4) + offset, val);}/****************************************************************************PARAMETERS:segment - Segment to store data atoffset - Offset to store data atval - Value to storeREMARKS:Writes a word value to an absolute memory location.NOTE: Do not inline this function as (*sys_wrX) is already inline!****************************************************************************/void store_data_word_abs( uint segment, uint offset, u16 val){#ifdef DEBUG_EMU_VGA if (CHECK_DATA_ACCESS()) x86emu_check_data_access(segment, offset);#endif (*sys_wrw)(((u32)segment << 4) + offset, val);}/****************************************************************************PARAMETERS:segment - Segment to store data atoffset - Offset to store data atval - Value to storeREMARKS:Writes a long value to an absolute memory location.NOTE: Do not inline this function as (*sys_wrX) is already inline!****************************************************************************/void store_data_long_abs( uint segment, uint offset, u32 val){#ifdef DEBUG_EMU_VGA if (CHECK_DATA_ACCESS()) x86emu_check_data_access(segment, offset);#endif (*sys_wrl)(((u32)segment << 4) + offset, val);}/****************************************************************************PARAMETERS:reg - Register to decodeRETURNS:Pointer to the appropriate registerREMARKS:Return a pointer to the register given by the R/RM field of themodrm byte, for byte operands. Also enables the decoding of instructions.****************************************************************************/u8* decode_rm_byte_register( int reg){ switch (reg) { case 0: DECODE_PRINTF("AL"); return &M.x86.R_AL; case 1: DECODE_PRINTF("CL"); return &M.x86.R_CL; case 2: DECODE_PRINTF("DL"); return &M.x86.R_DL; case 3: DECODE_PRINTF("BL"); return &M.x86.R_BL; case 4: DECODE_PRINTF("AH"); return &M.x86.R_AH; case 5: DECODE_PRINTF("CH"); return &M.x86.R_CH; case 6: DECODE_PRINTF("DH"); return &M.x86.R_DH; case 7: DECODE_PRINTF("BH"); return &M.x86.R_BH; } HALT_SYS(); return NULL; /* NOT REACHED OR REACHED ON ERROR */}/****************************************************************************PARAMETERS:reg - Register to decodeRETURNS:Pointer to the appropriate registerREMARKS:Return a pointer to the register given by the R/RM field of themodrm byte, for word operands. Also enables the decoding of instructions.****************************************************************************/u16* decode_rm_word_register( int reg){ switch (reg) { case 0: DECODE_PRINTF("AX"); return &M.x86.R_AX; case 1: DECODE_PRINTF("CX"); return &M.x86.R_CX; case 2: DECODE_PRINTF("DX"); return &M.x86.R_DX; case 3: DECODE_PRINTF("BX"); return &M.x86.R_BX; case 4: DECODE_PRINTF("SP"); return &M.x86.R_SP; case 5: DECODE_PRINTF("BP"); return &M.x86.R_BP; case 6: DECODE_PRINTF("SI"); return &M.x86.R_SI; case 7: DECODE_PRINTF("DI"); return &M.x86.R_DI; } HALT_SYS(); return NULL; /* NOTREACHED OR REACHED ON ERROR */}/****************************************************************************PARAMETERS:reg - Register to decodeRETURNS:Pointer to the appropriate registerREMARKS:Return a pointer to the register given by the R/RM field of themodrm byte, for dword operands. Also enables the decoding of instructions.****************************************************************************/u32* decode_rm_long_register( int reg){ switch (reg) { case 0: DECODE_PRINTF("EAX"); return &M.x86.R_EAX; case 1: DECODE_PRINTF("ECX"); return &M.x86.R_ECX; case 2: DECODE_PRINTF("EDX"); return &M.x86.R_EDX; case 3: DECODE_PRINTF("EBX"); return &M.x86.R_EBX; case 4: DECODE_PRINTF("ESP"); return &M.x86.R_ESP; case 5: DECODE_PRINTF("EBP"); return &M.x86.R_EBP; case 6: DECODE_PRINTF("ESI"); return &M.x86.R_ESI; case 7: DECODE_PRINTF("EDI"); return &M.x86.R_EDI; } HALT_SYS(); return NULL; /* NOTREACHED OR REACHED ON ERROR */}/****************************************************************************PARAMETERS:reg - Register to decodeRETURNS:Pointer to the appropriate registerREMARKS:Return a pointer to the register given by the R/RM field of the
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -