diff --git a/src/apple2.c b/src/apple2.c index f5b6362..96918b5 100644 --- a/src/apple2.c +++ b/src/apple2.c @@ -332,7 +332,12 @@ apple2_run_loop(apple2 *mach) } while (vm_screen_active(mach->screen)) { - //mos6502_dis_opcode(mach->cpu, stdout, mach->cpu->PC); + mach->drive1->locked = true; + mach->drive2->locked = true; + mos6502_dis_opcode(mach->cpu, stdout, mach->cpu->PC); + mach->drive1->locked = false; + mach->drive2->locked = false; + mos6502_execute(mach->cpu); if (vm_screen_dirty(mach->screen)) { diff --git a/src/apple2.dd.c b/src/apple2.dd.c index 14dba2f..ac9a4fc 100644 --- a/src/apple2.dd.c +++ b/src/apple2.dd.c @@ -26,6 +26,7 @@ apple2_dd_create() // ProDOS disk will have 140k, but a NIB file would have more. drive->data = NULL; + drive->locked = false; drive->track_pos = 0; drive->sector_pos = 0; drive->online = false; @@ -216,6 +217,12 @@ apple2_dd_set_mode(apple2dd *drive, int mode) void apple2_dd_shift(apple2dd *drive, int pos) { + // When locked is true, we shouldn't shift our position by any + // number. + if (drive->locked) { + return; + } + drive->sector_pos += pos; while (drive->sector_pos > MAX_SECTOR_POS) {