[OpenBIOS] Found out why replacing '\r' with '\n' works

Programmingkid programmingkidx at gmail.com
Tue Apr 19 20:41:18 CEST 2016

On Apr 17, 2016, at 11:05 AM, Mark Cave-Ayland wrote:

> On 17/04/16 15:50, Programmingkid wrote:
>> Good news, I found out why replacing '\r' with '\n' works to boot Mac OS 9. It is because there are several words that require that character to be at the end of the line. 
>> http://www.complang.tuwien.ac.at/forth/1275.ps
>> This is the specifications to Open Firmware. Just do a search for EOL (End of Line a.k.a '\n'). You will see that several words need it in order to work. 
>> They will look like this:
>> dev ( "device-specifier<eol>" -- )	
>> The <eol> text is what specifies that '\n' should be at the end of the line.
> Really? Interesting. Can you provide a self-contained test case that
> demonstrates that it is in fact the line ending that causes this
> independent of the r-stack manipulation? Bear in mind that OpenBIOS may
> deviate from the specification in its behaviour here.

Well I did a test but the results did not go as expected. 

Index: libopenbios/bootinfo_load.c
--- libopenbios/bootinfo_load.c	(revision 1395)
+++ libopenbios/bootinfo_load.c	(working copy)
@@ -262,7 +262,8 @@
 	/* If the payload is bootinfo then we execute it immediately */
 	if (scriptvalid) {
 		DPRINTF("bootscript: %s\n", bootscript);
-		feval(bootscript);
+		//feval(bootscript);
+        feval("dev /chosen\rcr pwd cr");
 		DPRINTF("Unable to parse bootinfo bootscript\n");

In the above code, if the '\r' was causing problems with dev, then this code would not have worked. The thing is it does work. It will print "/chosen" every time. My guess now is there is another word that is next to a '\r' character that can't handle that situation. 

More information about the OpenBIOS mailing list