Inside - SOURCES

From NitrOS-9
Revision as of 20:46, 26 May 2017 by NealC (Talk | contribs) (Add example from latest nitros version, link to source code.)

Jump to: navigation, search

The original book presented type-in listings for an "alarm" utility and some utilities for system inspection. The sources for all but the alarm utility are part of the NitrOS-9 source tree and so are not reproduced here, but the usage notes are presented.


Alarm

Microware OS-9 Alar - INSIDE 00001 00002 00003 00004 00005 OOOC6 00007 00008 0 006 00009 0 0 15 0000 0 01E 0 001. 0 0012 0054 OOO3 0057 0 004 0 0015 0000 87 0 OO6 OOO17 D 0000 0 008 D 000A 00019 D 0 OD2 OOO20 OOO2 OOOD 4 00022 0 0 12 O. 0 0023 003 0 0 024 003 30 00025 005 10 0 0026 008 6C OOO27 0 0 1A CC O0028 OOD O OOO29 OO 20 O OOO3 O 0 003 OO 23 A9 OOO32 0 026 OOO33 00000 error (S) 00000 warning (s $0.026 00038 pro S00D2 00210 dat $00CA 00202 byt 0057 E D. MITIN 005 E F STIME INSIDE OS9 LEVEL, III SOURCES AllarIn AS Sebol er RS Version 0 0 0 0 0 O3/30/87 00:15:04 Page 00l OS 9 LEVEI, III ՈՅՈղ Alarm ttl INSIDE OS9 LEVEL, I alarm - test that sets alarm for next minute. causes beep from coco sound output for lis Secs. just for fun. Copyright l987 by Kevin Darling FSExit equ 6 FSTime equ S5 F $Alarm equ ŞE D. Tine equ S54 D. Min equ S57 CDO O26 I'mod len, name, Sill, $8l, entry, msize time rimbo 10 rmb 200 Insize equ g 6C672 ae fCS 'A1ar In' fcb l entry C4 leax time, u 3F15 OS 9 FŞTime D inc D. Time-D. Minx next minute (bad on 59) 000 1dd #$000] 3FE OS 9 F ŞAlarm Set alarm time 3F06 OS 9 F ŞEXit. F133 emod llen equ 女 end ) gram bytes generated a bytes allocated es used for symbols 0054 E. D.TIME 003 I, ENTRY OOE E FSALARM 0006 E F SEXIT 0.026 E LEN 00D 2 E MSI ZE 000D L, NAME OOOO D TIME


DMem

DMEM - dmem  <block> <offset> [<length>] ! dump
       dmem -<proc#> <offset> [<length>] ! dump

Dmem writes up to $1000 bytes to standard out, that it has copied over for you from other maps. If no length is given, it defaults to 256 ($100) bytes. Examples using data above:

dmem 4 0 ! dump          : dumps first 256 bytes of GrfDrv
dmem 2 1CA 1AE ! dump    : dumps CC3Go
dmem 0 0 1000 >/d1/file  : file contains lower system variables

dmem -3 0 20 ! dump      : dump first 32 shell data bytes
dmem -3 E000 5FA ! dump  : another way of dumping Shell
dmem -1 0 1000 >/d1/file : file contains lower system variables

Good use of PROC, PMAP, MDIR and DMEM depends on the data you get from each. Open a graphics window and recheck the MMAP. Kill a shell and notice the Status and Signal Codes. Look up the Status bits in your old DEFS file, signal from Error codes. Watch how modules get mapped in using PMAP and MDIR.

Figure out system data use by knocking out the blocks you know are in other use, with PMAP and MMAP.

The source for this Level 2 utility is dmem.asm

MMap

MMap displays a memory block map, displaying free memory. There is at least one more block free than is shown, since MMap is using one block for data.

Key: U = used, M = loaded module, . = no RAM, else FREE.

Example output (1Mbyte MC09 system):

{Term|02}/DD:mmap

     0 1 2 3 4 5 6 7 8 9 A B C D E F
  #  = = = = = = = = = = = = = = = =
 00  U U U U M U U U _ _ _ M _ _ _ _ 
 01  _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
 02  _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
 03  _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
  Block Size: 8192
 Free Blocks: 55
 KBytes Free: 440

The source for this Level 2 utility is mmap.asm

PMap

PMap - Process DAT Image Maps. The best. Shows blocks in use by processes. Lower is data, top is modules.

The example output (below) shows:

  • Block 09 is mapped into $6000-$7FFF in the system DAT map.
  • Shell in block 06 (see DIRM above!) is simply mapped into both procs 2 and 3 at $E000-$FEFF along with any other modules in that block.
  • PMap is in block 8, also at $E000-$FEFF.

 ID     01 23 45 67 89 AB CD EF   Program
----    -- -- -- -- -- -- -- --   ------------
  1     00 .. .. 09 01 02 03 3F   SYSTEM
  2     05 .. .. .. .. .. .. 06   Shell
  3     07 .. .. .. .. .. .. 06   Shell
  4     0A .. .. .. .. .. .. 08   PMap

The source for this Level 2 utility is pmap.asm

Proc

PROC - Like procs, but shows standard in/out devices.

Key: St = status byte, Sig = pending signal in hex and decimal

Example:

{Term|02}/DD:mdir >/d1/test4 & (setpr 2 255; proc >/d1/test5)
&003

{Term|02}/DD:list /d1/test5

 ID Prnt User Pty  Age  Tsk  Status  Signal   Module    I/O Paths 
___ ____ ____ ___  ___  ___  _______ __  __  _________ __________________
  1   0    0  255  255   00  sTimOut  0  00  System    <Term >Term >>Term 
  2   1    0  255  255   00  sTimOut  0  00  Shell     <Term >Term >>Term 
  3   2    0  255  255   03           0  00  MDir      <Term >D1   >>Term 
  4   2    0  255  255   00  s        0  00  Shell     <Term >Term >>Term 
  5   4    0  255  255   02  s        0  00  Proc      <Term >D1   >>Term 

The source for this Level 2 utility is proc.asm

SMap

SMAP - Show system page memory map. As above, except in pages. Important info adding drivers, starting many procs, etc.

Example output (1MByte MC09 system):

{Term|02}/DD:smap

    0 1 2 3 4 5 6 7 8 9 A B C D E F
 #  = = = = = = = = = = = = = = = =
 0  U U U U U U U U U U U U U U U U 
 1  U U U U U U U U U U U U U U U U 
 2  _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
 3  _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
 4  _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
 5  _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
 6  _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
 7  _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
 8  _ _ _ _ _ U U U U U U U U U U U 
 9  U U U U U U U U U U U U U U U U 
 A  U U U U U U U U U U U U U U U U 
 B  U U U U U U U U U U U U U U U U 
 C  U U U U U U U U U U U U U U U U 
 D  U U U U U U U U U U U U U U U U 
 E  U U U U U U U U U U U U U U U U 
 F  U U U U U U U U U U U U U U U . 

 Number of Free Pages: 101
   RAM Free in KBytes:  25

The source for this Level 2 utility is smap.asm