[comp.sys.m68k] MON68K - 68000 Monitor program part 4/4

thomasw@vlsi1.CS.Concordia.CA (Thomas Wieland 1728423) (10/18/89)

#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create:
#	mon68.ch5.doc
#	mon68.qref
# This archive created: Tue Oct 17 19:48:20 1989
export PATH; PATH=/bin:/usr/bin:$PATH
echo shar: "extracting 'mon68.ch5.doc'" '(30933 characters)'
if test -f 'mon68.ch5.doc'
then
	echo shar: "will not over-write existing file 'mon68.ch5.doc'"
else
cat << \SHAR_EOF > 'mon68.ch5.doc'

5. Technical Information


This chapter will give you information about the inner workings
of MON68K. The information in this chapter is not needed to work
with the monitor but it is intended for those who want to know
more about how the program works and who may be interested using
some of the built-in subroutines of the monitor.

On your MON68K distribution disk, you will find, among others,
the files MON68K, MON68K/1, MON68K/2AB and MON68K/2CD. These
files make up the heart of the monitor.

MON68K contains a short machine language program which will
initialize the language card and some page three vectors and
which will then load the codefiles containing the monitor
program. Information on how to customize the loader program of
MON68K for your system (i.e. if you need to accomodate RAM disk
drivers or similar programs) will be presented in section 5.2.

MON68K/1 contains all the 6502 code for the monitor, this is the
EXEC mode and the I/O package for communication with the 68000.
This part will be discussed further in section 5.1.

MON68K/2AB and MON68K/2CD hold the code for monitor mode. This
is the 68000 part of the monitor and will be loaded to the DTACK
board during the operation of MON68K. For further details, see
section 5.2.



5.1. The 6502 part of MON68K
----------------------------

This section will describe the part of the monitor code which
resides in Apple memory at all times and which makes it possible
for the 68000 to use the Apple as a terminal.


5.1.1. The boot process
-----------------------

When you BRUN MON68K, this program will in turn load the 6502
and 68000 code files. As a first step, the Apple monitor will
will be copied onto the language card from $F800 through $FFFF.
Following this, the language card is enabled and the three code
files are loaded into the language card.

The two parts of the 68000 code are kept in RAM starting at
$D000 on bank one and two on the language card. The 6502 code is
loaded starting at $EC00 and extends up to $F7FF. As all code is
kept on the language card, it is possible to reload the 68000
monitor program to the DTACK board if it has been destroyed.

If your system is configured for it, the helpfile MON68K/HLP
will be loaded at $8800 into Apple RAM.

As it has to be possible to switch from the language card to
Applesoft and back, some code is needed to do the bankswitching.
This code is moved to $9C00 by the boot program and then the DOS
buffers are moved down one page to protect this code. This is
the same method that is used by some programs like PLE and, as I
understand, by some RAMcard drivers, so there may be problems if
you want to use any of these with MON68K. For this reason, the
source of the boot program has been provided to enable you to
modify it for your system (see chapter 5.2).

Finally, the boot program will read-enable the language card and
will jump to the monitor coldstart entry point at $EC00.


5.1.2. Coldstart and EXEC mode
------------------------------

The 6502 part of MON68K consists of two code parts and one
parameter block. The first part of code contains the coldstart
routines, the EXEC mode and all subroutines which belong to EXEC
mode. This code starts at $EC00 with a jump to the coldstart
routine. At $EC03 there is a jump to the warmstart entry point.

At coldstart, a checksum of the 6502 code is done, the 68000 is
reset, the 68000 part of the monitor code is loaded to the DTACK
board and a checksum of the 68000 code is done. If any of these
tests fails, the appropriate error message is given and the
program run will be aborted.

At warmstart, the 68000 is reset, a checksum of the 68000 code
is performed, the DOS error handler is redirected to a error
handler within MON68K and finally the EXEC mode menu is entered.
When leaving monitor mode a warmstart cycle is run, this way it
is ensured that the 68000 is ready to listen to commands given
to it by the 6502 host.

I will not comment on any of the other routines making up EXEC
mode as these are of no further use for the users of MON68K. All
these routines are used for is to make the EXEC mode work, they
are therefore rather specialized and quite uninteresting.


5.1.3. The 6502/68000 communication routines
--------------------------------------------

The second part of 6502 code contains all the routines used to
interface to the 68000. For one, these are routines to reset the
68000, to send a command byte and to transfer a block of memory
from the 6502 to the 68000 and back. These routines are similar
to the routines RES68K, SENDCMD, CMD7 and CMD8 used in the DTACK
utility package. All these routines use full handshake, so there
is no problem using MON68K with a dynamic RAM board.

When entering monitor mode from the EXEC mode menu, the Apple
enters the I/O routines contained in this second part of the
6502 code. These will coldstart the 68000 monitor code through
the DTACK board's boot ROM command #16, will initialize the
keyboard buffer and will then cycle in an I/O loop until this is
exited through either the 68000, CTRL-Z or RESET.


The I/O loop consists of the following steps:

- get user input from keyboard; process special characters (ESC,
  CTRL-S, CTRL-Z) and store all others in the input buffer.
- get input from the 68000; process special function calls and
  control-characters, display all others on the CRT. If the
  printer is selected, also send character to printer through
  printer interface routine.
- send data to the 68000; if the input buffer is not empty and
  the 68000 is ready, get the next element and send it on.
- start loop over.

All character I/O between the Apple and the DTACK board is done
in low ASCII (bit7=0).

The input buffer is a circular buffer of 256 bytes located in
page two of Apple memory. Using the Apple to buffer keyboard
input makes it possible to enter the next command while the
68000 is still processing the last.

The following control-characters are recognized when received
from the 68000:

CTRL-E : clear to end of line.
CTRL-F : clear to end of page.
CTRL-G : ring the Apple's bell.
CTRL-H : move cursor one character to the left.
CTRL-I : move cursor one line up.
CTRL-K : move cursor one line down.
CTRL-M : move cursor one line down and to the start of the line.
CTRL-O : move cursor to the top left position of the screen.
CTRL-P : move cursor to the top left and clear the screen.
CTRL-U : get the character at the current cursor position,
         convert it to low ASCII and send it to the 68000.
CTRL-X : flush input buffer and restart I/O loop.

All other control characters are ignored.


Special function calls:
-----------------------

To make it possible for the 68000 to have the 6502 execute
different tasks which cannot easily be handled by the above
protocol, a "special function call" routine has been
incorporated into the I/O protocol. The special function call
starts by the 68000 sending a $FF byte to the 6502, followed by
the number of the function it wants executed (0..21), followed
by any other data which may be required by the called routine.

Whenever the 6502 receives a databyte $FF from the 68000, it
leaves the I/O protocol described above and jumps to a special
routine, called the special function handler.

The special function handler in turn gets the number of the
called routine from the 68000, looks up the appropriate address
in the table of special functions and transfers control there.
From then on, the called routine is responsible for interpreting
the input from the 68000 correctly, executing the desired
function and returning to the I/O loop. The I/O loop is
restarted by executing a JMP ($F7FC).

The table of special functions starts at $F7D0, extends through
$F7FB and has a maximum of (decimal) 22 entries. Each entry
holds the start address-1 of the special function routine, high
byte first.

So far, special functions #0 through #9 have been defined,
functions #10 through #21 are left for extensions.

The special functions defined are:

# | Function
----------------------------------------------------------------
0 | leave monitor mode, warmstart EXEC mode
1 | set normal  video
2 | set inverse video
3 | HTAB to column N (N=0..39, from 68000)
4 | VTAB to line N   (N=0..23, from 68000)
5 | get keypress, convert to low ASCII and send char. to 68000
6 | get a "Y" or "N" from keyboard and send it to 68000
7 | toggle printer on/off, if turned on then initialize printer
8 | print help information
9 | HIRES graphics support, depending on the data byte N
  | received from the 68000, do the following:
  |  N=0: display text,  page 1
  |  N=1: display hires, page 1
  |  N=2: display hires, page 2
  |  N=16 ($10): get hires page 1 from 68000
  |  N=32 ($20): get hires page 2 from 68000
  | All other values of N are ignored.


5.1.4. The parameter block
--------------------------

[ ..deleted, too Apple specific.. ]



5.2. Changing the Boot Program
------------------------------

[ ..deleted, too Apple specific.. ]



5.3. The 68000 part of MON68K
-----------------------------

The part of MON68K written in 68000 assembly language holds all
the routines and data which make up the monitor mode. It is this
part of MON68K that is in control whenever you enter the monitor
mode from the EXEC mode menu.

The memory area occupied by the monitor extends from $1000, the
start of RAM on the DTACK board, up to $39FF. Space from $1000
to $1117 is taken up by the 68000's exception vectors and the
ROM monitor command vector table. Following that, the monitor's
code and data areas reach up to about $3750, with the rest up to
$39FF taken up by the monitor's stack area and input buffers.


5.3.1. Exception vectors and ROM command table
----------------------------------------------

The ROM on the DTACK board points the 68000's exception vectors
out to RAM starting at $1000, assigning six bytes to each
exception vector. Initially, these vectors are set to point back
to the boot ROM's "IDLE" routine. These RAM exception vectors
and some scratch memory space used by the boot ROM take up
memory up to $10F3, followed by the ROM monitor command vector
table for user commands $10 and up.

As there is almost no upper limit for the number of user
commands possible, I decided that 17 user commands, from $10
through $20, would be enough for the desired application.

Of these, commands $10 through $14 are used by the monitor as
described below:

Cmd | Address | Action
------------------------------------------------------------ ----
$10 | $10F4   |  Jump to coldstart entrypoint of monitor mode
$11 | $10F6   |  Jump to warmstart entrypoint of monitor mode
$12 | $10F8   |  Jump to monitor code selftest routine
$13 | $10FA   |  Address of routine determining RAM size
$14 | $10FC   |  Address of routine determining the entrypoints
    |         |  of the main routines of MON68K and other system
    |         |  variables

Of these commands, commands $10, $11 and $12 may be executed
directly from the Apple by sending the appropriate command byte.
Commands $10 and $11 do not return to the caller and command $12
will send back the result of the selftest and then jump to IDLE.
Commands $13 and $14 may only be called by another 68000
assembly language program, as they return using a RTS
instruction rather than a JMP IDLE.

At $1118 a routine is located which will handle I/O calls from
user programs as described in section 5.3.2.

A coldstart using command $10 will determine the system memory
size and initialize some monitor variables. Following this, a
header text will be printed and the coldstart routine falls
through into the warmstart routine.

The warmstart routine (command $11) will set the RAM exception
vectors to the appropriate exception handling routines inside
MON68K, will reset the system stack pointer and will then fall
through into the main monitor command loop. When using ESC to
stop execution of a monitor command, the 68000 will be reset
(this being the only way to stop it from the Apple) and a
warmstart command will be issued to the 68000.

The selftest routine will calculate a checksum of the monitor
code and compare it to the one stored in the monitor data area.
If the two sums match, $FF will be sent back to the Apple three
times to indicate that everything is o.k. If the selftest fails,
three times $00 will be sent back to the Apple. Afterwards, a
JMP back to IDLE is performed.

The routine at ($10FA) will determine the address of the highest
RAM cell and return this address in addressregister A0.
Registers D0, D1 and D2 will be destroyed, all other registers
and memory will be unaffected.

The routine at ($10FC) will load 68000 data and address
registers with data as follows:

Reg. | Contents
----------------------------------------------------------------
D0.W | Monitor version (current one is $0784 - July 84)
D1.L | Lowest  RAM address available to user
D2.L | Highest RAM address available to user
|
A0.L | Address of coldstart routine
A1.L | Address of warmstart routine
A2.L | Address of address table for I/O routines (see 5.3.2.)
A3.L | Address of address table for monitor commands (see 5.3.3)
A4.L | Address of entrypoint for move routine (see 5.3.3.)
A5.L | Address of entrypoint for disassembler (see 5.3.3.)


All other boot ROM commands from $15 to $20 may be used without
restrictions in the current version of the monitor.


5.3.2. MON68K I/O routines
--------------------------

A number of the monitor's I/O routines may be used by a user
program. To make these routines usable without problems in all
versions of MON68K, their entrypoints will not be given as
absolute addresses within the code, but rather through an
address table of I/O routines. The baseaddress of this table may
be obtained through a subroutine call to the address located at
$10FC (command $14). It will return the base address in address
register A2. Using this base address and the number of the I/O
routine as an offset into the table, you may then call any of
the I/O subroutines provided. (For an example on how to
calculate the offset and call the I/O routines, take a look at
the code of the I/O handler described below.)

Alternatively, you may also use the I/O handler at address $1118
with the appropriate call parameters. This routine expects the
number of the subroutine you want to use in data register D4. In
the present version, 26 I/O routines are provided, numbered from
0 to 25.

The following table lists the I/O subroutines available:

No.| Name     | Function
----------------------------------------------------------------
00 | GETLIN0  | Get a line of text, entrypoint to line editor
01 | GETRLST  | Parse a registerlist from the input buffer
02 | GETBYTE  | Get a data byte from the Apple
03 | SENDBYTE | Send a data byte to the Apple
04 | GETNUM   | Parse a number from the input buffer (all bases)
05 | HEXNUM   | Parse a hex number from the input buffer
06 | DECNUM   | Parse a decimal number from the input buffer
07 | BINNUM   | Parse a binary number from the input buffer
08 | PRTTEXT  | Print text delimited by a null byte
09 | PRTNCHR  | Print one character N times
10 | PRTREG   | Print register dump
11 | PRTSFCT  | Send special function number to the Apple
12 | PRTLHEX  | Print a 32-bit number as hex
13 | PRTWHEX  | Print a 16-bit number as hex
14 | PRTHEX   | Print an 8-bit number as hex
15 | PRTADR   | Print a 3-byte address
16 | PRTLDEC  | Print a 32-bit number as decimal
17 | PRTWDEC  | Print a 16-bit number as decimal
18 | PRTDEC   | Print an 8-bit number as decimal
19 | BINDEC   | Convert binary to decimal
20 | PRTLBIN  | Print a 32-bit number as binary
21 | PRTWBIN  | Print a 16-bit number as binary
22 | PRTBIN   | Print an 8-bit number as binary
23 | PRTLASC  | Print a 32-bit number as ASCII
24 | PRTWASC  | Print a 16-bit number as ASCII
25 | PRTASC   | Print an 8-bit number as ASCII


Before discussing each of the above I/O routines in further
detail, we first have to take a look at how MON68K handles its
input and output.

As already mentioned above in the 6502 section, keyboard input
is buffered in a circular buffer of 256 bytes in the Apple and
from there sent on to the DTACK board. The 68000 in turn, when
waiting for input from the 6502, puts the characters it receives
into another 256-byte buffer (INBUF) on the DTACK board, until
it receives a return character (CR, $0D) or a CTRL-Q ($11). When
processing the input line, two additional buffers are needed
for processing a bytelist. One buffer (LSTBUF, 254 bytes) is
used to hold the converted values of each byte, therefore making
it unnecessary to interpret the input line anew for longer
patterns; the other (BITBUF, 32 bytes = 256 bits) is used to
flag any wildcard characters in the bytelist. These three
buffers are situated immediately below the bottom of the freely
usable RAM, in the current version this is from $37E0 through
$39FF.

Output from the 68000 to the Apple is not buffered, the 68000
will wait until the Apple is ready to receive data.

Address registers A5 and A6 are used as pointers to the start and
the end of the input buffer (INBUF) in all routines dealing with
the input buffer. Furthermore, register D7 is used as a
flagregister, some bits of it flag certain states for some
routines. Some of these flags and their meaning are:

DELIM  (B0) :  1/0: Blanks are/aren't treated as delimiters by
               GETNUM during number conversion.

ASCLST (B2) :  1/0: GETNUM is currently inside/outside of an ASCII string.

ASCTYP (B1) :  1/0: If ASCLST=1, then the string is high/low
               ASCII (for string constants).

NUMFND (B3) :  1/0: When called, GETNUM did/didn't find a number
               at the current position in the input buffer.

SADR   (B4) :  1/0: Start address was/wasn't given (for command
               subroutines).

EADR   (B5) :  1/0: End address was/wasn't given (for command
               subroutines).


These flags have to be set correctly for the I/O subroutines to
function properly.


I will now discuss the I/O routines in greater detail:


#00 - GETLIN0: Get a line of text
---------------------------------

The task of this routine is to receive input from the Apple and
put it into the input buffer until a CR or CTRL-Q is received.
This routine incorporates all the line-editing features
described in chapter 3.1.

Input : None
Output: D2.B : number of characters in INBUF (w/o CR)
        A5 :   pointer to start of INBUF
        A6 :   pointer to last char. in INBUF (= CR)
               Characters of input line are stored in INBUF, the last
               character stored is a RETURN.
        D0,D1,D3,D7,A3,A4 : scrambled


#01 - GETRLST: Parse a registerlist from the input buffer
---------------------------------------------------------

This routine will try to parse a registerlist from the input
buffer and will return a register mask in D6. In this register
mask, each set (one) bit indicates a register selected, each
cleared (zero) bit means that the register has not been
selected.

The bits in the register mask are assigned as follows:
D0..D7 <=> Bit 0..Bit 7
A0..A7 <=> Bit 8..Bit 15
SR     <=> Bit 16

Input : None
Output: If reg.list found :  D6.L : register list
                             A5   : points to next character in
	                                input buffer after reg.list
        If reg.list not found :  D6.L : 0
	                             A5   : unchanged
        D0,D1,D2 : scrambled


#02 - GETBYTE: Get a data byte from the Apple
---------------------------------------------

This is the standard routine to receive a data byte from the
Apple. This routine will wait until data from the Apple is
received and therefore will "hang up" if none is coming !

Input : None
Output: D0.B : Data byte received from the Apple.


#03 - SENDBYTE: Send a data byte to the Apple
----------------------------------------------

This is the standard routine to send a data byte to the Apple.
This routine will wait until the data is accepted by the Apple
and therefore "hang up" if the data is not read by the Apple !

Input : D0.B : Data byte to send to the Apple.
Output: No registers destroyed.
        Byte in D0.B sent to Apple.


#04 - GETNUM: Parse a number from the input buffer
--------------------------------------------------

This routine tries to parse a number from the input buffer and
returns its hexadecimal equivalent. This routine recognizes the
base prefices and branches to the appropriate conversion
routine. It will also convert an ASCII (text) constant into a
number. Conversion is stopped by any non-numeric character
(according to the current number base).

Input : DELIM : if DELIM=1, conversion stops at the first
                <space> character encountered. In case of a text
                constant, the text will be converted one
                character at a time.
Output: A5.L : points to first character which could not be
               converted into the current number (= D0.B).
        D0.B : next character in input buffer.
        D1.L : if NUMFND=1, a number has been parsed.
        D2.L : scrambled.


#05 - HEXNUM: Parse a hex number from the input buffer
------------------------------------------------------

This routine will parse a hex number from the input buffer.
Input to and output from the routine are the same as for GETNUM,
except that A5 must already point to the first character of the
number (or <space>) and must not point to the base prefix
character '$'.


#06 - DECNUM: Parse a decimal number from the input buffer
----------------------------------------------------------

This routine will parse a decimal number from the input buffer.
Input to and output from the routine are the same as for GETNUM,
except that A5 must already point to the first character of the
number (or <space>) and must not point to the base prefix
character '#'.


#07 - BINNUM: Parse a binary number from the input buffer
---------------------------------------------------------

This routine will parse a binary number from the input buffer.
Input to and output from the routine are the same as for GETNUM,
except that A5 must already point to the first character of the
number (or <space>) and must not point to the base prefix
character '%'.


#08 - PRTTEXT: Print text delimited by a null byte
--------------------------------------------------

Prints text delimited (= ended) by a zero ($00) byte.

Input : A0 : points to the first character of the string.
Output: D0.B : 00
        A0 : points to the next byte after the zero byte.
        The string has been printed on the screen.


#09 - PRTNCHR: Print one character N times
------------------------------------------

Prints the same character N times.

Input : D0.B : ASCII character (or byte) to send.
        D3.W : N (count)
Output: D0.B : unchanged
        D3.W : $FFFF
        Character in D0.B is sent N times.


#10 - PRTREG: Print register dump
---------------------------------

Print a register dump of the selected registers.

Input : D6 : register select mask (bitvalues as in GETRLST).
        A4 : points to start of register save area.
Output: D0-D6,A0,A1,A4: scrambled.
        The selected registers are printed.


#11 - PRTSFCT: Send special function number to the Apple
--------------------------------------------------------

Input : D0.B : number of special function
Output: No registers destroyed.
        $FF and special function number sent to Apple.


#12 - PRTLHEX: Print a 32-bit number as hex
-------------------------------------------

Input : D2.L : Number to print
Output: D2.L : unchanged.
        D0,D1: scrambled.
        Number in D2.L printed as eight hex digits.


#13 - PRTWHEX: Print a 16-bit number as hex
-------------------------------------------

Input : D2.W : Number to print
Output: D2.W : unchanged.
        D0,D1: scrambled.
        Number in D2.W printed as four hex digits.


#14 - PRTHEX: Print an 8-bit number as hex
------------------------------------------

Input : D1.B : Number to print
Output: D1.B : unchanged.
        D0   : scrambled.
        Number in D1.B printed as two hex digits.


#15 - PRTADR: Print a 3-byte address
------------------------------------

Input : D2.L : Number to print
Output: D2.L : unchanged.
        D0,D1: scrambled.
        Number in D2.L printed as six hex digits followed by a colon.


#16 - PRTLDEC: Print a 32-bit number as decimal
-----------------------------------------------

Input : D2.L : Binary number to print.
Output: D2.L : unchanged.
        D0   : scrambled.
        Number in D2.L printed as ten decimal digits.


#17 - PRTWDEC: Print a 16-bit number as decimal
-----------------------------------------------

Input : D2.W : Binary number to print.
Output: D2.W : unchanged.
        D0   : scrambled.
        Number in D2.W printed as five decimal digits.


#18 - PRTDEC: Print an 8-bit number as decimal
----------------------------------------------

Input : D1.B : Binary number to print.
Output: D1.B : unchanged.
        D0   : scrambled.
        Number in D1.B printed as three decimal digits.


#19 - BINDEC: Convert binary to decimal
---------------------------------------

Input : D2.L : Binary number to convert.
Output: D2.L : Unchanged.
        D0,D1,D3 : scrambled.
        D6.W&D5.L&D4.L : Ten character ASCII text for decimal
                         number (high/mid/low characters).


#20 - PRTLBIN: Print a 32-bit number as binary
----------------------------------------------

Input : D2.L : Binary number to print.
Output: D2.L : unchanged.
        D0,D1,D3: scrambled.
        Number in D2.L printed as 32 binary digits.


#21 - PRTWBIN: Print a 16-bit number as binary
----------------------------------------------

Input : D2.W : Binary number to print.
Output: D2.W : unchanged.
        D0,D1,D3: scrambled.
        Number in D2.W printed as 16 binary digits.


#22 - PRTBIN: Print an 8-bit number as binary
---------------------------------------------

Input : D1.B : Binary number to print.
Output: D1.B : unchanged.
        D0,D3: scrambled.
        Number in D1.B printed as eight binary digits.


#23 - PRTLASC: Print a 32-bit number as ASCII
---------------------------------------------

Input : D2.L : Number to print as character value.
Output: D2.L : unchanged.
        D0,D1: scrambled.
        Number in D2.L printed as four ASCII characters.


#24 - PRTWASC: Print a 16-bit number as ASCII
---------------------------------------------

Input : D2.W : Number to print as character value.
Output: D2.W : unchanged.
        D0,D1: scrambled.
        Number in D2.W printed as two ASCII characters.


#25 - PRTASC: Print an 8-bit number as ASCII
--------------------------------------------

Input : D1.B : Number to print as character value.
Output: D1.B : unchanged.
        D0,D1: scrambled.
        Number in D1.B printed as two ASCII characters.



5.3.3. MON68K command routines
------------------------------

The entry points for MON68K's command routines are listed in a
table whose starting address can be obtained in address register
A3.L through ROM monitor command $14. The entry for each command
consists of a word address pointing to the start of the routine
handling that command. As it would lead to far to dig into the
specifics of each routine, it is enough to point out that
entries are ordered alphabetically from A to Z, followed by the
arithmetic commands in the same order as they are listed in
chapter three.

At the entry to every command routine, addresses or data of the
form <adr1>.<adr2> or <data1>.<data2> preceding the command
character have already been parsed by the command interpreter.
The argument values are passed in registers A1.L (1st argument)
and A2.L (2nd argument) and their presence (or absence) is
indicated by the SADR and EADR flags. Furthermore, A5 points to
the command character and D0.B holds the command character.

Two routines, the MOVE and DISASM routines, may be especially
useful and that is why their entrypoints are provided by ROM
command $14 in address registers A4.L and A5.L.




MOVE0 - move a block of memory
------------------------------

This routine will perform a nondestructive memory move as
described for the monitor M(ove command in section 3.4.

Input :  A1.L : start address of sourceblock
         A2.L : end   address of sourceblock
         A3.L : start address of destinationblock

Output:  the memoryblock from (A1) through (A2) has been moved
         to the destinationblock starting at (A3). No move will
         be done if A1=A3.
         A1,A2,A3 : scrambled.


DISASM - disassemble instruction
--------------------------------

This routine will disassemble one instruction starting at (A1).

Input : A1.L : points to the first (or only) word of the
        instruction (address must be even).

Output: two lines will be displayed on the screen in the same
        format as in the monitor L(ist command, the first line
        showing the address and the hexadecimal opcode for the
        instruction, the second its mnemnonic representation.

        A1.L : points to the word after the last word of the
               previous instruction.

All other data and address registers remain unchanged.




5.3.4. DTACK Memory Map
-----------------------


$000000  ------------------------------------------------
         | ROM exception vectors (four bytes each)      |
$000100  |----------------------------------------------|
         | DTACK boot PROM ($122: IDLE)                 |
$000400  |----------------------------------------------|
         | reserved for memory mapped I/O               |
         | ($FF8: data input, $FFA: data output/status) |
$001000  |----------------------------------------------|
         | RAM exception vectors (six bytes each) and   |
         | temporary storage area for PROM monitor      |
$0010F4  |----------------------------------------------|
         | PROM command vector table (two bytes each)   |
$001118  |----------------------------------------------|
         |                                              |
         | I/O handler for user programs and start of   |
         | MON68K monitor mode code and data area       |
         |                                              |
$0037E0  |----------------------------------------------|
         | monitor input buffer INBUF (256 bytes)       |
$0038E0  |----------------------------------------------|
         | temporary buffer for bytelists (256 bytes)   |
$0039E0  |----------------------------------------------|
         | flag area for wildcards (32 bytes)           |
$003A00  |----------------------------------------------|
         | start of free RAM (to top of RAM)            |
         .                                              .
         .                                              .



Note: Memory assignments from $1118 and up are shown for monitor
version 2.2 only, these may change later on.

SHAR_EOF
if test 30933 -ne "`wc -c < 'mon68.ch5.doc'`"
then
	echo shar: "error transmitting 'mon68.ch5.doc'" '(should have been 30933 characters)'
fi
fi
echo shar: "extracting 'mon68.qref'" '(5665 characters)'
if test -f 'mon68.qref'
then
	echo shar: "will not over-write existing file 'mon68.qref'"
else
cat << \SHAR_EOF > 'mon68.qref'

                       MON68K Command Reference
                       ========================


1. Line editor control characters
---------------------------------

Cursor movement:

CTRL-B : move cursor to the beginning of the line.
CTRL-H : move cursor one character to the left (left arrow)
CTRL-I : move cursor one line up.   (*)
CTRL-J : move cursor one character to the left.
CTRL-K : move cursor one line down. (*)
CTRL-L : move cursor one character to the right.
CTRL-N : move cursor to the end of the line.
CTRL-O : move cursor to the top of the screen. (*)
CTRL-P : move cursor to the top of the screen and clear screen. (*)
CTRL-U : move cursor one character to the right (right arrow)

(*) CTRL-I,K,O,P commands may only be typed in as the first characters
    on a line, later they will not have any effect.


Line editing:

CTRL-A : add (insert) characters at cursor position. Insertion is
         cancelled by any other control character.
CTRL-D : delete one character at cursor position.
CTRL-M : accept the current input line as it is (<RETURN>).
CTRL-Q : truncate input line at cursor position and accept line.
CTRL-R : recover and retype last input line. Tries to restore a valid
         input line from the contents of the line input buffer. Should
         this be impossible, the bell will ring.
CTRL-X : cancel the current input line and flush the buffer.


Miscellaneous:

CTRL-C : convert the letter under the cursor to opposite case.
CTRL-E : clear the screen to the end of the line and truncate the
         current input line to the right of the cursor.
CTRL-F : clear the screen to the end of the page and truncate the
         current input line to the right of the cursor.
CTRL-G : ring bell.
CTRL-V : enter a character not available on the regular Apple ][
         keyboard. The character typed after CTRL-V is converted if it
         is one of the three special characters, otherwise CTRL-V is
         ignored. The special characters are:
                 "]" : is converted to : "["
                 "/" : is converted to : "\"
                 "." : is converted to : "_"


Characters handled directly by the Apple keyboard input routine:

ESC    : Abort the command currently executed by the 68000.
CTRL-S : Temporarily suspend output from the 68000.
CTRL-Z : "Emergency exit" out of monitor mode.



2. Monitor mode command summary
-------------------------------


B  : breakpoint submode;
 adr{,cnt}            : set code breakpoint
 M adr{.size},data    : set memory breakpoint
 H adr                : set high address for program execution
 L adr                : set low  address for program execution
 X adr                : delete breakpoint at adr
 K                    : delete ("kill") all breakpoints
 P                    : display (print) all breakpoints
 Q                    : quit breakpoint submode

{adr} G               : execute user program

{adr} GG              : execute user program w/o monitor control

H {cmdletter}         : display help information

{adr1}{.adr2} I blst  : insert data

{adr1}{.adr2} J blst  : fill memory with pattern

{adr1}{.adr2} L /
{adr} L {cnt}         : disassemble instructions

adr1.adr2 M adr3      : move memory

O  : output control submode;
 reglist              : select registers for display
 M adr{.size}         : select memory location for display
 X reglist            : delete registers from display
 X adr                : delete memory location from display
 K                    : delete registers and memory from display
 P                    : display (print) a sample output
 Q                    : quit output control submode
 H {adr}              : display/set highest address for I,J,S commands

P                     : toggle printer on/off

Q                     : quit monitor (back to EXEC mode)

R  : register submode;
 reglist data         : set registers to data
 T|S|X|N|Z|V|C data01 : set/reset flags
 I data07             : set interrupt mask
 K                    : clear all registers
 P                    : display processor registers
 Q                    : quit register submode

{adr1}{.adr2} S blst  : search memory for pattern

{adr1}{.adr2} T /
{adr} T {cnt}         : trace/single-step program

adr1.adr2 V adr3      : compare two memory ranges

{adr1}{.adr2} X /
{adr} X {cnt}         : display (examine) memory

adr1{.adr2}           : display memory


{adr1} : blst         : directly change memory

data =                : convert and display data

{data1} <o> data2     : perform operation <o> and display the result

                         <o>   | Operation performed
                        --------------------------------------------
                          +    | 32-bit addition.
                          -    | 32-bit subtraction.
                          *    | 16-bit by 16-bit multiplication.
                          /    | 32-bit by 16-bit division.
                          <    | shift  data1 left,  data2 times.
                          >    | shift  data1 right, data2 times.
                          (    | rotate data1 left,  data2 times.
                          )    | rotate data1 right, data2 times.
                          &    | AND data1 with data2.
                          !    | OR  data1 with data2.
                          ^    | EOR data1 with data2.


where:

adr     : address
cnt     : count
blst    : byte list; list of byte values
data    : 32-bit data
data01  : 1-bit data (ie. 0 or 1)
data07  : 3-bit data (ie. 0 .. 7)
size    : operand size: B(yte), W(ord), L(ongword)
reglist : register list (eg. D1/D3-D5/A5/A2-A4)

Arguments in curly brackets {..} are optional
SHAR_EOF
if test 5665 -ne "`wc -c < 'mon68.qref'`"
then
	echo shar: "error transmitting 'mon68.qref'" '(should have been 5665 characters)'
fi
fi
exit 0
#	End of shell archive