Mac OS 9 and earlier require that OpenBIOS has Apple's copyright message in the root node, under the copyright property. This patch adds that message. This patch also removes the code from the adler32 word that did the same thing. Operating systems might need to read the copyright message before the adler32 word is called. So this patch takes care of that problem by supplying the copyright message at startup. This makes the copyright adding code in the adler32 word obsolete. Only the Macintosh emulator will have this message added to the root node. Other machines such as PREP don't run Apple's software so the copyright message will not be added to them.
Signed-off-by: John Arbuckle programmingkidx@gmail.com
Index: arch/ppc/qemu/init.c =================================================================== --- arch/ppc/qemu/init.c (revision 1378) +++ arch/ppc/qemu/init.c (working copy) @@ -739,6 +739,32 @@ RET(s2 << 16 | s1); }
+/* Encodes and decodes a string */ +static void string_encoder (unsigned char *string, int length) { + const int encoder = 1; + int i; + for (i = 0; i < length; i++) { + string[i] ^= encoder; + } +} + +/* + * Adds the copyright string to the root node. + * Classic Mac OS requires it to boot. + */ +static void add_copyright() +{ + const int size_of_string = 60; + unsigned char message[size_of_string + 1]; + snprintf(message, size_of_string + 1, "%s", "Bnqxshfiu!0892,3110!@qqmd!Bnl" + "qtuds-!Hob/!@mm!Shfiur!Sdrdswde"); + string_encoder(message, size_of_string); + push_str(message); + fword("encode-string"); + push_str("copyright"); + fword("property"); +} + void arch_of_init(void) { @@ -827,10 +853,19 @@ fword("encode-int"); push_str("clock-frequency"); fword("property"); + + /* + * We might figure out how to run the classic Mac OS on the g3beige + * target one day + */ + add_copyright(); + break;
case ARCH_MAC99: case ARCH_MAC99_U3: + /* Kept here because PREP isn't made to run Apple's software */ + add_copyright(); case ARCH_PREP: default:
Index: arch/ppc/qemu/qemu.fs =================================================================== --- arch/ppc/qemu/qemu.fs (revision 1378) +++ arch/ppc/qemu/qemu.fs (working copy) @@ -99,19 +99,6 @@ \ -------------------------------------------------------------------------
: adler32 ( adler buf len -- checksum ) - \ Since Mac OS 9 is the only system using this word, we take this - \ opportunity to inject a copyright message that is necessary for the - \ system to boot. - " Copyright 1983-2001 Apple Computer, Inc. THIS MESSAGE FOR COMPATIBILITY ONLY" - encode-string " copyright" - " /" find-package if - " set-property" $find if - execute - else - 3drop drop - then - then - ( adler buf len )
" (adler32)" $find if