1
0
mirror of https://github.com/pevans/erc-c.git synced 2025-01-03 15:31:29 +00:00

Add paused field, pause execution

This commit is contained in:
Peter Evans 2018-02-07 14:44:04 -06:00
parent 433d9a436f
commit 308a1070ae
2 changed files with 16 additions and 0 deletions

View File

@ -333,6 +333,11 @@ struct apple2 {
* operations you perform are (mostly) targeting that drive.
*/
apple2dd *selected_drive;
/*
* If paused is true, then execution of opcodes is suspended.
*/
bool paused;
};
extern apple2 *apple2_create(int, int);

View File

@ -5,6 +5,8 @@
* need to break this file up into components in the future...
*/
#include <unistd.h>
#include "apple2.h"
#include "apple2.draw.h"
#include "apple2.mem.h"
@ -46,6 +48,9 @@ apple2_create(int width, int height)
// key is pressed
mach->strobe = false;
// Yes, please do execute opcodes to begin with
mach->paused = false;
// Forward set these to NULL in case we fail to build the machine
// properly; that way, we won't try to free garbage data
mach->rom = NULL;
@ -334,6 +339,12 @@ apple2_run_loop(apple2 *mach)
}
while (vm_screen_active(mach->screen)) {
// If we're paused, then just re-loop until we're not
if (mach->paused) {
usleep(100000); // but rest our weary head for a bit
continue;
}
#if 0
mach->drive1->locked = true;
mach->drive2->locked = true;