port idiv16
This commit is contained in:
parent
f9d99ac4de
commit
8cc574af22
|
@ -194,7 +194,6 @@ function V86Starter(options)
|
|||
"_load_ldt": function() { return cpu.load_ldt.apply(cpu, arguments); },
|
||||
"_load_tr": function() { return cpu.load_tr.apply(cpu, arguments); },
|
||||
|
||||
"_idiv16": function() { return cpu.idiv16.apply(cpu, arguments); },
|
||||
"_insb": function() { return cpu.insb.apply(cpu, arguments); },
|
||||
"_insw": function() { return cpu.insw.apply(cpu, arguments); },
|
||||
"_insd": function() { return cpu.insd.apply(cpu, arguments); },
|
||||
|
|
|
@ -280,6 +280,7 @@ CPU.prototype.wasm_patch = function(wm)
|
|||
this.trigger_gp = this.wm.funcs['_trigger_gp'];
|
||||
this.div32 = this.wm.funcs['_div32'];
|
||||
this.idiv32 = this.wm.funcs['_idiv32'];
|
||||
this.idiv16 = this.wm.funcs['_idiv16'];
|
||||
|
||||
this.shl8 = this.wm.funcs['_shl8'];
|
||||
this.shl16 = this.wm.funcs['_shl16'];
|
||||
|
|
|
@ -815,6 +815,28 @@ void div16(uint32_t source_operand)
|
|||
}
|
||||
}
|
||||
|
||||
void idiv16(int32_t source_operand)
|
||||
{
|
||||
if(source_operand == 0)
|
||||
{
|
||||
trigger_de();
|
||||
return;
|
||||
}
|
||||
|
||||
int32_t target_operand = reg16[AX] | (reg16[DX] << 16);
|
||||
int32_t result = target_operand / source_operand;
|
||||
|
||||
if(result >= 0x8000 || result <= -0x8001)
|
||||
{
|
||||
trigger_de();
|
||||
}
|
||||
else
|
||||
{
|
||||
reg16[AX] = result;
|
||||
reg16[DX] = target_operand % source_operand;
|
||||
}
|
||||
}
|
||||
|
||||
void div32(uint32_t source_operand)
|
||||
{
|
||||
if(source_operand == 0)
|
||||
|
|
|
@ -182,7 +182,7 @@ int32_t rol32(int32_t, int32_t);
|
|||
int32_t rcr32(int32_t, int32_t);
|
||||
int32_t rcl32(int32_t, int32_t);
|
||||
|
||||
int32_t idiv16(int32_t);
|
||||
void idiv16(int32_t);
|
||||
void div32(uint32_t);
|
||||
void idiv32(int32_t);
|
||||
|
||||
|
|
Loading…
Reference in a new issue