1
0
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:
Thomas Harte 2025-03-30 13:39:52 -04:00
parent c6fa72cd83
commit 552f9196af
4 changed files with 23 additions and 4 deletions

View File

@ -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);
}

View File

@ -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;

View File

@ -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);
}
}
}

View File

@ -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;