Add sbb_rm32_imm(0x81,0x83) instruction

This commit is contained in:
tuz358
2018-03-16 13:06:57 +09:00
parent 39decbb5aa
commit 0fb8ec1133
2 changed files with 21 additions and 2 deletions

View File

@@ -118,5 +118,6 @@ public:
void add_rm32_imm(int imm_flag);
void or_rm32_imm(int imm_flag);
void adc_rm32_imm(int imm_flag);
void sbb_rm32_imm(int imm_flag);
void cmp_rm32_imm8();
};

View File

@@ -1175,7 +1175,7 @@ void Instructions::opcode_81(){
adc_rm32_imm(IMM32);
break;
case 3:
// TODO: sbb_rm32_imm32();
sbb_rm32_imm(IMM32);
break;
case 4:
// TODO: and_rm32_imm32();
@@ -1211,7 +1211,7 @@ void Instructions::opcode_83(){
adc_rm32_imm(IMM8);
break;
case 3:
// TODO: sbb_rm32_imm8();
sbb_rm32_imm(IMM8);
break;
case 4:
// TODO: and_rm32_imm8();
@@ -1532,6 +1532,24 @@ void Instructions::adc_rm32_imm(int imm_flag){
this->eip++;
}
void Instructions::sbb_rm32_imm(int imm_flag){
//printf("sbb_rm32_imm called.\n");
this->eip++;
if(imm_flag == IMM8){
uint8_t imm8 = memory.read_uint8(this->eip);
this->registers[this->M] -= imm8 + get_flag(CF);
} else if(imm_flag == IMM32){
uint32_t imm32 = memory.read_uint32(this->eip);
imm32 = swap_endian32(imm32);
this->registers[this->M] -= imm32 + get_flag(CF);
} else {
}
this->eip++;
}
void Instructions::cmp_rm32_imm8(){
//printf("cmp_rm32_imm8 called.\n");