On Apr 16, 2016, at 2:49 PM, Mark Cave-Ayland wrote:
On 16/04/16 17:48, Programmingkid wrote:
I wanted to share what I found out. If I remove the '\r' to '\n' patch that allows Mac OS 9 to boot, the boot script will stop executing at a r> word. This is the position:
<BOOT-SCRIPT> here >r dev / cr ." Checkpoint 1" cr " 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 ." checkpoint 1.5" cr 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 ." checkpoint 1.7" cr 2drop r> ." checkpoint 1.7.1" cr then ." checkpoint 1.7.2" cr
r> <--------------- This is where execution stops
Right, this is exactly the same issue. The Forth interpreter executes the boot script in interpret mode so as soon as it hits a command to alter the r-stack in boot script (which is not supposed to happen outside of a Forth word) then the interpreter itself gets confused and execution stops.
Do you have any documentation that states r> can't be used outside of a word? In my book "Forth Programmer's Handbook", it doesn't say anything having to be ran inside of a word.
Maybe Apple's implementation of r> is a little different.
It just so happens that if you feed the chunks into the Forth interpreter in chunks between newlines then it works, but this is really just a lucky coincidence that things work out in this way.
Maybe it is a word somewhere that doesn't consider '\r' to be a whitespace character. Words that might be a problem could be any word that gets its input from the boot script. dev, abort", active-package, and [char] come to mind.