From 8dc5a523de4e0d582e99c629d56fcb3622cbf8e1 Mon Sep 17 00:00:00 2001 From: Ulf Wohlers Date: Mon, 4 Nov 2002 21:27:03 +0000 Subject: [PATCH] support for cpu trap flag Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@479 --- src/cpu/core_16/main.h | 11 ++++++++--- src/cpu/core_16/support.h | 10 ++++++++-- src/cpu/slow_16.cpp | 14 +++++++++++++- 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/src/cpu/core_16/main.h b/src/cpu/core_16/main.h index 1495e42b..2ba5b34a 100644 --- a/src/cpu/core_16/main.h +++ b/src/cpu/core_16/main.h @@ -856,10 +856,15 @@ restart: } break; case 0xcc: /* INT3 */ +#if C_DEBUG + SAVEIP; + if (DEBUG_Breakpoint()) { + LOADIP; + return 1; + } + LOADIP; +#endif INTERRUPT(3); -#if C_DEBUG - return 1; -#endif break; case 0xcd: /* INT Ib */ { diff --git a/src/cpu/core_16/support.h b/src/cpu/core_16/support.h index ace3a10f..5201b75c 100644 --- a/src/cpu/core_16/support.h +++ b/src/cpu/core_16/support.h @@ -376,7 +376,10 @@ countzero: PIC_runIRQs(); \ LOADIP; \ } \ - if (flags.tf) LOG_DEBUG("CPU:Trap Flag not supported"); \ + if (flags.tf) { \ + cpudecoder=&CPU_Real_16_Slow_Decode_Trap; \ + count=0; \ + } \ } #else @@ -394,7 +397,10 @@ countzero: PIC_runIRQs(); \ LOADIP; \ } \ - if (flags.tf) LOG_DEBUG("CPU:Trap Flag not supported"); \ + if (flags.tf) { \ + cpudecoder=&CPU_Real_16_Slow_Decode_Trap; \ + count=0; \ + } \ } #endif diff --git a/src/cpu/slow_16.cpp b/src/cpu/slow_16.cpp index 0bf3d76d..5a1aa242 100644 --- a/src/cpu/slow_16.cpp +++ b/src/cpu/slow_16.cpp @@ -60,7 +60,8 @@ extern Bitu cycle_count; #endif #include "core_16/support.h" -static Bitu CPU_Real_16_Slow_Decode_Special(Bitu count); +static Bitu CPU_Real_16_Slow_Decode_Special(Bits count); +static Bitu CPU_Real_16_Slow_Decode_Trap(Bits count); static Bitu CPU_Real_16_Slow_Decode(Bits count) { #include "core_16/start.h" @@ -78,6 +79,17 @@ static Bitu CPU_Real_16_Slow_Decode(Bits count) { return CBRET_NONE; } +static Bitu CPU_Real_16_Slow_Decode_Trap(Bits count) +{ + CPU_Real_16_Slow_Decode(1); + + LOG_DEBUG("TRAP: Trap Flag executed"); + INTERRUPT(1); + cpudecoder=&CPU_Real_16_Slow_Decode; + + return CBRET_NONE; +}; + static Bitu CPU_Real_16_Slow_Decode_Special(Bits count) { while (count>0) { if (flags.tf) {