[Oberon] PO2013 - Last sector allocated

Paul Reed paulreed at paddedcell.com
Fri Jun 26 12:31:15 CEST 2020


Hi Joerg,

> Paul‘s method is the only „official“ method to do so. A dirty and a 
> very dirty alternative...

Well if we're doing dirty... :)

Perhaps a reasonable general assumption under maintenance of Kernel's 
code might be to ensure the map is always the last variable in Kernel, 
and search down from one bit before the value of the code member of 
Kernel's module descriptor.

(This is assuming you want to keep the symbol files the same as the 
reference system, I prefer to.  Otherwise you can do better obviously, 
as Michael says.)

Dirty:

   i := 10C1FH; WHILE ~SYSTEM.BIT(i DIV 32 * 4, i) DO DEC(i) END;
   Texts.WriteString(W, "used = "); Texts.WriteInt(W, i-0C20H, 1); 
Texts.Write(W, "K"); EndLine;

a bit better (no pun intended)

   M := Modules.root; WHILE M.next # NIL DO M := M.next END;
   i := M.code*8-1; WHILE ...; Texts.WriteInt(W, i-(M.code*8-65536), 1); 
...

Or something.  Anyway, moving on... :)
Cheers,
Paul


More information about the Oberon mailing list