diff --git a/A2Mac.xcodeproj/project.xcworkspace/xcuserdata/trudnai.xcuserdatad/xcdebugger/Expressions.xcexplist b/A2Mac.xcodeproj/project.xcworkspace/xcuserdata/trudnai.xcuserdatad/xcdebugger/Expressions.xcexplist
index 6532aff..bf252e1 100644
--- a/A2Mac.xcodeproj/project.xcworkspace/xcuserdata/trudnai.xcuserdatad/xcdebugger/Expressions.xcexplist
+++ b/A2Mac.xcodeproj/project.xcworkspace/xcuserdata/trudnai.xcuserdatad/xcdebugger/Expressions.xcexplist
@@ -297,6 +297,9 @@
+
+
@@ -469,6 +472,20 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/A2Mac/Base.lproj/Debugger.storyboard b/A2Mac/Base.lproj/Debugger.storyboard
index b20b4b4..284add3 100644
--- a/A2Mac/Base.lproj/Debugger.storyboard
+++ b/A2Mac/Base.lproj/Debugger.storyboard
@@ -239,29 +239,95 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
-
+
@@ -356,8 +422,8 @@ C20D: 4C C5 FE JMP $FEC5
FEC5: 8D 06 C0 STA $C006
-
-
+
+
diff --git a/A2Mac/DebuggerViewController.swift b/A2Mac/DebuggerViewController.swift
index 0d754a5..a1b6898 100644
--- a/A2Mac/DebuggerViewController.swift
+++ b/A2Mac/DebuggerViewController.swift
@@ -190,8 +190,23 @@ N V - B D I Z C
var converted = ""
for chr in line {
+ // make C character NORMAL Apple ][ character
let c = Int(chr.asciiValue!) & 0x3F | 0x80
- converted.append(ViewController.charConvTbl[c])
+
+ // breakpoint marker
+ if c == 0xAA { // '*'
+// converted.append("\u{E895}") // big dot (8x8)
+// converted.append("\u{ED3C}") // big dot2 (8x8)
+// converted.append("\u{E09B}") // right arrow
+// converted.append("\u{E095}") // diamond
+ converted.append("\u{E080}") // closed apple
+// converted.append("\u{E081}") // open apple
+// converted.append("\u{E185}") // checkmark
+ }
+ // normal character
+ else {
+ converted.append(ViewController.charConvTbl[c])
+ }
}
return converted
diff --git a/A2Mac/ViewController.swift b/A2Mac/ViewController.swift
index a082432..742c913 100644
--- a/A2Mac/ViewController.swift
+++ b/A2Mac/ViewController.swift
@@ -1272,6 +1272,11 @@ class ViewController: NSViewController {
if let debugger = DebuggerViewController.shared {
debugger.Update()
}
+ if let debugger = DebuggerWindowController.current {
+ DispatchQueue.main.async {
+ debugger.showWindow(self)
+ }
+ }
}
@@ -1319,6 +1324,9 @@ class ViewController: NSViewController {
case BREAK:
debugBreak()
+ case BREAKPOINT:
+ debugBreak()
+
case RET:
if m6502.debugger.mask.ret == 1 {
// Step_Out / Step_Over
diff --git a/src/cpu/6502.c b/src/cpu/6502.c
index 31e359d..d379bca 100644
--- a/src/cpu/6502.c
+++ b/src/cpu/6502.c
@@ -514,6 +514,7 @@ void m6502_Debug(void) {
cpuState = cpuState_halted;
m6502.debugger.wMask = 0;
m6502.debugger.on = 0;
+ m6502.interrupt = BREAKPOINT;
return;
}
diff --git a/src/cpu/6502.h b/src/cpu/6502.h
index 645e736..28aa1ea 100644
--- a/src/cpu/6502.h
+++ b/src/cpu/6502.h
@@ -77,6 +77,9 @@ typedef enum : uint8_t {
RET, // RTS/RTI Used by Debugger Step_Over / Step_Out
HARDRESET,
SOFTRESET,
+ BREAKPOINT,
+ BREAKIO,
+ BREAKMEM,
} interrupt_t;
diff --git a/src/cpu/6502_bp.c b/src/cpu/6502_bp.c
index 58129f2..b6b2ab7 100644
--- a/src/cpu/6502_bp.c
+++ b/src/cpu/6502_bp.c
@@ -45,7 +45,7 @@ int bp_idx = 0;
/// Swap 2 items
/// @param a Pointer of first item
/// @param b Pointer to second item
-static void swap(uint16_t * a, uint16_t * b) {
+static inline void swap(uint16_t * a, uint16_t * b) {
uint16_t temp = *a;
*a = *b;
*b = temp;
@@ -184,6 +184,7 @@ int m6502_dbg_bp_get_not_empty() {
/// Move array down to eliminate leading zeros
+/// @note: Array must be sorted before this!
void m6502_dbg_bp_compact() {
int i = m6502_dbg_bp_get_not_empty();
memcpy(breakpoints, breakpoints + i, bp_last_idx * sizeof(uint16_t));
diff --git a/src/cpu/6502_bp.h b/src/cpu/6502_bp.h
index e5f1dd0..54d144f 100644
--- a/src/cpu/6502_bp.h
+++ b/src/cpu/6502_bp.h
@@ -13,6 +13,7 @@
#define DEBUG_MAX_BREAKPOINTS 256
extern uint16_t breakpoints[DEBUG_MAX_BREAKPOINTS];
+extern int bp_last_idx;
extern void m6502_dbg_init(void);
extern int m6502_dbg_bp_add(uint16_t addr);