mirror of
https://github.com/TomHarte/CLK.git
synced 2025-04-21 18:37:11 +00:00
Convert INTO, AAM; map which instructions post their IP.
This commit is contained in:
parent
c6fa72cd83
commit
552f9196af
@ -175,7 +175,6 @@ void divide_error(ContextT &context) {
|
||||
// additional context (primarily: IP of this instruction, not the next).
|
||||
if constexpr (uses_8086_exceptions(ContextT::model)) {
|
||||
interrupt(Interrupt::DivideError, context);
|
||||
return;
|
||||
} else {
|
||||
throw Exception(Interrupt::DivideError);
|
||||
}
|
||||
|
@ -75,8 +75,12 @@ void aam(
|
||||
If ... an immediate value of 0 is used, it will cause a #DE (divide error) exception.
|
||||
*/
|
||||
if(!imm) {
|
||||
interrupt(Interrupt::DivideError, context);
|
||||
return;
|
||||
if constexpr (uses_8086_exceptions(ContextT::model)) {
|
||||
interrupt(Interrupt::DivideError, context);
|
||||
return;
|
||||
} else {
|
||||
throw Exception(Interrupt::DivideError);
|
||||
}
|
||||
}
|
||||
|
||||
ax.halves.high = ax.halves.low / imm;
|
||||
|
@ -236,7 +236,11 @@ void into(
|
||||
ContextT &context
|
||||
) {
|
||||
if(context.flags.template flag<Flag::Overflow>()) {
|
||||
interrupt(Interrupt::Overflow, context);
|
||||
if constexpr (uses_8086_exceptions(ContextT::model)) {
|
||||
interrupt(Interrupt::Overflow, context);
|
||||
} else {
|
||||
throw Exception(Interrupt::Overflow);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -67,6 +67,18 @@ constexpr bool has_error_code(const Interrupt interrupt) {
|
||||
}
|
||||
}
|
||||
|
||||
constexpr bool posts_next_instruction_ip(const Interrupt interrupt) {
|
||||
switch(interrupt) {
|
||||
default:
|
||||
return false;
|
||||
|
||||
case Interrupt::SingleStep:
|
||||
case Interrupt::Breakpoint:
|
||||
case Interrupt::Overflow:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
struct Code {
|
||||
uint16_t value = 0;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user