Following Peter Howkins's suggestion, here attached is part one of support
for powering off from inside the emulator: an implementation of
Portable_CommandBMU with R0=1 (= remove power).
I couldn't work out how to exit the emulator cleanly. As far as I can see
that is only currently done from the front end. I tried setting quited = 1,
but the emulator freezes and then crashes a little while later.
For testing purposes therefore I simply call exit(0); if someone could let
me know what I should be doing, I'd be most grateful!
--
https://rrt.sc3d.org
diff -r 65e3e8e126e5 src/arm_common.c
--- a/src/arm_common.c Wed Oct 24 17:24:45 2018 +0100
+++ b/src/arm_common.c Mon May 20 20:34:55 2019 +0100
@@ -40,6 +40,7 @@
#define SWI_OS_CallASWI 0x6f
#define SWI_OS_CallASWIR12 0x71
+#define SWI_Portable_CommandBMU 0x42fc4
#define SWI_Portable_ReadFeatures 0x42fc5
#define SWI_Portable_Idle 0x42fc6
@@ -362,6 +363,12 @@
swinum = arm.reg[12] & 0xdffff;
}
+ /* Intercept Portable_CommandBMU to turn off */
+ if (swinum == SWI_Portable_CommandBMU) {
+ if (arm.reg[0] == 1) /* Remove power */
+ exit(0); // FIXME
+ }
+
/* Intercept RISC OS Portable SWIs to enable RPCEmu to sleep when
RISC OS is idle */
if (config.cpu_idle) {
_______________________________________________
RPCEmu mailing list
[email protected]
http://www.riscos.info/cgi-bin/mailman/listinfo/rpcemu