Sunteți pe pagina 1din 20

HESMON64TM

By Terry Peterson

Instruction Manual

If You've Never Used a To use HESMON, turn your C64 off,


insert the HESMON cartridge into th e
'Machine Language Monitor' expansion slot in the C64 and then
Before turn the power on. You will see the
The following section is intended for HESMON version number, the pro­
people who are unfamiliar with the grammer's name, the H.E.S. copyright
uses of a machine language (M.L.) message, and the 'cold start' register
monitor program. However, it is not a display:
tutorial in the architecture of the C64 C·
or the 6502. Nor is it intended to teach PC IRQ SR AC XR YR SP

6502 assembly language program­ ;0000 EA31 27 00 00 00 FA

ming. In fact, some knowledge of


assembler language will be most The meaning of this rather cryptic
helpful. It IS intended to help the display is as follows: The first line 'C·'
beginner get started in using identifies a cold start of HESMON,
HESMON. Even those who know that is, starting up from power-on . The
nothing about the 6502 or the C64 will next line identifies the pseudo 6502
find some of HESMON's commands registers maintained by HESMON:
useful (see, for example, the Interpret PC = program counter
Memory command). IRQ = interrupt request vector
If you are familiar with the C64's SR = status regist er
screen editor, you should have no AC = accumulator
trouble entering and editing HESMON XR = X regist er
commands. HESMON commands are YR = Y register
entered and edited just as are BASIC SP = stack pOinter
direct mode commands. They consist
of a single character usually followed
by one or more 'parameters' and a
RETURN. The parameters consist of NOTE: "6502" is used synonomously
hexadecimal numbers or character for "6510" in this document.
strings and are separated from one
another by spaces. With one excep­ The register contents are shown on
tion (the '#' command) numeric the third line. The quantities shown in
parameters must be hexadecimal and the register display (except the IRQ)
do not need to be prefixed with '$'. are not the actual register contents,
String parameters are identified by they are the numbers HESMON will
encloSing them in double quotes ("). If use to set the 6502 registers when in­
HESMON doesn't understand a com­ structed to begin execution of a M.L.
mand it will print '?', usually just to program. IRQ is not a 6502 register,
the right of the bad command. If the but a RAM 'vector' that points to an
command is understood, but the IRQ interrupt service routine. Begin­
result is impossible or illegal, e.g., try­ ners may ignore this location - but
ing to save HESMON itself on tape, better not change it! The ';' at the
HESMON prints a '?' on the following
line.

2
beginning of the last line is really a a space. So you don't have to keep
HESMON command. It tells HESMON track of what the next address is, just
(if the RETURN key is pressed with type in the assembly language in­
the cursor on this line) to put the structions. When you 've finished the
seven numbers that follow into the program, just press RETURN and
corresponding pseudo registers. Just HESMON will exit this mode. By the
before beginning execution of a M.L. way, $FF02 is one of the 'Kernal'
program HESMON copies the pseudo routines in the C64's ROMs. It prints
register contents to the 6502 the contents of the accumulator to
registers. So, for example, if we want the current output file - the screen in
the C64 to print 'HI.', we could first this case. For further information on­
move the cursor up to the ';' line and this and other useful ROM routines,
alter it to read: consult the Commodore 64 Program­
mers' Reference Guide" published by
1200 EA31 27 48 49 2E FA Commodore
When we press RETURN , the 6502 Now type 'G' and hit RETURN. You
pseudo program counter is set to
should see:
$1200; while the accumulator, and X
and Y pseudo registers are set to $48 G
(ASCII H), $49 (ASCII I), and $2E HI.
(ASCII.). Now, if we write a program at B*
$1200 to print the AC, XR, and YR it PC IRQ SR AC XR YR SP
will print 'HI.' when we execute the ;120C EA31 30 2E 49 2E FA
H ESMON Go command . Let's write
sur.h a program using the HESMON Notice after the 'H I.' is another
Simple Assembler command, 'A '. Type register display, the break entry
in the following lines: display identified by 'B* '. This means
we've re-entered HESMON by ex­
A 1200 JSR FF02 ecuting a BRK instruction - the one
TXA at the end of our short program. Now
JSR FF02 examine the register contents. The PC
TYA points one address higher than the
JSR FFD2 BRK instruction. The X and Y
BRK registers and stack pointer are un­
changed. The accumulator now has
The 'A' beginning the first line tells the $2E transferred into it by the TYA
HESMON we wish to assemble, that instruction at $1207. Let's play with
is, translate assembly mnemonics in­ this a bit. Type ' 01200 120B'. This
to machine code. As you press command instructs HESMON to
RETURN after typing each of the 'disassemble' the program you just
above lines, you will see HESMON entered.
reprint the line, showing the machine
code generated from the assembly Now, move the cursor to the last line,
language instruction. HESMON will at address $120B, and type the follow­
then prompt for the next line of pro­ ing, with the 'A ' replacing the ',' (also
gram by printing the 'A ' command and
the next available address followed by

3
be sure to blank out any characters Besides entering programs and data
left on the screen after the '8'): into memory, one of the functions of a
M.L. monitor is to examine programs
A 120B LDA #48 and data already in memory. HESMON
JMP 1200 has several commands for this pur­
We now have a M.L. program that will pose; including Disassembly (D),
print 'HI.' forever - or until we stop it. Memory Display (M), and Interpret
Type 'G1200'. When you tire of watch­ Memory (I). These three commands
ing the stream of 'HLHLHL's, press ­ are special in that the cursor-up and
no, not the STOP key - the cursor-down key may be used to
RESTORE key by itself. The RESTORE 'scroll' their displays forward and
key is HESMON's super-STOP key. It backward through memory. The ac­
will halt just about any M.L. program tion of this scrolling is easier to use
(except HESMON itself) when than to describe. Think of the text on
HESMON is plugged in . (Exception: If the screen as being on a drum which
you attempt to use RS232 files all may be rolled up or down using the
bets are off. Also, correct operation of cursor up/down key . The scrollable
RS232 files is not guaranteed with display type found closest to the edge
HESMON installed.) To get back to of the screen where new lines will ap­
our example: after pressing RESTORE pear is continued in the scroll direc­
you should see a clear screen with the tion. I said it was hard to describe! Try
following: it. Just type 'DAADT and hit RETURN.
Then press and hold the cursor-down
S* key. To scroll up, go to the top of the
PC IRQ SR AC XR YR SP screen and then hold down the
;XXXX EA31 XX XX XX XX XX cursor-up key.
This is the RESTORE entry display, Other commands allow you to hunt
identified by the 'S*'. The X's are not for a particular sequence of bytes in
actually what you will see. The memory (H), compare two blocks of
register contents will depend upon ex­ memory for differences (C), or transfer
actly when you pressed RESTORE. a block of memory to a different loca­
If you want to enter a series of bytes tion (T). There are also two advanced
into memory, use the Memory Modify functions: N - relocate absolute
command (:). For example , to enter memory references in a program , and
the sequence $01, $02, $03, $04, $05, E-change the external references in
$06, $07 . .. starting at $1234, you a program. Finally, there are number
type: base conversion and hexadecimal
arithmetic functions.
:123401 02030405060708
H ESMON will respond by reprinting
the line and will prompt for another
line by printing the next available ad­
dress. As with the Assemble com­
mand, you may exit by typing
RETURN.

4
Alphabetical List and M.L. between the address and the
Description of HESMON assembly code. HESMON will then
prompt for the next line of assembly
Commands code by displaying the next address
The following section lists the followed by a space and the input cur­
HESMON commands in alphabetical sor. If HESMON cannot interpret the
order describing each in detail and line, it will print a '?' instead of
giving example(s) of its usage. prompting for the next line. For exam­
ple, you type:
A - The Simple Assembler A 1200 LDA #41
The HESMON simple assembler pro­ H ESMON responds by overprinting
vides an easy way to enter short M.L. your line and then prompting for the
programs. It does not have all the next line as follows:
features found in a complete
assembler such as HESBAL in HES's A 1200A941 LDA#$41
6502 Professional Development A 1202
System for the VIC and Commodore
Note - HESMON ignores anything to
64, but it provides increased conve­
the right of a ':' on the line.
n ience compared to POKEing from
BASIC or entering hexadecimal codes
using a more primitive monitor. The
B - Breakpoint Set
syntax of HESMON's Assembler com­ There are three different methods to
mand is as follows: return to HESMON from a M.L. pro­
gram. The Breakpoint Set command is
A 1111 MMM 00000
one of them. This command allows
where '1111' is a four dig it hex­ you to designate an address in a pro­
adecimal address in the C64's RAM, gram as a 'breakpoint,' that is, a place
'M MM' is a standard three character where the program is to be halted and
assembler mnemonic for a M.L. opera­ control is to be returned to HESMON.
tion code (op-code), such as JSR, Breakpoint Set also allows you to
LDA, etc. '00000' is the 'operand' of specify the number of times the in­
the op-code. It is beyond our scope struction at this address is to be ex­
here to discuss fully the meaning of ecuted before the breakpoint is ac­
t hose parameters - for a complete tivated. The breakpoint defined with
discussion, consult a book on 6502 Breakpoint Set is effective ONLY
assembly language programming. See when the C64 is executing HESMON's
Section I for a simple example of A's Quick Trace command. For example,
usage. Notice that since all numeric to halt a program, that starts at ad­
operands MUST be in hexadecimal dress $1200, on the fifth repetition of
notation the customary '$' preceding the instruction at address $1234, you
these numbers is optional; as is the ',' would type:
preceding 'X' or 'Y' in indexed instruc­
B 1234 0005
tion operands. If HESMON
Q 1200
understands the line, it will reprint it
showing the corresponding byte(s) of

5
The first line above sets the break­ C - Compare Memory Blocks
point at $1234 and the repeat count to
This command compares two sec­
five. The second line initiates the
tions of memory and reports any dif­
Quick Trace mode of program execu­
ferences by printing the address of
t ion (see the Quick Trace command).
one member of the mismatched
When address $1234 has been
pair(s). The syntax is as follows:
reached for the fifth time H ESMON
will halt execution of the program, C 1111 2222 3333
display the current values of the 6502
registers, and enter the single-step where 1111 is the start address of the
mode of execution (see the Walk com­ first section, 2222 is the end address
mand). of the first section, and 3333 is the
start address of the second section ­
The second method to return to the one to be compared with the first
HESMON from a M.L. program is to section. This command may be
insert a 6502 'BRK' instruction into stopped (in case a large number of ad­
the program. Obviously, since this dresses are printed) with the STOP
method requires program modifica­ key. For example, suppose you have
tion, it may be used only with pro­ two disk files containing (you thought)
grams in RAM. Finally, HESMON may the same M.L. program residing at
be called by simply pressing the locations $1400 to $147F. However,
RESTORE key. In either of these last when you used the BASIC command
two cases HESMON will be re-entered VERIFY, it said 'VERIFY ERROR' .
whether or not the Quick Trace mode Naturally , you wonder just where the
was active. If a BRK instruction was difference is. VERIFY can only tell you
encountered, the 'break' entry register they differ SOMEWHERE. Compare
display will be printed showing the Memory Blocks may be used to find
contents of the 6502 registers. out: First use HESMON 's Load com­
Similarly, if the RESTORE key is mand to load one of the files (See
pressed, the RESTORE entry register Load). Then move that program to
display is shown. In the latter case, $1500 using the HESMON Transfer
the screen is cleared first. The Memory Block command: T 1400
RESTORE key method of H ESMON re­ 147F 1500. Next Load the other file.
entry will work any time the HESMON Now compare the two files using
cartridge is plugged in - unless an Compare Memory Block:
RS232 file has been accessed or the
6502 has attempted to execute an C 1400 147F 1500
undefined op-code (one that H ESMON will print a list of all the
disassembles as '???'). After an memory locations which differ be­
RS232 file has been attempted tween the two programs.
H ESMON may be fe-entered from
BASIC via a BRK instruction . Type D- Disassemble Memory
'SYSS' to cause a break entry. This command is the inverse of the
Assemble command. It interprets
memory contents as M.L. instructions
and displays the assembly language
equivalent. Disassemble is used in
6
two distinct ways. First, it may be (PET, VIC, etc.) by translating the
used to disassemble a section of system calls of one computer to
memory by specifying an address those of another. Of course the
range , such as: capabilities of these computers are
different so one cannot always
D 1111 2222 achieve a perfect translation, but at
where 1111 is the start address and least a functioning version can be
2222 is the end. This type of made without completely rewriting
disassembly is convenient when used the program. The heart of this com­
in conjunction with HESMON's Out­ mand is a table of corresponding ad­
put Divert command to produce a dresses. This table contains four-byte
hardcopy listing of a M.L. program. entries consisting of pairs of ad­
Second, the disassemble command dresses. These address pairs are the
may be started by entering a single addresses in the respective computer
parameter, the beginning address: operating systems that perform a
given task. Typically these will be ad­
D 1111 dresses in the ROM firmware of the
This mode is handy for examining a computers. The correspondence table
M.L. program on the screen because, must be supplied by you. Lists of
once the first line is displayed, common ROM routine addresses in
preceding or subsequent lines of various 6502 computers have ap­
code may be disassembled by press­ peared in several places, most notably
ing the cursor-up or cursor-down key in COMPUTE! magazine (e.g., "VIC
respectively. Memory Map Above Page Zero", COM­
PUTE! Vol. 4, No.1, P. 181); "Butter­
You may alter a program in RAM using field on Commodore", Commodore
the Disassemble command's output. Magazine, Oct.lNov., 1982, pp. 81 ft.;
If you move the cursor to the line you and, for the PET, in "PET/CBM Per­
wish to alter, change the byte display sonal Computer Guide" by Osborne
(not the mnemonic), and press return; and Donahue.
HESMON will alter the memory con­
tents and retype the line showing the For example, suppose you have load­
altered bytes and the corresponding ed into your C64 a M.L. program in­
disassembly. Then HESMON will tended to run in a PET with BASIC 4.0
prompt for the next line by printing ROMs. We will assume it is in loca­
the next address and leaving the input tions $1200 to $13FF. Many of its ex­
cursor on the same line. To exit this temal subroutine calls are probably of
mode type RETURN, just as with the the form JSR $FFxx. The subroutines
Simple Assembler command. at these addresses are all almost iden­
tical in function to those of the same
E - External Relinker address in the C64 because these en­
try points are in a 'jump table' set up
This command is rather difficult to for the purpose of standardizing
understand, but the effort is worth it! system calls between the different
Basically , this command facilitates Commodore ROM sets. So what's the
the transport of M.L. programs from
one 6502-based computer to another

7
problem? Any subroutine call in the found, it will show the disassembled
address range $BOOO to $FFOO pro­ line containing the unknown address
bably also has an equivalent in the and wait for the entry of the cor­
VIC, but it's at a different address! respondence address. We will look up
This is where External Relinker comes the PET address in the published
in . Extemal Relinker will find such table, find its equivalent in the C64
subroutine calls and replace them table , type the VIC address over the
with the corresponding C64 ROM one on the screen, and press
routine calls - if we can identify the RETURN. HESMON will add the new
correct replacement (this is where the correspondence to its table, alter the
published ROM maps come in). If we address reference in the program and
already have a correspondence table then continue its search. On subse­
constructed in an earlier session with quent occurrences of this address
Extemal Relinker, we simply load it H ESMON will automatically make the
using the Load command . But, if we specified replacement.
don't have a table, External Relinker
will use our answers to its queries to F- Fill Memory Block
construct one we may save for future
This command is used to set a sec­
use. For the present example, sup­
tion of memory to a particular value.
pose we have no table, just two ROM
The syntax is as follows:
maps. We want to construct a table
starting at $1000, so we start it by F 1111 2222 33
entering four zeroes (four zeroes
denote the last entry in the table) where 1111 and 2222 are the first and
using the Fill Memory Block com­ last addresses (inclusive) of the sec­
mand. tion to be filled and 33 is the hex­
adecimal quantity to be written . See,
F 1000100300 for example, the usage in the example
of Extemal Relinker.
Then we start External Relinker:
G - Go (execute program)
E 1200 13FF 1000 BOOO FFOO
This command transfers control of
The first two parameters tell External
the C64 to a M.L. program; that is, it
Relinker where the start and end of
starts execution of the M.L. program .
the program we are working on are.
It may be used with or without an ad­
The third says where the cor­
dress parameter. If no address
respondence table starts. The last two
parameter is given , execution is
give the address range we're in­
begun at the address shown in the
terested in relinking. At this point Ex­
program counter (PC) of the Register
ternal Relinker will start disas­
Display command. For example you
sembling our program from $1200 to
may exit HESMON and 'warm start'
$13FF, looking for references to ad­
BASIC by typing:
dresses in the specified range of
$BOOO to $FFOO. When it finds such G A474
an address it will first consult the cor­
respondence table which starts at The C64 will respond, "READY." . For
$1000 - if no entry for the address is another example, see Section 1.

8
H - Hunt for a Sequence L- Load 'Program'
This command locates a specific se­ This command 'loads' (i.e., reads) a
quence of bytes in memory. It has two 'program' into memory from an exter­
forms, as follow: nal device such as tape or disk. The
loaded material need not actually be a
H 1111 2222 33 44 55 ... . program. For example , it may be a
H 1111 2222 " ABCDE .... " section of memory containing a data
where 1111,2222 are the first and last table for External Relinker that was
addresses of the range of memory to saved to tape or disk using the Save
be searched and 33, 44, etc., are the command . However, the most com­
hexadecimal byte(s) to be found , mon use of Load is to retrieve M.L.
separated by spaces. The second programs from tape or disk. Note that
form allows the bytes to be specified HESMON's Load should NOT normal­
as characters enclosed by quotes. For ly be used to load a BASIC program .
example to find all subroutine calls to The syntax of Load is as follows:
the character output routine (AB47) in L "programname" 11
the C64 ROM's we would type:
where 'programname' is the name of
H AOOO FFFF 20 47 AB the file to be loaded (be sure to in­
H ESMON responds with a list of all clude the double quote marks) and
such subroutine calls. Note that, as '11' is the device number from which
usual , the low and then high order to load. If the device number is omit­
bytes of the address were specified. ted, the tape drive will be assumed ; if
the filename is also omitted, the first
To find all occurrences of the string file found on the tape will be loaded.
' READY' (there is only one, at $A378), For example:
we would type:
L "YAHTZEE" 08
H AOOO FFFF "READY"
The above loads YAHTZEE from
I- Interpret Memory device eight, the disk drive.
This command displays the contents M - Memory Display
of memory as 'ASCII' characters . It is This command displays the contents
similar to the Memory Display com­ of memory in hexadecimal notation . It
mand except that it shows 32
This command displays the contents
characters per line. It may be used
of memory in hexadecimal notation . It
with either one or two parameters and
is similar to the Disassemble com­
its output may be scrolled just as with
mand in that it may take either one or
the Disassemble command. For exam­
two addresses as parameters. The
ple, to see the table of BASIC's
two-parameter form displays from the
keywords and error messages, type:
first address to the second; the one­
I AOOO A300 parameter form shows eight bytes
beginning with the address given.
Also like the Disassemble command ,
the output of Memory Display may be

9
scrolled up or down with the cursor­ tual memory range to scan, 3333 is
up and cursor-down key. For example : the 'offset' to add to adjusted ad­
dresses, 4444 and 5555 specify the ad­
M AOOOA040
dress range of references which are
shows from $AOOO through $A047 in to be adjusted, and W (if present)
hex and in characters, eight bytes per specifies that the scanned range is <..l
line. To see more, press cursor-up or table of 'words' with no op-codes. If
-down. not in the 'word table' mode, New
Locator will halt and display any line
N- New Locator of machine code it can't disassemble .
This command is a relative of the Ex­ 0 - Output Divert
ternal Relinker command . It has a dif­
ferent general purpose, however. New This command is HESMON's
Locator is designed to convert ab­ equivalent to BASIC's CMD com­
solute address references in a M.L. mand. It allows HESMON 's output to
program from one memory range to be printed on the C64 printer or stored
another. It is typically used following in a disk file instead of being
a Transfer Memory Block command to displayed on th e sc reen. This is the
relocate a program in memory. For ex­ preferred method to get HESMON's
ample, suppose you have just moved output on a device o ther than the
a M.L. program from $1200-$1280 to screen . Output Divert has a number of
$1300-$1380 using T. Any address options. The com plete syntax of the
references within the program now command is:
pOint $0100 too low. New Locator can
011 22 "filename"
fix this . Type:
where '11' is th e devic e address where
N 1300 1380 0100 1200 1280
the output is to be sent (normally 04
The meaning of the above line is as for the printer), '22' is th e 'secondary
follows: Disassemble from $1300 to address ' of the devi ce (typically 02 to
$1380 checking for addresses in the OE for the disk drive), and 'filename' is
range $1200 to $1280. Add $0100 to the filename to be used for storing the
any such addresses. If we had moved output (see your disk drive documen­
a table of addresses, for example a tation). All of these parameters are op­
'j ump table' (pairs of numbers of ad­ tiona\. If you merely type '0' HESMON
dresses, low byte followed high byte) , wi ll open a file to device 4, the printer,
instead of actual machine code; we and start diverting its output. If you
would put a 'W' following the last type '0 ' when the output is already be­
parameter to tell New Locator to treat ing diverted , the file will be closed and
the memory contents as pairs of ad­ the output will be directed to the
dress bytes rather than M.L. The screen again. That is, typing '0' 'tog ­
general Syntax for New Locator is the gles' Output Divert on and off. If you
following: want explicitly to revert to screen out­
put, type '03F'. The secondary ad­
N 1111 2222 3333 4444 5555 [W] dress and filename default to 'none'
where 1111 and 2222 specify the ac­ since they are not needed by the
printer. For more information about
10
filenames and secondary addresses , R - Register Display
consult the documentation for the
This command displays HESMON's
device to which you wish to divert
current 6502 pseudo reg ister contents
H ESMON 's output.
as well as the current interrupt re­
P- Print Screen quest (IRQ) RAM vector. The IRQ vec­
tor is shown as a convenience to the
This command is a limited version of programmer who wishes to use this
Output Divert. It copies the current vector to run interrupt-driven or
screen display to printer or disk. It's 'background' routines. This vector
just like having a snapshot of the cur­ may be altered like any of the register
rent screen image. The parameters of contents ; however, extreme caution
Print Screen are the same as for Out­ must be exercised in so doing
put Divert , except there is no toggling because the replacement is made IM­
becau se Print Screen automatically MEDIATELY, not at the time of execu­
reverts to screen output at the com­ tion of a Go command. Therefore, the
pl etion of the screen copy. Note: Print interrupt handling routine must be in­
Screen will NOT copy high resolution place BEFORE the IRQ vector is
graphics. altered .
a- Quick Trace There are no parameters for the
Register Display command , Just type
This command is used after the 'R '. To alter the register contents,
Breakpoint Set command in de­ move the cursor to the line beginning
bugging M.L. programs. It takes one with ';' and overwrite the display. Then
o r zero parameters just like the Go hit RETURN and the contents will be
command. If specified, the parameter altered . Note that the display, except
gi ves the address at which to begin as noted for the IRQ vector, shows
execution . If omitted, execution the contents of the 6502 registers at
begins at the PC shown in the register the time HESMON was entered . These
display. The difference between Quick registers will be set by HESMON to
Trace and Go is that a breakpoint, the values shown in the register
defined with the Breakpoint Set com­ display just prior to beginning execu­
mand , is only recognized in the Quick tion of a program using the Go, QUick
Trace mode of execution - the break­ Trace, or Walk commands . For a fuller
point will be ignored if execution is discussion of the meaning of this
begun with the Go command. Pro­ display, see Section I.
gram execution is much slower with
Quick Trace than with Go because S - Save 'Program'
Quick Trace is really just a fast ver­
sion of the Walk (single step) com­ This command saves the contents of
mand . Using Quick Trace, instructions a specified range of memory to an ex­
are executed one at a time and ternal device as a non-relocating 'pro­
HESMON is re-entered after each. gram ' file. The 'non-relocating ' part
This process continues until the means that the program may be
defined breakpoint is reached . For an
example of Quick Trace usage, see
the Breakpoint Set command .
11
reloaded from tape using BASIC's v- Verify RAM Function
LOAD command. The syntax of Save
This command tests a section of RAM
is as follows:
for proper function. Its syntax is:
S " filename " 11 22223333
V 1111 2222
where 'filename' is the filename to be where 1111,2222 are the first and la st
used (don't forget the double quote memory locations of the block to test.
marks), '11' is the device number on H ESMON will keep cycling the test
which to save (01.for the tape and 08 over the address range specified until
for the disk drive). '2222' is the be­ the STOP key is pressed (it may be
ginning address. '3333' is the last ad­ necessary to hold it down for a
dress PLUS ONE of the memory area second or two). At the successful
to be saved. All the parameters must completion of each test of the
be given, except that in tape saves the memory block, H ESMON will print a '.'
' filename ' may be null (""). For exam­ to show it is wo rking . If a memory
ple, to save a M.L. program residing locat ion fails th e test, HESMON will
from $1500 to $1 DFF to the disk as print its address followed by a binary
'APROGRAM ', type:
number showin g the datt.! incorrectly
S " A PROGRAM" 08 1500 1EOO stored. The bits o f tho number are
shown most sig nif icant (bit 7) to least
Again, notice the last parameter is significant (bit 0) left to right. The bits
one byte higher than the last program of the RAM locati on that are different
address. Also , note that HESMON's from the test data aro printed in
Save should NOT be used to save reverse field . Usin g tho information
BASIC programs because HESMON printed on the screon It will usually be
saves programs as absolute, not possible to pinpo int th o bad RAM
relocatable , files. lC(s). Note th at if you 'tos t' addresses
that contain no RAM, a seemingly ran ­
T - Transfer Memory Block dom pattern of nu mbers will be
This command transfers the contents printed .
of a block of memory to another area.
Its syntax is as follows: W - Walk Program

T 1111 2222 3333 This command causes single-step ex­


ecution of a M. L. program under user
where 1111 , 2222 are the first and last control. It , like Go and Quick Trace ,
address (not last-plus-one) of the may be used wit hout a parameter to
block to move and 3333 is the starting begin at th e regis ter d isplay 'PC' loca­
address where the block is to be tion ; or it can accept one parameter
moved to. that specifies the starting address. To
exit the Walk mode, press the STOP
U - (Test Color RAM) key. To step as rapidly as the registers
U has no parameters. It tests the color can be printed, press th e SPACE bar.
RAM for proper function and prints To step at the key repeat rate, press a
'OK' if they are working . If there is a normally repeating key, e.g., the c ur­
bad byte, its address will be printed.

12
sor down key. To take one step only, because the return address for the
press a normally non-repeating key, JSR instruction was 'pushed' on the
e.g ., the left-arrow key. The 'J' key has stack before the jump to $AB47 was
a special function in Walk mode. It executed . Let's press the left-arrow
causes HESMON to continue execu­ once more:
tion at full speed until a return-from­
25000000 F6
subroutine instruction is executed.
,E10C 2002 FF JSR $FFD2
For example, type:
Here we finally get to a place where
WAAD7
the C64 is going to a 'Kernal' routine
H ESMON will begin execution at we can recognize: the character out­
$AA07 the carriage return , linefeed put routine $FF02. Since this routine
output ROM routine. After executing is documented in the C64 literature,
the in s truction at that address we know exactly what it will do: print
HESMON will halt, showing the the character $00 in the accumulator.
reg ister contents and a disassembly Therefore, we needn't single step fur­
of th e next instruction the C64 will ex­ ther through that routine. So we press
ec ute if Walk is continued. The the 'J' key. HESMON shows (after a
d isp lay in the above example is as blank line - where the carriage return
fo ll ows: was printed):
5 000000 FA 20000006 F6
,AA09 20 47 AB JSR $AB47 ,E10F BO E8 BCS $EOF9
The first of the two lines above shows Now the C64 is at the point just
th e 6502 register contents in the same following the JSR $FF02 instruction.
o rder as the Register Display com­ The 'carry' bit (bit 0) of the status
mand: SR AC XR YR SP. This example register (SR = $20) is clear (0), so the
assumes HESMON has just been cold branch on carry set (BCS) will not be
started, otherwise the registers - ex­ taken. At this pOint we may continue
cept the accumulator - may differ to single step through this subroutine
from those shown here. The second by pressing left-arrow; return to the
line shows that the C64 will next do a next higher level of code (SP = $F8) by
subroutine call to $AB47, the pressing 'J'; or quit the Walk com­
character output routine used by mand by pressing STOP.
BASIC. To continue, press any key ex­
cept STOP or 'J' (no need to hit X ·Exit to BASIC
RETURN). Suppose we press the left­ This command gives control to the
arrow key once. HESMON will now C64's BASIC interpreter. It has two
show two more lines: forms. The first form 'XC' has the
25000000 F8 same effect as if the C64 were turned
,AB47 20 OC E1 JSR $E10C off and then back on without the
HESMON cartridge plugged in except
Now we see the C64 is at location that HESMON may be entered by
$AB47 about to execute a subroutine pressing RESTORE. The second form
call to $E10C. Notice the stack pOinter 'X' causes a 'warm start' of BASIC,
(SP) has been decremented by two

13
similar to pressing RESTORE when H ESMON shows (beginning on the
H ESMON is not plugged in. Your first same line):
exit to BASIC from H ESMON after
turning on the C64 should be an 'XC',
+ 1234 5678 = $68AC 26796
otherwise BASIC may misbehave.
While in BASIC, to achieve the same - - Hexadecimal Subtraction
effect as pressing STOP & RESTORE This command prints the difference ()f
without HESMON: First press two hexadecimal numbers in hex and
RESTORE. Then type 'X' and hit decimal:
RETURN.
- 12345678
It - Convert Decimal to Hexadecimal H ESMON shows (beginning on the
This command prints the hexadecimal same line):
equivalent of a decimal number. If the - 12345678 = $BBBC 48060
decimal number is negative it shows
the two's complement 16-bit hex Notice that the deC imal number in
equivalent and the corresponding this example is positive even though
positive decimal number. For exam­ we would expect the result of this
ple: subtraction to be negative. This is
because the two-byte number $BBBC
# 1234 doesn 't retain the information that the
H ESMON shows (on the same line): result is negative. If you want to know
the true negative dec imal result,
# 1234 = $0402 1234 either type in th e operands in the
reverse order, o r typo:
$ - Convert Hexadecimal to Decimal
- 0000 BBBC = $444417476
This command prints the decimal
equivalent of a hexadecimal number. So, the true dec imal valu e o f the dif­
For example: ference $1234 - $5678 is - 17476.
$ ABCD
H ESMON shows (on the same line):
$ ABCD 43981

+ - Hexadecimal Addition
This command prints the sum of two
hexadecimal numbers in hex and
decimal. All four digits, including
leading zeroes if needed, must be
used. Example:
+ 12345678

14
Things to be careful about Acknowledgements
when using H ESMON The seeds of HESMON are contained
The BASIC interpreter has control of in the public domain monitor pro­
the C64 at all times when BASIC is grams for the PET/CBM computers
running . This means that the worst known as MICROMON and EX­
that's likely to happen if your BASIC TRAMON . These programs, while not
program has an error is that BASIC directly useful in the C64 environ­
will issue a 'SYNTAX ERROR' ment, provided at least the general
message and stop your program. A framework and the philosophy of
M.L. monitor, on the other hand, must user-friendliness which distinguish
allow its user to take complete control them and HESMON from other M.L.
of the C64 to execute certain com­ monitors of the author's experience.
mands. So, if your M.L. program has VIC, PET, C64 and CBM are
an error and you attempt to execute it trademarks of Commodore.
using the Go command, the likely
result is that the C64 will go catatonic
- that is, even the RESTORE key may
not bring back HESMON . In this event
you will have to turn the power off and
back on to get back to HESMON. You
may avoid this catastrophe by using
th e Walk command to check out your
prog ram. Nevertheless, you can still
nd the C64 to never-never land by
attempting to Walk through an in ­
struction that disassembles as '???'.
These instructions are
'unimplemented op-codes' . They do
not have a defined result. Many of
them cause the 6502 to 'crash' - that
is, enter a state from which it may be
recovered only by powering on again.
HESMON uses 33 bytes near the bot­
tom of the machine stack ($120-$141)
for its variable storage. Most M.L. pro­
grams do not use a sufficiently large
amount of the stack to interfere with
this storage - but it is a possibility to
be aware of. Large, complex BASIC
programs sometimes do use enough
of the stack to interfere with these
locations. And finally, RS 232 files will
not work correctly when H ESMON is
plugged in.

15
Appendix A
The HESMON Commands
in Brief
The following is a condensed list of
HESMON's commands for quick
reference. Brackets ([]) denote optional
parameters.

A 1111 MMM 000000 - Simple Assembler


B 1111 2222 - Breakpoint Set
C 1111 22223333 - Compare Memory Block
D 1111 [2222] - Disassemble
E 1111 2222333344445555 [W] - External Relinker
F 1111 222233 - Fill Memory Block
G [1111] - Go
H 1111 2222 33 44 55 .... 0 r
1111 2222 "XXXXX . . .." - Hunt for sequence
I 1111 [2222] - Interpret Memory
L "name" 11 - Load Program
M 1111 [2222] - Memory Display
N 1111 2222333344445555 [W] - New Locator
0[11 [22 ["name" ]]] - Output Divert
P [11 [22 ["name"]]] - Print Screen
Q [1111] - Quicktrace
R - Register Display
S "name " 11 22223333 - Save Program
T 1111 22223333 - Transfer Memory Block
U - Test Color RAM
V 1111 2222 - Verify RAM
W [1111] - Wal k
X[C] - Exit to BASIC
# 11111 - Decimal to Hex
$ 1111 - Hex to Decimal
+ 1111 2222 - Hex Addition
- 1111 2222 - Hex Subtraction
: 1111 223344556677 88 - Memory Modify
; 1111 22223344556677 - Register Modify
, 1111 11 [22 [33]] XXXX - Disassembly Modify

16
Copyright Notice
Copyri ght © 1982 by Human
ngineered Software. All rights
reserved . No part of this publication
may be reproduced in whole or in part
without the prior written permission
of HES. Unauthorized copying or
transmitting of this copyrighted soft­
ware on any media is strictly pro­
hibited.
Although we make every attempt to
veri fy the accuracy of this document,
we cannot assume any liability for er­
ro rs o r omissions. No warranty or
th er guarantee can be given as to the
c uracy or suitability of this software
ror a particular purpose, nor can we
1m liable for any loss or damage aris­
111 0 from the use of the same.
t tL SM()N 64 is a registered TM of
I II"S.
Copyright Notice
Copyright © 1982 by Human
Engineered Software. All rights
reserved. No part of this publication
may be reproduced in whole or in part
without the prior written permission
of HES. Unauthorized copying or
transmitting of this copyrighted soft­
ware on any media is strictly pro­
hibited.
Although we make every attempt to
verify the accuracy of this document,
we cannot assume any liability for er­
rors or omissions. No warranty or
other guarantee can be given as to the
accuracy or suitability of this software
fo r a particular purpose, nor can we
be liable for any loss or damage aris­
Ing from the use of the same.
HESMON 64 is a registered TM of
HES.
a..
CD
iii
~
'5
CI)
"0
CD
0;
CD
c
00>
c
w
c
'E"
::J
Human Engineered Software ::c
71 Park Lane C\I
<Xl
Brisbane, California 94005 (J)

Telephone (415) 468-4110 u

S-ar putea să vă placă și