Skip to content

Commit e1ab78a

Browse files
committed
yay
1 parent 7f0529d commit e1ab78a

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

examples/example01.s

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
DSK test
22
MX %11
33
ORG $6000
4-
4+
55
FOO EQU $8000
66

77
JSR TEST
88
BRK
9-
9+
1010
TEST LDA #64 ; load 64 into accumulator
11-
ASL ; multiply by two @Au
11+
ASL ; multiply by two @Au
1212
STA FOO ; store result @Au
1313
RTS

p65c02.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ uint16_t start_pc = 0x6000;
3333
uint16_t start_frame_pc = 0xffff;
3434
uint16_t old_pc = 0;
3535

36+
uint8_t brk_encountered = 0;
37+
3638
uint16_t yoffset[192] = {
3739
0x0000, 0x0400, 0x0800, 0x0c00, 0x1000, 0x1400, 0x1800, 0x1c00,
3840
0x0080, 0x0480, 0x0880, 0x0c80, 0x1080, 0x1480, 0x1880, 0x1c80,
@@ -704,7 +706,7 @@ void handle_next_opcode()
704706
branch(1, relative_offset, &cycles);
705707
break;
706708
case BRK:
707-
unhandled_opcode = 1;
709+
brk_encountered = 1;
708710
break;
709711
case BVC:
710712
branch(!test_flag(OVERFLOW), relative_offset, &cycles);
@@ -1181,7 +1183,9 @@ int main(int argc, char** argv)
11811183
uint32_t next_display_refresh = 0;
11821184
uint8_t old_screen_number = 0;
11831185
int last_cycles = -1;
1186+
brk_encountered = 0;
11841187
while (1) {
1188+
if (brk_encountered) break;
11851189
handle_watch(cpu.pc, 0);
11861190
uint16_t old_pc = cpu.pc;
11871191
handle_next_opcode();

0 commit comments

Comments
 (0)