Trap in MAU
Posted: Thu Dec 08, 2011 9:23 pm
What does "Trap @00001630H in MAU, Line: 26, Code: 11" mean?
A technical support group for Astrobe Oberon users
https://astrobe.com./forum/
Code: Select all
MODULE MauV4;
IMPORT Out, MAU, Main;
PROCEDURE Test;
VAR p: ARRAY OF INTEGER;
BEGIN
NEW(p, 4);
Out.String("proc "); Out.Int(MAU.MemAvailable(), 6); Out.Ln;
END Test;
PROCEDURE Run;
BEGIN
WHILE MAU.MemAvailable() > 10 DO
Out.String("while "); Out.Int(MAU.MemAvailable(), 6); Out.Ln;
Test
END;
END Run;
BEGIN
Run
END MauV4.
Code: Select all
MODULE MauV4;
IMPORT Out, MAU, Main;
PROCEDURE Run;
VAR p: ARRAY OF INTEGER;
BEGIN
WHILE MAU.MemAvailable() > 10 DO
Out.String("free "); Out.Int(MAU.MemAvailable(), 6); Out.Ln;
NEW(p, 4);
END;
END Run;
BEGIN
Run
END MauV4.
Code: Select all
NEW(p, 4);
NEW(p, 4);
Code: Select all
VAR
a, b: ARRAY 4 OF INTEGER;
Code: Select all
IF MAU.MemAvailable() >= 16 THEN
NEW(p, 4)
END;
Code: Select all
MODULE MauV4;
IMPORT Out, Main, MAU;
TYPE
Event = POINTER TO RECORD
next: Event
END;
VAR
v: Event;
PROCEDURE Add;
VAR item: Event;
BEGIN
IF v = NIL THEN
NEW(v);
v.next := NIL
ELSE
item := v;
WHILE item.next # NIL DO
item := item.next
END;
NEW(item.next);
item.next.next := NIL
END
END Add;
PROCEDURE Clear;
BEGIN
(* Do some work here *)
(* How to free memory from a chain unused tail ??? *)
v := NIL;
v.next := NIL;
END Clear;
PROCEDURE Run;
BEGIN
v := NIL;
v.next := NIL;
WHILE TRUE DO
Out.String("Available: "); Out.Int(MAU.MemAvailable(), 5); Out.Ln;
Add;
Clear
END
END Run;
BEGIN
Run
END MauV4.
Code: Select all
MODULE MauV4;
IMPORT Out, Main, MAU, Random;
TYPE
Event = POINTER TO RECORD
data: INTEGER;
next: Event
END;
VAR
list , r, w: Event;
PROCEDURE InitList;
VAR item: Event; i: INTEGER;
BEGIN
NEW(list );
item := list ;
FOR i := 1 TO 20 DO
NEW(item.next);
item := item.next
END;
item.next := list;
r := list;
w := list;
END InitList;
PROCEDURE Add(VAR a: INTEGER): BOOLEAN;
VAR item: Event; res: BOOLEAN;
BEGIN
(* If were any place in list *)
IF w.next # r THEN
w.data := a;
(* Make a step in the cycle *)
w := w.next;
res := TRUE
ELSE
res := FALSE
END;
RETURN res
END Add;
PROCEDURE Do(): BOOLEAN;
VAR res: BOOLEAN;
BEGIN
(* If something is written in the list *)
IF r # w THEN
(* Do processing of data *)
Out.String("data: "); Out.Int(r.data, 7); Out.String("mem free: "); Out.Int(MAU.MemAvailable(), 4); Out.Ln;
(* Make a step in the cycle *)
r := r.next;
res := TRUE
ELSE
res := FALSE
END
RETURN res
END Do;
PROCEDURE Run;
VAR rand, counter: INTEGER;
BEGIN
InitList; (* Init circular list *)
counter := 1;
WHILE TRUE DO
(* Irregular addition of data to list *)
rand := Random.Next(1000);
IF rand > 500 THEN
IF Add(counter) THEN
INC(counter)
ELSE
Out.String("LIST IS FULL"); Out.Ln
END
END;
(* Irregular data processing *)
rand := Random.Next(1000);
IF rand > 500 THEN
IF ~ Do() THEN
Out.String("LIST IS EMPTY"); Out.Ln
END
END
END
END Run;
BEGIN
Run
END MauV4.