From e1ab78a4e745d0d56f80e4170c674f1d09c28322 Mon Sep 17 00:00:00 2001 From: Michael Specht Date: Tue, 10 Jan 2023 13:58:42 +0100 Subject: [PATCH] yay --- examples/example01.s | 6 +++--- p65c02.c | 6 +++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/examples/example01.s b/examples/example01.s index e89acc7..ac51c11 100644 --- a/examples/example01.s +++ b/examples/example01.s @@ -1,13 +1,13 @@ DSK test MX %11 ORG $6000 - + FOO EQU $8000 JSR TEST BRK - + TEST LDA #64 ; load 64 into accumulator - ASL ; multiply by two @Au + ASL ; multiply by two @Au STA FOO ; store result @Au RTS diff --git a/p65c02.c b/p65c02.c index 66eb0b0..46faf2a 100644 --- a/p65c02.c +++ b/p65c02.c @@ -33,6 +33,8 @@ uint16_t start_pc = 0x6000; uint16_t start_frame_pc = 0xffff; uint16_t old_pc = 0; +uint8_t brk_encountered = 0; + uint16_t yoffset[192] = { 0x0000, 0x0400, 0x0800, 0x0c00, 0x1000, 0x1400, 0x1800, 0x1c00, 0x0080, 0x0480, 0x0880, 0x0c80, 0x1080, 0x1480, 0x1880, 0x1c80, @@ -704,7 +706,7 @@ void handle_next_opcode() branch(1, relative_offset, &cycles); break; case BRK: - unhandled_opcode = 1; + brk_encountered = 1; break; case BVC: branch(!test_flag(OVERFLOW), relative_offset, &cycles); @@ -1181,7 +1183,9 @@ int main(int argc, char** argv) uint32_t next_display_refresh = 0; uint8_t old_screen_number = 0; int last_cycles = -1; + brk_encountered = 0; while (1) { + if (brk_encountered) break; handle_watch(cpu.pc, 0); uint16_t old_pc = cpu.pc; handle_next_opcode();