<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Andrea and Jörg,<div class=""><br class=""></div><div class="">Thanks a lot for your clear explanations! Now I understand much more about the different ways to allocate memory in the PO compiler. </div><div class=""><br class=""></div><div class=""><font style="background-color: rgb(255, 255, 255);" class="">Still, I'm wondering about the difference between the two disk images provided by Peter de Wachter:</font></div><div class=""><font style="background-color: rgb(255, 255, 255);" class="">With <span style="font-family: "Andale Mono";" class="">Oberon-2016-08-02.dsk</span> on a freshly opened Oberon System MyViewer does not show the menu problem, even if it defines max = 65768, and if there are several viewers open gives a run time message "Call error: MyViewer insufficient space" and refuses to open the viewer; whereas <span style="font-family: "Andale Mono";" class="">Oberon-2019-01-21.dsk</span> sho</font>ws the menu problem with max = 16367. </div><div class=""><br class=""></div><div class="">What causes this difference? Did the compiler change that much in the meantime?</div><div class=""><br class=""></div><div class="">Cheers,</div><div class=""><br class=""></div><div class="">Hans</div><div class=""><br class=""></div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">Jörg <<a href="mailto:joerg.straube@iaeth.ch" class="">joerg.straube@iaeth.ch</a>> wrote:</div><div class=""><div class=""><br class="">The current compiler generates wrong code for global variables and/or strings exceeding 64KB. And even worse, it doesn‘t alert you, you passed this 64 KB limit.<br class=""><br class="">With max =16367 your bitmap occupies 65468 bytes. The compiler puts the strings after the global data. So, the strings now lay beyond the 64KB limit. As the code to access the strings is wrong, you will never be able to access your strings anymore.<br class=""><br class="">There are two ways: wait for a corrected compiler that doesn’t have this limit anymore. Or allocate your bitmap on the heap as Andreas proposed.<br class=""><br class="">BTW: ProjectOberon‘s screen is 1024x768. To allocate a bitmap of that size on the heap, max = 24576 (iso 32768 as in Reiser‘s book) would be sufficient.<br class=""><br class=""><br class=""><blockquote type="cite" class="">Andreas Pirklbauer <<a href="mailto:andreas_pirklbauer@yahoo.com" class="">andreas_pirklbauer@yahoo.com</a>> wrote: <br class=""><br class=""><br class=""><blockquote type="cite" class=""><br class="">CONST <br class=""> max = 16377; (* If max >= 16367 the frame name disappears; If max >= 16377 the whole menu line disappears! *)<br class=""> menu = "System.Close System.Copy System.Grow”; <br class=""><br class="">VAR bitmap: ARRAY max OF SET; (* with this variable present the menu may remain empty! *)<br class=""></blockquote><br class="">The issue is that Project Oberon 2013 does not know how to handle data accesses at offsets > 64KB from the module’s static base. A module block in memory consists of 3 sections (see ch. 6, p. 79 of the book Project Oberon 2013)<br class=""> - data (which in turn contains type descriptors, the variable space and strings - in that order!)<br class=""> - code<br class=""> - meta<br class=""><br class="">If you declare a global bitmap variable which takes up more than 64KB, the module loader will actually allocate the appropriate amount of variable space (even if it is >64KB) and even place your string “menu” just after that (strings are treated like pre-initialized, immutable global variables).<br class=""><br class="">But one cannot access the string, as it is beyond the 64KB boundary. This is an undocumented limitation of PO 2013 and the Oberon-07 compiler (regrettably) does not warn you about it, when compiling a program.<br class=""><br class="">This limitation has to do with the way global variables are accessed. It typically involves loading the static base of the module via a LD instruction + adding an offset via an ADD instruction. However, an ADD instruction which has an offset field of only 16 bits = 64KB, this is where the limitation comes from. There are ways around this, but it’s just not implemented in Project Oberon 2013.<br class=""><br class="">=> If you remove the bitmap variable declaration or make it so small that the sum of the bitmap + your string is <64KB, your program should work.<br class=""><br class="">To use a bitmap of more than 64KB you can allocate in the heap, as in<br class=""><br class=""> MODULE M;<br class=""> CONST max = 16384;<br class=""> TYPE BitMap = POINTER TO BitMapDesc;<br class=""> BitMapDesc = RECORD bits: ARRAY max OF SET END ;<br class=""><br class=""> VAR bitmap: BitMap;<br class=""><br class=""> PROCEDURE AllocateBitmap*;<br class=""> BEGIN NEW(bitmap)<br class=""> END AllocateBitmap;<br class=""> END M.<br class=""><br class=""> ORP.Compile M.Mod/s ~<br class=""> M.AllocateBitmap<br class=""><br class="">But remember, even the heap space in Project Oberon 2013 is limited to a few hundred KB only.<br class=""><br class=""><br class="">--<br class=""><a href="mailto:Oberon@lists.inf.ethz.ch" class="">Oberon@lists.inf.ethz.ch</a> mailing list for ETH Oberon and related systems<br class=""><a href="https://lists.inf.ethz.ch/mailman/listinfo/oberon" class="">https://lists.inf.ethz.ch/mailman/listinfo/oberon</a><br class=""></blockquote><br class="">--<br class=""><a href="mailto:Oberon@lists.inf.ethz.ch" class="">Oberon@lists.inf.ethz.ch</a> mailing list for ETH Oberon and related systems<br class=""><a href="https://lists.inf.ethz.ch/mailman/listinfo/oberon" class="">https://lists.inf.ethz.ch/mailman/listinfo/oberon</a><br class=""></div></div></blockquote></div><br class=""></div></body></html>