EVBU - An Open Source 68HC11 Simulator
Andrew Sterian
Padnos College of Engineering & Computing
Grand Valley State University
BUFFALO Emulation
Several aspects of the BUFFALO monitor are emulated by EVBU, while others
are not. Specifically, the following components are emulated:
- The command line interface is emulated, with some differences.
- The two-level interrupt vector table is emulated. Thus, installing
interrupt vectors on EVBU and on a ROM-based BUFFALO system is the
same (i.e., they are installed in RAM beginning at 0x00C4 rather than
at high memory).
- The BUFFALO service routines that do useful things (print
characters, wait for keyboard input, etc.) are emulated, with some
differences.
- The SWI instruction terminates the program and returns
to the command line prompt rather than generating a true interrupt.
The following aspects of BUFFALO are not emulated
by EVBU:
- There is no "ROM" in EVBU so the interrupt vectors
at high memory can be overwritten, unlike a true ROM-based system.
- There is no copy of BUFFALO in memory. All of the service routines
are emulated by Python code.
- The BUFFALO service routines execute in 0 cycles, as they are
only emulated.
The sections below describe the BUFFALO emulation in greater detail.
Service Functions
The following service functions are emulated and behave very closely
to their EVBU counterparts. Don't count on exact behavior, however.
- rprint (0xFF82)
- This function prints a one-line summary of the 68HC11 registers,
just as the BUFFALO RM command does.
- hexbin (0xFF85)
- This function takes the ASCII value in register A and interprets
it as a hexadecimal digit. Then, the 16-bit contents of memory
locations 0x0096:0x0097 (known as SHFTREG) are shifted left by 4 bits and the hexadecimal
digit interpretation of register A is stored in the lowest 4 bits.
- chgbyt (0xFF8E)
- This function stores the contents of memory location 0x0097 (the LSB
of SHFTREG) at the memory location whose address is in the X register.
- upcase (0xFFA0)
- This function converts the ASCII character in register A to uppercase.
- wchek (0xFFA3)
- This function sets the Z flag in the CCR if the ASCII character in
register A is a blank space, comma, or tab character, otherwise the Z
flag is set to 0.
- input (0xFFAC)
- This function sets the A register to the ASCII code of a character typed at the keyboard,
or 0 if no character was pressed. In the simulator, keys typed in at the command
line are passed to this function immediately, without the need to press ENTER
for each line (i.e., as you would expect).
- outlhl (0xFFB2)
- This function prints the upper nibble (i.e., 4 bits) of register A
as a single hexadecimal character.
- outrhl (0xFFB5)
- This function prints the lower nibble (i.e., 4 bits) of register A
as a single hexadecimal character.
- outa (0xFFB8)
- This function prints the character whose ASCII code is in register
A.
- out1by (0xFFBB)
- This function prints the 8-bit value stored at the memory location in
the X register as a two-character hexadecimal number. Then, the X register
is incremented.
- out1bs (0xFFBE)
- This function is the same as out1by (see above). A single
space character is printed in addition (after the number).
- out2bs (0xFFC1)
- This function is equivalent to calling out1by then
out1bs. That is, a 16-bit value is printed followed by a space.
- outcrl (0xFFC4)
- This function effects a carriage return.
- outstr (0xFFC7)
- This function displays a carriage return, then calls outst0 (see
below).
- outst0 (0xFFCA)
- This function displays the ASCII string starting at the memory location
stored in the X register. The string is terminated by the 8-bit value 0x04
(which is not printed). A carriage return is printed following the
string. Note that EVBU limits the length of the string to 300 characters,
assuming that strings this long are probably the result of forgetting
the 0x04 terminating character.
- inchar (0xFFCD)
- This function is like input (see above) except that this
function does not return until a character is typed. Like input,
this character is stored (i.e., its ASCII code) in the A register.
- vecint (0xFFD0)
- This function fills the secondary RAM-based interrupt vector table
(which begins at 0x00C4) with the instruction "JMP >$E371"
except for interrupt vectors that have already been set to point to
a different address. That is, if a JMP instruction is already
found at one of the vector locations, the address is left alone.
BUFFALO Expressions
Unlike BUFFALO, constants may be entered in a variety of bases
using different prefix characters. Type 'help overview' for
a summary. The default number base continues to be hexadecimal. Also,
when a symbol file (i.e., MAP file) is loaded, symbol names may be
substituted for constants.
BUFFALO Commands
It is assumed that you are familiar with the BUFFALO command line. Below,
the differences between BUFFALO commands and EVBU commands are described.
ASM
This command disassembles instructions, but does not assemble them.
BR
This new command can set execution breakpoints. Read the help description
for this command (i.e., help br) for an explanation.
CYC
This new command manages the EVBU cycle counter. The number of cycles
executed is displayed by simply typing cyc by itself. The cycle
count can be reset to 0 by typing cyc reset. Note that the latter
also affects the parallel I/O peripheral by resetting its cycle count to 0.
GO
This command works as expected but also serves to set the parallel I/O
peripheral cycle count to 0. This makes the GO command different
from the other commands that begin execution (like P and STOPWHEN).
L
This new command displays the source code corresponding to the current value
of the program counter, if a symbol file (i.e., MAP file) has been loaded.
LOAD
The LOAD command has a different syntax than BUFFALO. Rather than 'LOAD T',
the syntax is 'LOAD filename.s19' where filename.s19 is
a valid S19 file.
LOADMAP
This new command manually loads a symbol file for the current program. Normally,
a symbol file is sought automatically when the LOAD command is
given.
MM
The MM command works as expected except for the interactive
modification mode. After the current address and value are displayed,
the new value to be written is typed at the input command line and
the ENTER key must be pressed. This is different from the character-at-a-time
mode of BUFFALO. Also, the extra control commands for going to previous
bytes, etc. are not available. The interactive mode is exited by typing
a single dot '.' character.
PRINT
This new command displays the value of an expression. It may be used for number
conversion (for example, 'PRINT %10110011' displays the hexadecimal
and decimal interpretations of the binary number 10110011. This command may
also be used to display the value of a symbol if a symbol file is loaded.
PSHB
This new command pushes a single 8-bit value on the stack. This command
may be useful for calling subroutines that take parameters.
PSHW
This new command pushes a single 16-bit value on the stack.
S
This new command continues program execution in the same way as a P
instruction, but a temporary breakpoint is inserted at the return address.
Thus, this instruction stops when the current subroutine returns (i.e., up
to the next RTS instruction).
STOPAT
This new command continues program execution but a temporary breakpoint
is inserted at the given address.
STOPWHEN
This new command continues program execution but stops execution after
a given number of cycles have been simulated.
TN/TY
These new commands simulate a single instruction, just like T except
that branches can be forced-taken (TY) or forced-not-taken (TN).
That is, if the next instruction to be executed is a branch instruction,
the TN command will prevent the branch from being taken, regardless
of whether the branch would normally be taken. Similarly, the TY
command will cause the branch to be taken, even if normally it would not be.
These commands apply to the normal branch instructions as well as to the
BRSET/BRCLR instructions.
VERF
This new command verifies that the contents of the specified S19 file
match the contents of memory.
Back to the top-level documentation
© 1999-2002, Copyright by Andrew
Sterian; All Rights Reserved. mailto: steriana@claymore.engineer.gvsu.edu