Mac OS 9's bootscript uses '\r' a lot. These interfere with how OpenBIOS functions. So the solution is to translate them to '\n' characters. This will allow Mac OS 9 to boot.
Signed-off-by: John Arbuckle programmingkidx@gmail.com
These are the operating systems I used to test my patch. - Mac OS 10.4.0 - Mac OS 9.2 - Fedora Linux 17 - Debian Linux 5
No regressions have been detected.
Index: libopenbios/bootinfo_load.c =================================================================== --- libopenbios/bootinfo_load.c (revision 1391) +++ libopenbios/bootinfo_load.c (working copy) @@ -190,7 +190,10 @@ while (current < size) {
c = base[current++]; - + if(c == '\r') { + c = '\n'; + } + if (c == '<') { script = 0; tag = 1;
On 14/04/16 23:55, Programmingkid wrote:
Mac OS 9's bootscript uses '\r' a lot. These interfere with how OpenBIOS functions. So the solution is to translate them to '\n' characters. This will allow Mac OS 9 to boot.
Signed-off-by: John Arbuckle programmingkidx@gmail.com
These are the operating systems I used to test my patch.
- Mac OS 10.4.0
- Mac OS 9.2
- Fedora Linux 17
- Debian Linux 5
No regressions have been detected.
Index: libopenbios/bootinfo_load.c
--- libopenbios/bootinfo_load.c (revision 1391) +++ libopenbios/bootinfo_load.c (working copy) @@ -190,7 +190,10 @@ while (current < size) {
c = base[current++];
if(c == '\r') {
c = '\n';
}
if (c == '<') { script = 0; tag = 1;
Some thoughts on this patch: compared with the other patch for interpreter.fs my feeling on reflection is that if we're going to have a hack for OS 9, a nice isolated piece of code in the loader is going to be preferable for the reason that it doesn't involve changes to the Forth interpreter which can affect all architectures.
Can you demonstrate how the patch breaks down the OS 9 loader into sections terminated by LF so we can see the individual chunks that are passed to "interpret". With this it is possible to get a good understanding as to how the patch works and determine how it will affect other OSs.
Also according to my inbox this workaround was originally authored by Cormac and I don't see any attribution at all?
ATB,
Mark.
On Apr 15, 2016, at 6:45 AM, Mark Cave-Ayland wrote:
On 14/04/16 23:55, Programmingkid wrote:
Mac OS 9's bootscript uses '\r' a lot. These interfere with how OpenBIOS functions. So the solution is to translate them to '\n' characters. This will allow Mac OS 9 to boot.
Signed-off-by: John Arbuckle programmingkidx@gmail.com
These are the operating systems I used to test my patch.
- Mac OS 10.4.0
- Mac OS 9.2
- Fedora Linux 17
- Debian Linux 5
No regressions have been detected.
Index: libopenbios/bootinfo_load.c
--- libopenbios/bootinfo_load.c (revision 1391) +++ libopenbios/bootinfo_load.c (working copy) @@ -190,7 +190,10 @@ while (current < size) {
c = base[current++];
if(c == '\r') {
c = '\n';
}
if (c == '<') { script = 0; tag = 1;
Some thoughts on this patch: compared with the other patch for interpreter.fs my feeling on reflection is that if we're going to have a hack for OS 9, a nice isolated piece of code in the loader is going to be preferable for the reason that it doesn't involve changes to the Forth interpreter which can affect all architectures.
Which file do you have in mind?
Can you demonstrate how the patch breaks down the OS 9 loader into sections terminated by LF so we can see the individual chunks that are passed to "interpret". With this it is possible to get a good understanding as to how the patch works and determine how it will affect other OSs.
Why do you think the loader terminates sections by Line Feed? Did you mean New Line?
Were you able to test out this patch on any of your operating systems? If there are any incompatibilities with any of them, I would like to try to reproduce the problem on my computer.
Also according to my inbox this workaround was originally authored by Cormac and I don't see any attribution at all?
I found out this was Cormac's idea later and I had just rediscovered it. The next patch will see an acknowledgement of his work.
On 15/04/16 17:05, Programmingkid wrote:
Can you demonstrate how the patch breaks down the OS 9 loader into sections terminated by LF so we can see the individual chunks that are passed to "interpret". With this it is possible to get a good understanding as to how the patch works and determine how it will affect other OSs.
Why do you think the loader terminates sections by Line Feed? Did you mean New Line?
Simply extract the OS 9 bootloader and break it into individual sections terminated by either a CR/LF so we can see how bootinfo_load.c segments its calls into the Forth interpreter.
ATB,
Mark.
On Apr 15, 2016, at 12:20 PM, Mark Cave-Ayland wrote:
On 15/04/16 17:05, Programmingkid wrote:
Can you demonstrate how the patch breaks down the OS 9 loader into sections terminated by LF so we can see the individual chunks that are passed to "interpret". With this it is possible to get a good understanding as to how the patch works and determine how it will affect other OSs.
Why do you think the loader terminates sections by Line Feed? Did you mean New Line?
Simply extract the OS 9 bootloader and break it into individual sections terminated by either a CR/LF so we can see how bootinfo_load.c segments its calls into the Forth interpreter.
Ok. I think I can print every word to the serial console. I will try to make this into a patch.
On Apr 15, 2016, at 12:20 PM, Mark Cave-Ayland wrote:
On 15/04/16 17:05, Programmingkid wrote:
Can you demonstrate how the patch breaks down the OS 9 loader into sections terminated by LF so we can see the individual chunks that are passed to "interpret". With this it is possible to get a good understanding as to how the patch works and determine how it will affect other OSs.
Why do you think the loader terminates sections by Line Feed? Did you mean New Line?
Simply extract the OS 9 bootloader and break it into individual sections terminated by either a CR/LF so we can see how bootinfo_load.c segments its calls into the Forth interpreter.
So you want something like this:
#include <stdio.h> #include <string.h>
void print_words(char c) { static char buffer[100] = ""; static int index = 0; static int word_count = 0;
// if whitespace is detected if(c == '\r' || c == '\n' || c == ' ') { word_count++; buffer[index] = '\0'; printf("Word %d: %10s \tsize: %d\n", word_count, buffer, strlen(buffer)); index = 0; return; }
buffer[index] = c; index++; }
int main (int argc, const char * argv[]) { char mystring[100] = "The quick brown fox jumps over the lazy dog"; mystring[3] = '\r'; mystring[9] = '\n'; for (int i = 0; i < strlen(mystring); i++) { print_words(mystring[i]); }
return 0; }
Output:
Word 1: The size: 3 Word 2: quick size: 5 Word 3: brown size: 5 Word 4: fox size: 3 Word 5: jumps size: 5 Word 6: over size: 4 Word 7: the size: 3 Word 8: lazy size: 4
I will implement this into OpenBIOS if this is what you want.
On Apr 15, 2016, at 12:20 PM, Mark Cave-Ayland wrote:
On 15/04/16 17:05, Programmingkid wrote:
Can you demonstrate how the patch breaks down the OS 9 loader into sections terminated by LF so we can see the individual chunks that are passed to "interpret". With this it is possible to get a good understanding as to how the patch works and determine how it will affect other OSs.
Why do you think the loader terminates sections by Line Feed? Did you mean New Line?
Simply extract the OS 9 bootloader and break it into individual sections terminated by either a CR/LF so we can see how bootinfo_load.c segments its calls into the Forth interpreter.
Well I did a few tests to see if I could break feval() using the '\r' character. To my surprise, it didn't break.
I placed this code near the top of the bootinfo_init_program() in bootinfo_load.c:
char *fword; fword = malloc(10 * sizeof(char));
sprintf(fword, "%s", "banner"); feval(fword);
sprintf(fword, "%s%c", "banner", '\r'); feval(fword);
sprintf(fword, "%s%c%c", "banner", '\r', '\r'); feval(fword);
If the '\r' character does break feval(), then the last two calls would fail. They instead work. I will continue to investigate why the translation works.
On Apr 15, 2016, at 12:20 PM, Mark Cave-Ayland wrote:
On 15/04/16 17:05, Programmingkid wrote:
Can you demonstrate how the patch breaks down the OS 9 loader into sections terminated by LF so we can see the individual chunks that are passed to "interpret". With this it is possible to get a good understanding as to how the patch works and determine how it will affect other OSs.
Why do you think the loader terminates sections by Line Feed? Did you mean New Line?
Simply extract the OS 9 bootloader and break it into individual sections terminated by either a CR/LF so we can see how bootinfo_load.c segments its calls into the Forth interpreter.
I had my code break the bootscript variable by CR, LF, and space. This is the code: if(c == ' ' || c == 0xa || c == 0xd) {
Here is the list:
Word 1: size: 0 Word 2: here size: 4 Word 3: >r size: 2 Word 4: dev size: 3 Word 5: / size: 1 Word 6: " size: 1 Word 7: model" size: 6 Word 8: active-package size: 14 Word 9: get-package-property size: 20 Word 10: abort" size: 6 Word 11: can't size: 5 Word 12: find size: 4 Word 13: MODEL" size: 6 Word 14: decode-string size: 13 Word 15: 2swap size: 5 Word 16: 2drop size: 5 Word 17: " size: 1 Word 18: iMac,1" size: 7 Word 19: $= size: 2 Word 20: ?dup size: 4 Word 21: 0= size: 2 Word 22: if size: 2 Word 23: size: 0 Word 24: " size: 1 Word 25: compatible" size: 11 Word 26: active-package size: 14 Word 27: get-package-property size: 20 Word 28: abort" size: 6 Word 29: can't size: 5 Word 30: find size: 4 Word 31: COMPATIBLE" size: 11 Word 32: size: 0 Word 33: false size: 5 Word 34: >r size: 2 Word 35: size: 0 Word 36: begin size: 5 Word 37: size: 0 Word 38: size: 0 Word 39: dup size: 3 Word 40: while size: 5 Word 41: size: 0 Word 42: size: 0 Word 43: decode-string size: 13 Word 44: here size: 4 Word 45: over size: 4 Word 46: 2swap size: 5 Word 47: bounds size: 6 Word 48: ?do size: 3 Word 49: size: 0 Word 50: size: 0 Word 51: size: 0 Word 52: i size: 1 Word 53: c@ size: 2 Word 54: dup size: 3 Word 55: [char] size: 6 Word 56: A size: 1 Word 57: [char] size: 6 Word 58: Z size: 1 Word 59: between size: 7 Word 60: if size: 2 Word 61: h# size: 2 Word 62: 20 size: 2 Word 63: xor size: 3 Word 64: then size: 4 Word 65: c, size: 2 Word 66: size: 0 Word 67: size: 0 Word 68: size: 0 Word 69: loop size: 4 Word 70: size: 0 Word 71: size: 0 Word 72: 2dup size: 4 Word 73: " size: 1 Word 74: macrisc" size: 8 Word 75: $= size: 2 Word 76: r> size: 2 Word 77: or size: 2 Word 78: >r size: 2 Word 79: size: 0 Word 80: size: 0 Word 81: 2drop size: 5 Word 82: size: 0 Word 83: size: 0 Word 84: repeat size: 6 Word 85: size: 0 Word 86: 2drop size: 5 Word 87: r> size: 2 Word 88: size: 0 Word 89: size: 0 Word 90: then size: 4 Word 91: r> size: 2 Word 92: here size: 4 Word 93: - size: 1 Word 94: allot size: 5 Word 95: 0= size: 2 Word 96: abort" size: 6 Word 97: this size: 4 Word 98: image size: 5 Word 99: is size: 2 Word 100: not size: 3 Word 101: for size: 3 Word 102: this size: 4 Word 103: platform" size: 9 Word 104: decimal size: 7 Word 105: 1 size: 1 Word 106: load-base size: 9 Word 107: load-size size: 9 Word 108: 14 size: 2 Word 109: - size: 1 Word 110: adler32 size: 7 Word 111: size: 0 Word 112: size: 0 Word 113: size: 0 Word 114: load-base size: 9 Word 115: load-size size: 9 Word 116: + size: 1 Word 117: 12 size: 2 Word 118: - size: 1 Word 119: 12 size: 2 Word 120: ['] size: 3 Word 121: eval size: 4 Word 122: catch size: 5 Word 123: if size: 2 Word 124: size: 0 Word 125: 2drop size: 5 Word 126: ." size: 2 Word 127: , size: 1 Word 128: bad size: 3 Word 129: checksum size: 8 Word 130: value" size: 6 Word 131: -1 size: 2 Word 132: size: 0 Word 133: size: 0 Word 134: then size: 4 Word 135: size: 0 Word 136: <> size: 2 Word 137: if size: 2 Word 138: size: 0 Word 139: ." size: 2 Word 140: , size: 1 Word 141: checksum size: 8 Word 142: error" size: 6 Word 143: size: 0 Word 144: abort size: 5 Word 145: size: 0 Word 146: size: 0 Word 147: then size: 4 Word 148: hex size: 3 Word 149: dev size: 3 Word 150: /openprom size: 9 Word 151: 0 size: 1 Word 152: 0 size: 1 Word 153: " size: 1 Word 154: supports-bootinfo" size: 18 Word 155: property size: 8 Word 156: size: 0 Word 157: device-end size: 10 Word 158: " size: 1 Word 159: /chosen" size: 8 Word 160: find-package size: 12 Word 161: 0= size: 2 Word 162: abort" size: 6 Word 163: can't size: 5 Word 164: find size: 4 Word 165: '/chosen'" size: 10 Word 166: constant size: 8 Word 167: /chosen size: 7 Word 168: " size: 1 Word 169: memory" size: 7 Word 170: /chosen size: 7 Word 171: get-package-property size: 20 Word 172: abort" size: 6 Word 173: memory??" size: 9 Word 174: decode-int size: 10 Word 175: constant size: 8 Word 176: xmem size: 4 Word 177: 2drop size: 5 Word 178: " size: 1 Word 179: mmu" size: 4 Word 180: /chosen size: 7 Word 181: get-package-property size: 20 Word 182: abort" size: 6 Word 183: mmu??" size: 6 Word 184: decode-int size: 10 Word 185: constant size: 8 Word 186: xmmu size: 4 Word 187: 2drop size: 5 Word 188: " size: 1 Word 189: AAPL,debug" size: 11 Word 190: " size: 1 Word 191: /" size: 2 Word 192: find-package size: 12 Word 193: 0= size: 2 Word 194: abort" size: 6 Word 195: can't size: 5 Word 196: find size: 4 Word 197: '/'" size: 4 Word 198: get-package-property size: 20 Word 199: if size: 2 Word 200: size: 0 Word 201: size: 0 Word 202: size: 0 Word 203: false size: 5 Word 204: size: 0 Word 205: size: 0 Word 206: else size: 4 Word 207: size: 0 Word 208: 2drop size: 5 Word 209: true size: 4 Word 210: size: 0 Word 211: size: 0 Word 212: then size: 4 Word 213: size: 0 Word 214: constant size: 8 Word 215: debug? size: 6 Word 216: debug? size: 6 Word 217: if size: 2 Word 218: cr size: 2 Word 219: ." size: 2 Word 220: checking size: 8 Word 221: for size: 3 Word 222: RELEASE-LOAD-AREA" size: 18 Word 223: then size: 4 Word 224: " size: 1 Word 225: release-load-area" size: 18 Word 226: $find size: 5 Word 227: 0= size: 2 Word 228: if size: 2 Word 229: 2drop size: 5 Word 230: false size: 5 Word 231: then size: 4 Word 232: size: 0 Word 233: constant size: 8 Word 234: 'release-load-area size: 18 Word 235: debug? size: 6 Word 236: if size: 2 Word 237: 'release-load-area size: 18 Word 238: if size: 2 Word 239: ." size: 2 Word 240: , size: 1 Word 241: found size: 5 Word 242: it" size: 3 Word 243: else size: 4 Word 244: ." size: 2 Word 245: , size: 1 Word 246: not size: 3 Word 247: found" size: 6 Word 248: then size: 4 Word 249: then size: 4 Word 250: : size: 1 Word 251: do-translate size: 12 Word 252: " size: 1 Word 253: translate" size: 10 Word 254: xmmu size: 4 Word 255: $call-method size: 12 Word 256: ; size: 1 Word 257: : size: 1 Word 258: do-map size: 6 Word 259: size: 0 Word 260: " size: 1 Word 261: map" size: 4 Word 262: xmmu size: 4 Word 263: $call-method size: 12 Word 264: ; size: 1 Word 265: : size: 1 Word 266: do-unmap size: 8 Word 267: " size: 1 Word 268: unmap" size: 6 Word 269: xmmu size: 4 Word 270: $call-method size: 12 Word 271: ; size: 1 Word 272: : size: 1 Word 273: claim-mem size: 9 Word 274: size: 0 Word 275: " size: 1 Word 276: claim" size: 6 Word 277: xmem size: 4 Word 278: $call-method size: 12 Word 279: ; size: 1 Word 280: : size: 1 Word 281: release-mem size: 11 Word 282: " size: 1 Word 283: release" size: 8 Word 284: xmem size: 4 Word 285: $call-method size: 12 Word 286: ; size: 1 Word 287: : size: 1 Word 288: claim-virt size: 10 Word 289: " size: 1 Word 290: claim" size: 6 Word 291: xmmu size: 4 Word 292: $call-method size: 12 Word 293: ; size: 1 Word 294: : size: 1 Word 295: release-virt size: 12 Word 296: " size: 1 Word 297: release" size: 8 Word 298: xmmu size: 4 Word 299: $call-method size: 12 Word 300: ; size: 1 Word 301: 1000 size: 4 Word 302: constant size: 8 Word 303: pagesz size: 6 Word 304: pagesz size: 6 Word 305: 1- size: 2 Word 306: constant size: 8 Word 307: pagesz-1 size: 8 Word 308: -1000 size: 5 Word 309: constant size: 8 Word 310: pagemask size: 8 Word 311: h# size: 2 Word 312: 005000 size: 6 Word 313: constant size: 8 Word 314: elf-offset size: 10 Word 315: h# size: 2 Word 316: 016FC0 size: 6 Word 317: constant size: 8 Word 318: elf-size size: 8 Word 319: elf-size size: 8 Word 320: pagesz-1 size: 8 Word 321: + size: 1 Word 322: pagemask size: 8 Word 323: and size: 3 Word 324: constant size: 8 Word 325: elf-pages size: 9 Word 326: h# size: 2 Word 327: 01BFC0 size: 6 Word 328: constant size: 8 Word 329: parcels-offset size: 14 Word 330: h# size: 2 Word 331: 2532FC size: 6 Word 332: constant size: 8 Word 333: parcels-size size: 12 Word 334: parcels-size size: 12 Word 335: pagesz-1 size: 8 Word 336: + size: 1 Word 337: pagemask size: 8 Word 338: and size: 3 Word 339: constant size: 8 Word 340: parcels-pages size: 13 Word 341: h# size: 2 Word 342: 26F2BC size: 6 Word 343: constant size: 8 Word 344: info-size size: 9 Word 345: info-size size: 9 Word 346: pagesz-1 size: 8 Word 347: + size: 1 Word 348: pagemask size: 8 Word 349: and size: 3 Word 350: constant size: 8 Word 351: info-pages size: 10 Word 352: 0 size: 1 Word 353: value size: 5 Word 354: load-base-claim size: 15 Word 355: 0 size: 1 Word 356: value size: 5 Word 357: info-base size: 9 Word 358: 'release-load-area size: 18 Word 359: if size: 2 Word 360: size: 0 Word 361: size: 0 Word 362: size: 0 Word 363: size: 0 Word 364: load-base size: 9 Word 365: to size: 2 Word 366: info-base size: 9 Word 367: size: 0 Word 368: size: 0 Word 369: else size: 4 Word 370: size: 0 Word 371: size: 0 Word 372: size: 0 Word 373: size: 0 Word 374: load-base size: 9 Word 375: info-pages size: 10 Word 376: 0 size: 1 Word 377: ['] size: 3 Word 378: claim-mem size: 9 Word 379: catch size: 5 Word 380: if size: 2 Word 381: 3drop size: 5 Word 382: 0 size: 1 Word 383: then size: 4 Word 384: to size: 2 Word 385: load-base-claim size: 15 Word 386: size: 0 Word 387: size: 0 Word 388: size: 0 Word 389: size: 0 Word 390: info-pages size: 10 Word 391: 1000 size: 4 Word 392: claim-virt size: 10 Word 393: to size: 2 Word 394: info-base size: 9 Word 395: size: 0 Word 396: size: 0 Word 397: size: 0 Word 398: size: 0 Word 399: load-base size: 9 Word 400: info-base size: 9 Word 401: info-pages size: 10 Word 402: 10 size: 2 Word 403: do-map size: 6 Word 404: size: 0 Word 405: size: 0 Word 406: then size: 4 Word 407: \ size: 1 Word 408: allocate size: 8 Word 409: room size: 4 Word 410: for size: 3 Word 411: both size: 4 Word 412: images size: 6 Word 413: parcels-pages size: 13 Word 414: 400000 size: 6 Word 415: claim-mem size: 9 Word 416: constant size: 8 Word 417: rom-phys size: 8 Word 418: parcels-pages size: 13 Word 419: 1000 size: 4 Word 420: claim-virt size: 10 Word 421: constant size: 8 Word 422: rom-virt size: 8 Word 423: rom-phys size: 8 Word 424: rom-virt size: 8 Word 425: parcels-pages size: 13 Word 426: 10 size: 2 Word 427: do-map size: 6 Word 428: size: 0 Word 429: size: 0 Word 430: elf-pages size: 9 Word 431: 1000 size: 4 Word 432: claim-mem size: 9 Word 433: constant size: 8 Word 434: elf-phys size: 8 Word 435: size: 0 Word 436: size: 0 Word 437: elf-pages size: 9 Word 438: 1000 size: 4 Word 439: claim-virt size: 10 Word 440: constant size: 8 Word 441: elf-virt size: 8 Word 442: elf-phys size: 8 Word 443: elf-virt size: 8 Word 444: elf-pages size: 9 Word 445: 10 size: 2 Word 446: do-map size: 6 Word 447: size: 0 Word 448: size: 0 Word 449: size: 0 Word 450: info-base size: 9 Word 451: elf-offset size: 10 Word 452: + size: 1 Word 453: elf-virt size: 8 Word 454: elf-size size: 8 Word 455: move size: 4 Word 456: size: 0 Word 457: debug? size: 6 Word 458: if size: 2 Word 459: cr size: 2 Word 460: ." size: 2 Word 461: elf-phys,elf-virt,elf-pages: size: 28 Word 462: " size: 1 Word 463: elf-phys size: 8 Word 464: u. size: 2 Word 465: ." size: 2 Word 466: , size: 1 Word 467: " size: 1 Word 468: elf-virt size: 8 Word 469: u. size: 2 Word 470: ." size: 2 Word 471: , size: 1 Word 472: " size: 1 Word 473: elf-pages size: 9 Word 474: u. size: 2 Word 475: then size: 4 Word 476: \ size: 1 Word 477: copy size: 4 Word 478: the size: 3 Word 479: compressed size: 10 Word 480: image size: 5 Word 481: debug? size: 6 Word 482: if size: 2 Word 483: cr size: 2 Word 484: ." size: 2 Word 485: copying size: 7 Word 486: compressed size: 10 Word 487: ROM size: 3 Word 488: image" size: 6 Word 489: then size: 4 Word 490: rom-virt size: 8 Word 491: parcels-pages size: 13 Word 492: 0 size: 1 Word 493: fill size: 4 Word 494: info-base size: 9 Word 495: parcels-offset size: 14 Word 496: + size: 1 Word 497: rom-virt size: 8 Word 498: parcels-size size: 12 Word 499: move size: 4 Word 500: 'release-load-area size: 18 Word 501: 0= size: 2 Word 502: if size: 2 Word 503: size: 0 Word 504: size: 0 Word 505: size: 0 Word 506: size: 0 Word 507: info-base size: 9 Word 508: info-pages size: 10 Word 509: do-unmap size: 8 Word 510: size: 0 Word 511: size: 0 Word 512: size: 0 Word 513: size: 0 Word 514: size: 0 Word 515: load-base-claim size: 15 Word 516: ?dup size: 4 Word 517: if size: 2 Word 518: info-pages size: 10 Word 519: release-mem size: 11 Word 520: then size: 4 Word 521: size: 0 Word 522: size: 0 Word 523: then size: 4 Word 524: debug? size: 6 Word 525: if size: 2 Word 526: cr size: 2 Word 527: ." size: 2 Word 528: MacOS-ROM size: 9 Word 529: phys,virt,size: size: 15 Word 530: " size: 1 Word 531: rom-phys size: 8 Word 532: u. size: 2 Word 533: ." size: 2 Word 534: , size: 1 Word 535: " size: 1 Word 536: rom-virt size: 8 Word 537: u. size: 2 Word 538: ." size: 2 Word 539: , size: 1 Word 540: " size: 1 Word 541: parcels-size size: 12 Word 542: u. size: 2 Word 543: then size: 4 Word 544: \ size: 1 Word 545: create size: 6 Word 546: the size: 3 Word 547: actual size: 6 Word 548: property size: 8 Word 549: debug? size: 6 Word 550: if size: 2 Word 551: cr size: 2 Word 552: ." size: 2 Word 553: finding/creating size: 16 Word 554: '/rom/macos' size: 12 Word 555: package" size: 8 Word 556: then size: 4 Word 557: device-end size: 10 Word 558: 0 size: 1 Word 559: to size: 2 Word 560: my-self size: 7 Word 561: " size: 1 Word 562: /rom" size: 5 Word 563: find-device size: 11 Word 564: " size: 1 Word 565: macos" size: 6 Word 566: ['] size: 3 Word 567: find-device size: 11 Word 568: catch size: 5 Word 569: if size: 2 Word 570: 2drop size: 5 Word 571: new-device size: 10 Word 572: " size: 1 Word 573: macos" size: 6 Word 574: device-name size: 11 Word 575: finish-device size: 13 Word 576: then size: 4 Word 577: " size: 1 Word 578: /rom/macos" size: 11 Word 579: find-device size: 11 Word 580: debug? size: 6 Word 581: if size: 2 Word 582: cr size: 2 Word 583: ." size: 2 Word 584: creating size: 8 Word 585: 'AAPL,toolbox-parcels' size: 22 Word 586: property" size: 9 Word 587: then size: 4 Word 588: rom-virt size: 8 Word 589: encode-int size: 10 Word 590: parcels-size size: 12 Word 591: encode-int size: 10 Word 592: encode+ size: 7 Word 593: " size: 1 Word 594: AAPL,toolbox-parcels" size: 21 Word 595: property size: 8 Word 596: device-end size: 10 Word 597: debug? size: 6 Word 598: if size: 2 Word 599: cr size: 2 Word 600: ." size: 2 Word 601: copying size: 7 Word 602: MacOS.elf size: 9 Word 603: to size: 2 Word 604: load-base" size: 10 Word 605: then size: 4 Word 606: 'release-load-area size: 18 Word 607: if size: 2 Word 608: size: 0 Word 609: size: 0 Word 610: size: 0 Word 611: size: 0 Word 612: load-base size: 9 Word 613: elf-pages size: 9 Word 614: + size: 1 Word 615: 'release-load-area size: 18 Word 616: execute size: 7 Word 617: size: 0 Word 618: size: 0 Word 619: else size: 4 Word 620: size: 0 Word 621: size: 0 Word 622: size: 0 Word 623: size: 0 Word 624: load-base size: 9 Word 625: elf-pages size: 9 Word 626: 0 size: 1 Word 627: claim-mem size: 9 Word 628: size: 0 Word 629: size: 0 Word 630: size: 0 Word 631: size: 0 Word 632: load-base size: 9 Word 633: dup size: 3 Word 634: elf-pages size: 9 Word 635: 0 size: 1 Word 636: do-map size: 6 Word 637: size: 0 Word 638: size: 0 Word 639: size: 0 Word 640: then size: 4 Word 641: elf-virt size: 8 Word 642: load-base size: 9 Word 643: elf-size size: 8 Word 644: move size: 4 Word 645: elf-virt size: 8 Word 646: elf-pages size: 9 Word 647: do-unmap size: 8 Word 648: size: 0 Word 649: size: 0 Word 650: size: 0 Word 651: size: 0 Word 652: size: 0 Word 653: elf-virt size: 8 Word 654: elf-pages size: 9 Word 655: release-virt size: 12 Word 656: elf-phys size: 8 Word 657: elf-pages size: 9 Word 658: release-mem size: 11 Word 659: debug? size: 6 Word 660: if size: 2 Word 661: cr size: 2 Word 662: ." size: 2 Word 663: init-program" size: 13 Word 664: then size: 4 Word 665: init-program size: 12 Word 666: debug? size: 6 Word 667: if size: 2 Word 668: cr size: 2 Word 669: ." size: 2 Word 670: .registers" size: 11 Word 671: .registers size: 10 Word 672: then size: 4 Word 673: debug? size: 6 Word 674: if size: 2 Word 675: cr size: 2 Word 676: ." size: 2 Word 677: go" size: 3 Word 678: cr size: 2 Word 679: then size: 4 Word 680: go size: 2 Word 681: cr size: 2 Word 682: ." size: 2 Word 683: end size: 3 Word 684: of size: 2 Word 685: BOOT-SCRIPT" size: 12
On 2016-Apr-15 16:15 , Programmingkid wrote:
Ahhh.....
Word 407: \ size: 1 Word 408: allocate size: 8 Word 409: room size: 4 Word 410: for size: 3 Word 411: both size: 4 Word 412: images size: 6 Word 413: parcels-pages size: 13 Word 414: 400000 size: 6
Word 407, the start of a comment. That ends on an end-of-line, however the particular interpreter chooses that. The rare case where end-of-line is different than a space. I suspect between word 412 and 413 is a "cr", and unless Openbios interprets "cr" as end-of-line, it will miss the "parcels-pages" as a variable.
On Apr 15, 2016, at 4:43 PM, Tarl Neustaedter wrote:
On 2016-Apr-15 16:15 , Programmingkid wrote:
Ahhh.....
Word 407: \ size: 1 Word 408: allocate size: 8 Word 409: room size: 4 Word 410: for size: 3 Word 411: both size: 4 Word 412: images size: 6 Word 413: parcels-pages size: 13 Word 414: 400000 size: 6
Word 407, the start of a comment. That ends on an end-of-line, however the particular interpreter chooses that. The rare case where end-of-line is different than a space. I suspect between word 412 and 413 is a "cr", and unless Openbios interprets "cr" as end-of-line, it will miss the "parcels-pages" as a variable.
So if we filtered out the comment, things might work correctly. I will try this.
On 2016-Apr-15 16:57 , Programmingkid wrote:
[...] So if we filtered out the comment, things might work correctly. I will try this.
Actually, there are several comments. I saw at least three. Probably the right thing to do would be to find where the "" word is processed and make sure it accepts either CR (0xD) or LF (0xA) as end-of-comment.
My original thought was that the only thing that could differentiate between end-of-line and space was the "accept" word, which I didn't expect to see in the bootloader. I forgot that comment is a variant on accept.
On Apr 15, 2016, at 5:10 PM, Tarl Neustaedter wrote:
On 2016-Apr-15 16:57 , Programmingkid wrote:
[...] So if we filtered out the comment, things might work correctly. I will try this.
Actually, there are several comments. I saw at least three. Probably the right thing to do would be to find where the "" word is processed and make sure it accepts either CR (0xD) or LF (0xA) as end-of-comment.
My original thought was that the only thing that could differentiate between end-of-line and space was the "accept" word, which I didn't expect to see in the bootloader. I forgot that comment is a variant on accept.
I made a patch that removes comments from the bootscript variable. It did not solve the problem of not being able to boot Mac OS 9. Here is the patch.
Index: libopenbios/bootinfo_load.c =================================================================== --- libopenbios/bootinfo_load.c (revision 1391) +++ libopenbios/bootinfo_load.c (working copy) @@ -134,7 +134,7 @@ char *base; int proplen; phandle_t chosen; - int tag, taglen, script, scriptlen, scriptvalid, entity, chrp; + int tag, taglen, script, scriptlen, scriptvalid, entity, chrp, comment; char tagbuf[128], c; char *device, *filename, *directory, *partition; int current, size; @@ -187,10 +187,26 @@ scriptlen = 0; entity = 0; current = 0; + comment = 0; while (current < size) {
c = base[current++];
+ // filter out comments + if (c == '\') { + comment = 1; + continue; + } + + if (comment) { + // only a carriage return or linefeed character can end a comment + if (c == '\r' || c == '\n') { + comment = 0; + } else { + continue; + } + } + if (c == '<') { script = 0; tag = 1;