void _Compile_JCC ( int32 negFlag, int32 ttt, uint32 disp ) { _Set_SCA ( 0 ) ; _Compile_Int8 ( 0xf ) ; // little endian ordering _Compile_Int8 ( 0x8 << 4 | ttt << 1 | negFlag ) ; // little endian ordering _Compile_Int32 ( disp ) ; }
void _Compile_JCC ( int32 negFlag, int32 ttt, byte * jmpToAddr ) { unsigned int disp ; if ( jmpToAddr ) { disp = _CalculateOffsetForCallOrJump ( Here + 1, jmpToAddr, 1 ) ; } else disp = 0 ; // allow this function to be used to have a delayed compile of the actual address _Compile_Int8 ( 0xf ) ; // little endian ordering _Compile_Int8 ( 0x8 << 4 | ttt << 1 | negFlag ) ; // little endian ordering _Compile_Int32 ( disp ) ; }
void _Compile_ModRmSibDisplacement ( int32 modRm, int32 modRmFlag, int32 sib, int disp ) { if ( modRmFlag ) _Compile_Int8 ( modRm ) ; if ( sib ) _Compile_Int8 ( sib ) ; // sib = sib_modFlag if sib_modFlag > 1 if ( modRmFlag ) { if ( disp ) _Compile_Displacement ( modRm, disp ) ; } else if ( disp ) _Compile_Int32 ( disp ) ; }
void _Compile_Displacement ( int32 modRm, int32 disp ) { int32 mod = modRm & 0xc0 ; // 1100 0000 int32 reg = modRm & 0x38 ; // 0011 1000 if ( ( ( ( mod == 0 ) && ( reg != ESP ) && disp ) ) || ( ( mod == 1 ) && ( disp >= 0x100 ) ) || ( ( mod == 2 ) && ( disp <= 0xff ) ) ) { CfrTil_Exception ( MACHINE_CODE_ERROR, 1 ) ; } else if ( disp ) { if ( disp >= 0x100 ) _Compile_Int32 ( disp ) ; else _Compile_Int8 ( ( byte ) disp ) ; } }
void _Compile_ImmediateData ( int32 imm, int32 immSize ) { // to not compile an imm when imm is a parameter, set isize == 0 and imm == 0 if ( immSize > 0 ) { if ( immSize == BYTE ) _Compile_Int8 ( ( byte ) imm ) ; else if ( immSize == CELL ) _Compile_Cell ( imm ) ; } else // with operandSize == 0 let the compiler use the minimal size ; nb. can't be imm == 0 { if ( imm >= 0x100 ) _Compile_Int32 ( imm ) ; else if ( imm ) _Compile_Int8 ( ( byte ) imm ) ; } }