home *** CD-ROM | disk | FTP | other *** search
/ The Fred Fish Collection 1.5 / ffcollection-1-5-1992-11.iso / ff_disks / 100-199 / ff113.lzh / M2Amiga / Demos / frags.mod < prev    next >
Text File  |  1987-11-21  |  1KB  |  43 lines

  1. MODULE frags;
  2. (* 2.0 / 4.5.87 / ms *)
  3. (* Copyright 1987 by Markus Schaub / AMSoft
  4.  * Permission granted to have this program in the collection of demo programs
  5.  * of M2Amiga and to use any part of it as example of coding with M2Amiga.
  6.  * Again, also bad examples are examples :-)
  7.  *)
  8. FROM SYSTEM IMPORT
  9.  ADDRESS,ADR;
  10. FROM Exec IMPORT
  11.  execBase,MemChunk,MemHeaderPtr,Forbid,Permit,RawDoFmt;
  12. FROM Terminal IMPORT
  13.  WriteLn,WriteString;
  14.  
  15. VAR
  16.  mem: MemHeaderPtr;
  17.  chunk: POINTER TO MemChunk;
  18.  line: ARRAY [0..255] OF CHAR;
  19.  stuffChar: ADDRESS;
  20.  ld: RECORD
  21.   adr: ADDRESS;
  22.   size: LONGINT
  23.  END;
  24.  
  25. BEGIN
  26.  stuffChar:=16C04E75H;
  27.  WriteString("frags, 2.0, 4.5.87, © AMSoft"); WriteLn;
  28.  Forbid();
  29.  mem:=ADDRESS(execBase^.memList.head);
  30.  WHILE mem^.node.succ#NIL DO
  31.   chunk:=ADDRESS(mem^.first);
  32.   WHILE chunk#NIL DO
  33.    ld.adr:=ADDRESS(chunk);
  34.    ld.size:=chunk^.bytes;
  35.    RawDoFmt(ADR("adr= %08lx size=%7ld"),ADR(ld),ADR(stuffChar),ADR(line));
  36.    WriteString(line); WriteLn;
  37.    chunk:=ADDRESS(chunk^.next);
  38.   END;
  39.   mem:=ADDRESS(mem^.node.succ);
  40.  END;
  41.  Permit();
  42. END frags.
  43.