Inside - SOURCES

From NitrOS-9
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

{Term|02}/DD:asm alarm.asm s l
Microware OS-9 Assembler RS Version 01.00.00    05/19/2017 01:45:05   Page 001
Alarm - INSIDE OS9 LEVEL II

00001                            nam   Alarm
00002                            ttl   INSIDE OS9 LEVEL II
00003        
00004        * alarm - test that sets alarm for the next minute.
00005        * cause beep from coco sound output for 15 secs.
00006        * just for fun.
00007        * Copyright 1987 by Kevin Darling
00008        
00009   0006            F$Exit   equ   6
00010   0015            F$Time   equ   $15
00011   001E            F$Alarm  equ   $1E
00012        
00013   0054            D.Time   equ   $54
00014   0057            D.Min    equ   $57
00015        
00016   0000 87CD0026            mod   len,name,$11,$81,entry,msize
00017        
00018 D 0000            time     rmb   10
00019 D 000A                     rmb   200
00020   000D            msize    equ   *
00021        
00022   000D 416C6172   name     fcs   "Alarm"
00023   0012 01                  fcb   1
00024        
00025   0013 30C4       entry    leax  time,u
00026   0015 103F15              os9   F$Time
00027   0018 6C1D                inc   D.Time-D.Min,x next minute (bad on 59th)
00028   001A CC0001              ldd   #$0001
00029   001D 103F1E              os9   F$Alarm    set alarm time
00030   0020 103F06              os9   F$Exit
00031        
00032   0023 058E48              emod
00033   0026            len      equ   *
00034                            end

00000 error(s)
00000 warning(s)
$0026 00038 program bytes generated
$00D2 00210 data bytes allocated
$00FE 00254 bytes used for symbols

0057 E D.Min    0054 E D.Time   001E E F$Alarm  0006 E F$Exit  
0015 E F$Time   0013 L entry    0026 E len      000D E msize   
000D L name     0000 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