micro opt for div
This commit is contained in:
parent
80fe44ce85
commit
42fe341091
1 changed files with 3 additions and 1 deletions
4
cpu.cpp
4
cpu.cpp
|
@ -501,10 +501,12 @@ bool cpu::additional_double_operand_instructions(const uint16_t instr)
|
||||||
int32_t quot = R0R1 / divider;
|
int32_t quot = R0R1 / divider;
|
||||||
uint16_t rem = R0R1 % divider;
|
uint16_t rem = R0R1 % divider;
|
||||||
|
|
||||||
|
// TODO: handle results out of range
|
||||||
|
|
||||||
setRegister(reg, quot);
|
setRegister(reg, quot);
|
||||||
setRegister(reg + 1, rem);
|
setRegister(reg + 1, rem);
|
||||||
|
|
||||||
setPSW_n(R0R1 / divider < 0);
|
setPSW_n(quot < 0);
|
||||||
setPSW_z(quot == 0);
|
setPSW_z(quot == 0);
|
||||||
setPSW_v(quot > 0xffff || quot < -0xffff);
|
setPSW_v(quot > 0xffff || quot < -0xffff);
|
||||||
setPSW_c(false);
|
setPSW_c(false);
|
||||||
|
|
Loading…
Add table
Reference in a new issue