commit 2e53f8157064cc8c42ba088bc9596a5c055e8584
parent d4188d73c444566caca6fe76efe02b34b73231ac
Author: Brian Swetland <swetland@frotz.net>
Date: Sat, 14 Mar 2020 06:31:36 -0700
emulator: run-forever flag (-n) and putc virtual call
Diffstat:
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/external/oberon-risc-emu/risc5emu.c b/external/oberon-risc-emu/risc5emu.c
@@ -21,6 +21,7 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
+#include <unistd.h>
#include "risc5emu.h"
#include "risc5emu-fp.h"
@@ -345,6 +346,11 @@ static void risc_store_io(struct RISC *risc, uint32_t address, uint32_t value) {
case 0x104:
printf("D %08x\n", value);
break;
+ case 0x108: {
+ uint8_t x = value;
+ write(0, &x, 1);
+ break;
+ }
}
}
}
diff --git a/src/r5e.c b/src/r5e.c
@@ -7,6 +7,7 @@
int main(int argc, char** argv) {
bool trace = false;
+ bool no_cycle_limit = false;
const char* fn = NULL;
int args = 0;
@@ -15,6 +16,8 @@ int main(int argc, char** argv) {
args = argc - 2;
argv += 2;
break;
+ } else if (!strcmp(argv[1], "-n")) {
+ no_cycle_limit = true;
} else if (!strcmp(argv[1], "-t")) {
trace = true;
} else if (argv[1][0] == '-') {
@@ -89,6 +92,9 @@ int main(int argc, char** argv) {
// set SP
risc_set_register(r, 14, sp);
- risc_run(r, 100000000);
+ do {
+ risc_run(r, 100000000);
+ } while (no_cycle_limit);
+
return 0;
}