I made a patch that prints everything that (evaluate) does, hoping it would tell me where execution stopped in the boot script. Here is the patch:
Index: forth/bootstrap/interpreter.fs =================================================================== --- forth/bootstrap/interpreter.fs (revision 1395) +++ forth/bootstrap/interpreter.fs (working copy) @@ -151,6 +151,7 @@ ;
: (evaluate) ( str len -- ??? ) + 2dup fprintk save-source -1 ['] source-id (to) dup Index: kernel/bootstrap.c =================================================================== --- kernel/bootstrap.c (revision 1395) +++ kernel/bootstrap.c (working copy) @@ -89,7 +89,7 @@ "here", "here!", "dobranch", "do?branch", "unaligned-w@", "unaligned-w!", "unaligned-l@", "unaligned-l!", "ioc@", "iow@", "iol@", "ioc!", "iow!", "iol!", "i", "j", "call", "sys-debug", - "$include", "$encode-file", "(debug", "(debug-off)" + "$include", "$encode-file", "(debug", "(debug-off)", "fprintk" };
/* Index: kernel/forth.c =================================================================== --- kernel/forth.c (revision 1395) +++ kernel/forth.c (working copy) @@ -1848,6 +1848,26 @@ PUSH(rstack[rstackcnt - 2]); }
+/* + * fprintk ( addr len -- ) + * writes a forth string to the serial output + */ + +static void fprintk(void) +{ + int len = POP(); + int addr = POP(); + char *message = malloc(sizeof(char) * 5000); + snprintf(message, len + 1, "%s", addr); + int i; + for (i = 0; i < len; i++) { + if (message[i] == '\r') + message[i] = ' '; + } + printk(message); + free(message); +} + /* words[] is a function array of all native code functions used by * the dictionary, i.e. CFAs and primitives. * Any change here needs a matching change in the primitive word's @@ -1963,4 +1983,5 @@ do_encode_file, /* $encode-file */ do_debug_xt, /* (debug */ do_debug_off, /* (debug-off) */ + fprintk, /* fprintk */ }; Index: libc/extra.c =================================================================== --- libc/extra.c (revision 1395) +++ libc/extra.c (working copy) @@ -31,7 +31,7 @@
int forth_printf( const char *fmt, ... ) { - char buf[512]; + char buf[5000]; va_list args; int i;
Well after trying to run Mac OS 9.2 several times, this was the output:
['] display-ih cell+['] frame-buffer-adr cell+['] openbios-video-width cell+['] openbios-video-height cell+['] depth-bits cell+['] line-bytes cell+['] color-palette cell+to fb8-blitmaskto fb8-fillrectto fb8-invertrectto (romfont)to (romfont-height)to (romfont-width)['] vga-driver-fcode 2 cells + 1 byte-load: write dup >r bounds do i c@ fb-emit loop r> ; : draw-logo draw-logo ; : restore reset-screen ; fcode-debug?
============================================================= OpenBIOS 1.1 [May 2 2016 02:45] Configuration device id QEMU version 1 machine id 1 CPUs: 1 Memory: 384M UUID: 00000000-0000-0000-0000-000000000000 CPU type PowerPC,750
milliseconds isn't unique.
bootstrdup encode-string " selected-partition-args" propertystrdup encode-string " selected-partition-args" propertyload-baseload-baseload-baseload-size here >r dev / " model" active-package get-package-property abort" can't find MODEL" decode-string 2swap 2drop " iMac,1" $= ?dup 0= if " compatible" active-package get-package-property abort" can't find COMPATIBLE" false >r begin dup while decode-string here over 2swap bounds ?do i c@ dup [char] A [char] Z between if h# 20 xor then c, loop 2dup " macrisc" $= r> or >r 2drop repeat 2drop r> then r> here - allot 0= abort" this image is not for this platform" decimal 1 load-base load-size 14 - adler32 load-base load-size + 12 - 12 ['] eval catch if 2drop ." , bad checksum value" -1 then <> if ." , checksum error" abort then hex dev /openprom 0 0 " supports-bootinfo" property device-end " /chosen" find-package 0= abort" can't find '/chosen'" constant /chosen " memory" /chosen get-package-property abort" memory??" decode-int constant xmem 2drop " mmu" /chosen get-package-property abort" mmu??" decode-int constant xmmu 2drop " AAPL,debug" " /" find-package 0= abort" can't find '/'"
I don't know if I can trust this output because there appears to be a limit to how much can be printed to the serial console. Sometimes I would see at the end "h# C864630D". I'm not sure why. This text is located at the very end of the boot script file. Past the forth section. I don't think the abort" word is the problem because there is no indication that it aborted the script. Hopefully someone will find this information useful.