[Oberon] trap output problems

R. P. de Jong rdjong at mac.com
Sun Nov 1 19:12:41 CET 2015


> On 31 Oct, 2015, at 18:51 , Jan de Kruyf <jan.de.kruyf at gmail.com> wrote:
> 
> could I have your modification.
> 

No problem but be aware that it is made for Project Oberon.


	PROCEDURE Trap(VAR a: INTEGER; b: INTEGER);
		VAR u, v, w: INTEGER; mod: Modules.Module;
	BEGIN u := SYSTEM.REG(15); SYSTEM.GET(u - 4, v); w := v DIV 10H MOD 10H; (*trap number*)
		IF w = 0 THEN Kernel.New(a, b)
		ELSIF Kernel.allocated < Kernel.heapLim - Kernel.heapOrg - 200H THEN (*space for Texts calls and notification*)
			Texts.WriteLn(W); Texts.WriteString(W, "	pos "); Texts.WriteInt(W, v DIV 100H MOD 10000H, 4);
			Texts.WriteString(W, "	TRAP"); Texts.WriteInt(W, w, 4); mod := Modules.root;
			WHILE (mod # NIL) & ((u < mod.code) OR (u >= mod.imp)) DO mod := mod.next END ;
			IF mod # NIL THEN Texts.WriteString(W, " in "); Texts.WriteString(W, mod.name) END ;
			Texts.WriteString(W, " at"); Texts.WriteHex(W, u);
			Texts.WriteLn(W); Texts.Append(Oberon.Log, W.buf); Oberon.Reset
		ELSE Oberon.Reset
		END
	END Trap;


Regards,
Roel de Jong.



More information about the Oberon mailing list