<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Apr 13, 2012, at 11:53 AM, Mark Cave-Ayland wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>On 22/03/12 12:16, Stephen Ehring wrote:<br><br><blockquote type="cite"><blockquote type="cite">On 2012-Mar-22 00:09 , Programmingkid wrote:<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Is there a way to add words to the end of a definition? If my word is declared like this:<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">: myword<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre"> </span>firstWord<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span>secondWord<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">;<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">is there a way to append a word to the end of this word so it looks like this:<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">: myword<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre"> </span>firstWord<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span>secondWord<span class="Apple-tab-span" style="white-space:pre">  </span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre"> </span>thirdWord<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">;<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">The usual way I'd do something like that if I had to patch a live system would be as follows:<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">ok : anotherWord secondWord thirdWord ;<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">ok patch anotherWord secondWord myword<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">ok<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">You can also use (patch) with the XT's if the words are not externally visible.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Steve<br></blockquote><br>I'm fairly sure that OpenBIOS don't implement either patch or (patch) at the moment. If it's just a case of replacing one XT with another within a word definition, then it shouldn't be too hard - or does it do something more clever?<br><br></div></blockquote></div><div><br></div>I'm surprised this isn't implemented. From the IEEE 1275 spec:<br><div><br></div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10.1px/normal Times; "><font class="Apple-style-span" size="3"><span style="font: normal normal normal 10.1px/normal Courier; ">patch<span class="Apple-tab-span" style="white-space: pre; ">       </span></span>( "new-name< >old-name< >word-to-patch< >" -- ) <span style="font: normal normal normal 9.1px/normal Times; ">Change contents of word-to-patch.</span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 9.1px/normal Times; "><font class="Apple-style-span" face="Courier" size="3">In the compiled definition of word-to-patch, change the first occurrence of old-name to new-name. Works properly even if old-name and/or new-name are numbers.</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 9.1px/normal Times; "><font class="Apple-style-span" face="Courier" size="3">Used as: <span style="font: 9.1px Courier">ok patch 555 test patch-me </span>to edit the definition of patch-me, replacing the command test with the literal value 555. Implementation note:</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 9.1px/normal Times; "><font class="Apple-style-span" face="Courier" size="3">When replacing a command with a number, an implementation might need to automatically create a named constant value for the replacement number. (The reason is that Forth commands often compile into a smaller memory space than literal numbers, so patching a number in place of an existing command is a problem.) A suggested name format is <span style="font: 9.1px Courier">h#---</span>, i.e., the number 555 (hex) would be named “<span style="font: 9.1px Courier">h#555</span>” . A name containing only digits (i.e., <span style="font: 9.1px Courier">555 constant 555</span>) is not recommended, since changing <span style="font: 9.1px Courier">base </span>would cause incorrect evaluation of subsequent uses of that named value.</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 9.1px/normal Times; "><font class="Apple-style-span" face="Courier" size="3"><br></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 9.1px/normal Times; "><font class="Apple-style-span" size="3"><span style="font: 10.1px Courier">(patch)<span class="Apple-tab-span" style="white-space:pre">     </span></span><span style="font: 10.1px Times">( new-n1 num1? old-n2 num2? xt -- ) </span>Change contents of command indicated by xt.</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 9.1px/normal Times; "><font class="Apple-style-span" face="Courier" size="3">In the compiled definition of the command indicated by xt, change the first occurrence of old-n2 to new-n1. n1 and n2 can each be either an execution token or a literal number. The flag num1?, if <span style="font: 9.1px Courier">true</span>, indicates that new-n1 is a literal number. If <span style="font: 9.1px Courier">false</span>, it indicates that new-n1 is an execution token. The flag num2? is interpreted similarly.</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 9.1px/normal Times; "><font class="Apple-style-span" face="Courier" size="3">Used as: <span style="font: normal normal normal 9.1px/normal Courier; ">['] new-name false 555 true ['] patch-me (patch) </span>to edit the definition of patch-me, replacing the value 555 with the command new-name. See: <span style="font: normal normal normal 9.1px/normal Courier; ">patch </span>for more information.</font></div></div></body></html>