SpyMaster

by Graham Crow

SpyMaster provides a simple means of viewing the contents of a section
of memory or a file in a scrolling window and optionally outputting it to disc
or printer. It should be of general interest to anyone who wishes to examine
the detailed content of the computer's memory or the structure of a file,
It is of particular value to programmers. Note that SpyMaster makes use of the
SWI call TaskManager_EnumerateTasks which was introduced in RISC OS 3,
and will not therefore work with earlier versions of the operating system.


Starting SpyMaster
From the Desktop double-click on the application SpyMaster or click on the SpyMaster icon in the menu program to install it
on the icon bar. Click Select on the icon bar icon to open the main window. 
Initially, the scrollable inner window shows a section of memory starting at
the default address of &8000. This is because the Memory option is selected.
The other options (Application workspace and File) are blank and shaded
respectively.


Window display
The display shows the address in green, followed by a line of 8 hexadecimal
bytes in blue and the same bytes in red ASCII. The window is capable of
showing 12 such lines at a time. The display may be scrolled in the normal
way by using the mouse and scroll bar. In addition, by clicking on the two
arrows at the bottom right you can go directly to the start/end of the
display. Alternatively, providing SpyMaster has the input focus, you may
use the cursor keys to scroll, as follows:

Up/down		scroll one line
Shift+up/down	scroll one windowful
Ctrl +up/down	scroll to start/end

There are three modes; Memory, Application workspace, and File, each
accompanied by a radio button:


Memory mode
To bring a particular address to the top left of the display, enter the
required value in the Go to address icon. To alter the range of
addresses, enter the value you wish to change in one of the three writable
icons at the top of the window. Press Return to effect the change. 
Altering the start address moves the whole range up or down without changing
its extent. However, altering the extent or the end address increases or
decreases the range leaving the start address unchanged.

Values may be entered in hex (precede with &) or decimal, or indeed any
expression which the program will recognise, including variables. 
Unrecognised entries are greeted with a buzz or error message. If the
address range you specify is outside that which may be read, an address
outside logical RAM error is generated. This prevents the fatal Address
Exception from terminating the program. Click on Cancel and the
original values are restored.


Application workspace
A program's workspace starts at &8F00. In memory mode, the display starting
at this address will be that for SpyMaster itself. However it is possible to
display the workspace of a different application by clicking on the menu icon
in the application workspace section. The resulting menu lists all the
current application tasks. Selecting one of these has the following
effects:

- the application name is displayed
- the application workspace radio button is set
- the addresses are set to the workspace for the application
- the addresses are no longer writable
- the displayed data relates to the named application

To change the displayed application, click on the menu icon and make a new
selection from the menu. If you quit an application it is removed from the
menu: if it is the current task, the mode switches to Memory.


File
To display the contents of a file, drag its icon onto the window or icon
bar. These changes will occur:

- the file name and type are displayed
- the file radio button is set 
- the addresses are set to the range for the file
- the addresses are no longer writable
- the displayed data relates to the file
- displayed and goto addresses are replaced by file offsets

Note that the WimpSlot has been extended to accommodate the file, which is
stored in memory starting at address &18000. 


Changing mode
Provided the radio buttons are unshaded you can change mode simply by
clicking on the radio buttons. If you are entering Memory mode, the
previous address range will be restored.


Menu options
Clicking menu over the main window brings up a menu with three choices:

Print
Clicking Set print flushes the printer buffer and prepares to print from
the start of the current display window. Clicking on Print sends the
current windowful to a printer as a simple series of characters, so that it
should work on practically any printer. Each subsequent click on Print
(or press of the Print key) sends another windowful to the printer, until
the end of the section of memory is reached. This method allows you to
print small sections of memory without filling the print buffer and waiting
for ever for it to clear. The radio buttons provide the means of
printing 8, 16, or 24 bytes per line. The Print option does not use the
RISC OS printer drivers.

Save
This option allows you to save the section of memory as a text file by
dragging the icon either to a directory viewer or a text editor. Again, the
radio buttons provide the means of printing 8, 16, or 24 bytes per line. 
For ADFS and RAM filing systems a check is made to ensure that there is
sufficient disc space. For saved files which will be in excess of 300000
bytes a warning is issued. In any case, you can abort a lengthy save
operation by pressing Escape. 

Offset
The final option leads to a submenu from which you can choose whether the
offset should be expressed in hex or decimal. The chosen setting is ticked
on the menu, and applies to all forms of output.


 Copyright RISC User 1994
