home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Share Gallery 1
/
share_gal_1.zip
/
share_gal_1
/
LA
/
LA026.ZIP
/
UMPS.DOC
< prev
next >
Wrap
Text File
|
1990-10-16
|
94KB
|
2,377 lines
1
1.1 Introduction 1.1 Introduction
Digital circuit hardware designers have come to recognize
the value of the versatile, low cost microprocessor. Along
with an MPU (microprocessor unit), the circuit design of a
microcontroller might typically contain components such as
VLSI, ASIC or TTL chips, memory, LED display, A/D converter
and an I/O port which can be accessed by the MPU. The
inclusion of appropriate microprocessor software is almost
always required to complete the design and make it useful.
To establish a series of instruction codes for a particular
type of MPU from the ground up is tedious and time
consuming. It is almost impossible to conduct this
complicated step without the aid of other software programs.
The most popular and economical software for this job is a
cross assembler which allows you to write the program in the
assembly language of a chosen MPU on a host computer such as
an IBM PC1 (or compatible) and convert it to the machine
code of that particular MPU.
More sophisticated software can even allow you to use a high
level language such as C, Fortran, or Basic, and then
translate it into the machine code of the specified MPU. In
this manner, MPU software design becomes greatly simplified.
Many experienced programmers know that the first finished
set of machine codes rarely works the first time. Each
instruction or subroutine needs to pass a series of tests
before you feel confident enough to utilize it. These
machine codes cannot be tested by a debugging program like
DOS Debug2 or Microsoft's Coview2 on the host computer such
as a PC/AT1 since they are not compatible to the instruction
set of the 8086-based host computer. To test the validity of
the machine codes, several tools such as in-circuit
emulators (ICE), logic analyzers or software simulators are
usually used to debug the machine codes.
Our company has designed a low priced but powerful software
program called the Universal Microprocessor Simulator (UMPS)
for use with any 8086-based PC system. On these PC systems
UMPS can accept your mini assembly program, translate it
into the executable machine instruction codes, execute them
and display the same result as if that particular MPU was
resident in your PC. This package has been designed to be an
easy-to-use tool to aid your software development. Our goal
is to help you write and maintain efficient programs.
1. IBM PC, PC/AT and PC-DOS are trademarks of International
Business Machines Corporation.
2. Debug and Coview are trademarks of Microsoft Corporation.
2
UMPS has been designed to work for as many kinds of
microprocessors as possible. A Rule file for the chosen
microprocessor must be included in the same directory of the
same disk to let UMPS work for the processor you like. Rule
files of Intel's 8085, Motorola's M6800, Zilog's Z80,
Rockwell's 6502 and 65C02 are all included on the
accompanying floppy disk.
Rule files for popular microprocessor like Motorola's
M68HC11, MC6805, MC6801, MC6809, Intel's 8048, 8051, 8096,
Zilog's Z8, TI's 7000 and RCA's 1802 are currently under
development by our company. Write to us if you are
interested in any other 8-bit microprocessor. We will
develop rule files for other microprocessors if there is
sufficient demand. Your suggestions for the implementation
of the program are also welcome.
All of the machine code instruction in this package have
been tested using in-circuit emulators designed by our
company. After thorough, rigorous testing we believe this
package is more accurate than those described in some
microprocessor programming manuals (very few errors were
found when we tested the UMPS package). Reliable as it is,
J&M Software Hardware Design, Inc. does not assume any
liability caused by the application or use of this package.
We welcome your report of any critical bugs which your
programming can not circumvent. An updated version of this
package will be sent to you free of charge if you are the
first person to report such a bug to us.
Be aware that this program enables you to directly access
your PC's I/O ports, and so there exists a real possibility
that your hard disk can be overwritten, making it impossible
to reboot your PC. Refer to section 2.12 for more specific
information. Note: Because the educational version does not
permit I/O port access, you cannot overwrite your disk with
the educational version.
1.2 The Capabilities of the UMPS 1.2 The Capabilities of the UMPS
The UMPS program provides an environment in PC-DOS1 to let
you execute many different types of machine codes such as
6502 (65C02), Z80, 8085 and 6800, without having that MPU
inside the host computer. For example, if you want to write
a mini assembly program or some machine code for a 6502, you
don't need to have an Apple II3 or a Commondore C-64 (or any
other computer system which contains the 6502 MPU) to do the
programming. You also don't need a CP/M system to exercise
Z80 or 8085 machine instructions or mini assembly programs.
3. Apple II is a registered tradmark of Apple Computer, Inc.
3
This program also allows you to switch quickly between
different kinds of microprocessors (by typing "fc < name of
microprocessor >" at any time) without quitting and starting
the program again. The rule file of the microprocessor is
all you need to run the simulator without further
reconfiguration.
The UMPS provides 64K bytes memory for users to modify the
data resident in memory or to start executing an instruction
from any memory address. The data can be input in the form
of binary code, ASCII text, decimal code, or as a mini
assembly instruction through a special command. The contents
of the memory can be displayed either in the form of binary
or ASCII code or the mnemonic syntax obtained from the
disassembler.
The program provides many different ways to observe the
execution of an instrution. You can simply execute the
instruction step by step and observe the changes in the
registers, status flags, the program counter, and the memory
content as the result of the execution. The reset, non-mask
interrupt, interrupt, one step, step without going through
the subroutine, any number of steps, or any number of steps
without going through subroutines, can be executed as you
wish. The status of the MPU's registers or flags can also be
manipulated while you debug your program.
You may also set up several break points to halt the program
at any desired address points so that you can examine the
registers and flags after the execution of a group of
machine codes. Several pseudo-instruction codes such as "CSO
A" (output the contents of the accumulator to the terminal),
"STP" (stop the microprocessor) and "CSI A" (input a byte
from terminal into register A) have been implemented which
may be helpful for the purpose above.
Running another MPU's machine codes on PC-DOS without an
opportunity to connect with outside devices may make your
microcontroller design impractical. To bring it closer to
the real world, UMPS utilizes your PC's I/O ports as the I/O
ports for some types of MPUs like the Z80 and 8085. It also
utilizes your PC's I/O ports as a special memory address for
those MPUs (like the 6502 and 6800) which do not have I/O
port capability. With this advantage you may use any
existing peripheral card such as a printer card, an RS232
card, a data acquisition card, or a design of your own to
test your program with UMPS. Note: For users of the
educational version, the utilization of your PC's I/O ports
is not provided.
In addition, you can introduce a series of data trains as an
outside signal to a particular I/O port or memory address;
then each time the processor accesses that I/O port or
memory address the data can be accessed byte by byte. With
4
this capability it is much easier to debug your program
before your hardware is set up.
This package also allows you to type in a command from your
terminal and immediately observe the result. You can also
submit (by typing "fb batch_name") a batch file to ask the
program to execute it. The batch file is a text file which
is a collection of many commands in the same format as the
command you typed in from the terminal. The batch file is
useful for you to read in data without repeated typing or
having to run the demonstration designed to help beginners.
The codes at any particular section of memory can be saved
in many types of data formats like UMPS's or Mostek's or
Intel's or binary code to your hard or floppy disk. The data
in one of the four formats just mentioned can also be loaded
from the external disk. UMPS will accept most of the data
codes created by the most popular cross assembler programs
and create the data codes for an EPROM programming device.
Hence you may exercise the machine codes resulting from
other commercial products or easily transfer your binary
data codes to the EPROM programming device.
The output display on the screen in response to your
commands can be stored in a text file which you specify by
the "fa" command. Then you can use any editing program to
view the whole text file you have saved. You may also modify
this output text file into a batch file for demonstration
purposes.
2.1 The UMPS Package 2.1 The UMPS Package
The advanced version package of UMPS 1.1 contains the
following files:
UMPS.EXE UMPS.DOC README.DOC
6502.rul 6502.sim * 6502.spc
65C02.rul 65C02.sim * 65C02.spc
6800.rul 6800.sim * 6800.spc
8085.rul 8085.sim * 8085.spc
Z80.rul z80.sim * z80.spc
6502.ump 6502ml.sim 6502bd.sim
6800.ump 6800ml.sim 6800bd.sim
8085.ump 8085ml.sim 8085bd.sim
Z80.ump z80ml.sim z80bd.sim
6502.tab ln1.sim 6502.bin
65C02.tab ln2.sim 6502.int
6800.tab ln3.sim 6502.mos
8085.tab ln4.sim REG.FRM
z80.tab ln5.sim
5
Note: The educational version does not include the files
which are marked with "*".
The UMPS can run on any PC-DOS computer which has at least
256K bytes of RAM. The average speed of the advanced version
on a PC/AT is approximately 500 instructions per second.
With the same type of computer system the educational
version will simulate the instructions ten times slower. You
are encouraged to upgrade to the advanced version by paying
the registration fee (please see the registration form in
file REG.FRM).
2.2 Getting Started 2.2 Getting Started
The UMPS is not copy protected, and there should not be any
problem for you to copy the program and data files to your
hard disk or to another floppy disk. Enter "copy a:*.*
c:dir_name" to copy all the files to your hard disk. Use
"diskcopy a: a:" to back up the floppy disk (diskcopy is one
of the external commands of DOS). Before you try to run the
program, be sure to back up your floppy disk to prevent loss
of the program.
The program can be started either from the floppy disk of A
drive or from the hard disk of C drive as long as the
program and data files have been stored in the same disk and
directory.
To start the program simply type
MPS11 <ret>
In about a minute, the terminal will respond with a
greeting. The first step is to select the desired MPU, since
this package works for five different types of MPU. The
command to load in the MPU file is shown below.
fc 6502 <ret>
Instead of 6502, you may substitute any of the following.
65C02
6800
8085
Z80
The "fc" command will load in the MPU's rule file with the
extension ".rul".
Some of the commands work only after some other special
commands have already been introduced. For example, loading
6
an MPU's rule or speeding file will enable you to use the
commands described in the following paragraphs for
assembler, disassembler, and simulator.
When you start the program, you can also load in any MPU's
batch file with the extension ".sim" by typing "MPS11
batch_file" instead of just "MPS11". Remember that "fc
MPU_file" is always the first line of this batch file
otherwise you may get lines of error message.
2.3 Outline of Commands 2.3 Outline of Commands
Most of the commands start with a letter and may be followed
by a number or another letter or a character string. Most of
the numbers are expressed in hexadecimal format and are used
for words (16 bits) but some of them may be used for bytes
(8 bits). UMPS will not check the validity of these
hexadecimal numbers. Improper entry of a number may result
in an unexpected result. All the commands are case
insensitive. Punch the "Enter" or "Return" key after each
command.
Commands are categorized in one of the following forms.
c : only one letter.
For example 's' is for one step of simulation,
'm' is for displaying 8 bytes of memory.
cN : one letter followed by a hexadecimal number.
For example "s3" is for 3 steps of simulation
(note there is no space between the number and
the letter).
cc : two letters.
For example "pp" will print out all the starting
addresses (SAs) for each mode.
ccN : two letters followed by a hexadecimal number.
For example "pi1000" will set the starting
address to input the data at 1000 (in
hexadecimal).
cc N1..Nn: two letters followed by a series of
either decimal or hexadecimal numbers.
For example "ix 12 34 56 78 90 00" after
"pi1000" will set the contents of 1000 to be
0x12, the contents of 1001 to be 0x34 and so on.
cc text : two letters followed by a text string.
For example "fc 6502" will load in the 6502's
rule file (note there is a space between the
letters and the text).
7
2.4 How to Get Help 2.4 How to Get Help
The "h" command will list a summary of the group commands
and group functions. The response from the "h" command is
shown below.
a? :Assemble syntax starting from aSA
b? :Break utility
f? :File utility
h :List the group commands
hh :List all of the commamds
h? :List the subgroup commands
dN :Disassemble N instructions starting from dSA
mN :Display N bytes of memory starting from mSA
i? :Input data starting from iSA
p? :Set SA commands
q? :Quit command
r? :Set register commands
s? :Step commands starting from sSA
t? :Toggle commands
x? :Set special memory and I/O port commands
Where SA is the starting address
Some of the responses are displayed as a letter followed
with a question mark. These commands represent a group of
commands which all begin with the same letter. To list the
functions of a group of commands simply type 'h' plus the
letter before the "?" mark. For example the "hp" command
will list the functions of all the commmands which begin
with letter 'p'. The response from the "hp" command is shown
below.
paN :Set aSA (starting assemble address) to N
pdN :Set dSA (starting disassemble address) to N
peN :Set all SAs to N
piN :Set iSA (starting input address) to N
pmN :Set mSA (starting memory display address) to N
pp :Print all SA values
psN :Set sSA (starting simulation address) to N
Note: All Ns are hexadecimal numbers
The "hh" commmand will list all of the commands with their
functions available in UMPS. By using the "fa" command (for
details see file utility) you can save the output from the
"hh" command into a file.
2.5 Starting Address (SA) Commands 2.5 Starting Address (SA) Commands
There are situations in which you need to set the Starting
Address (SA) for certain types of operations such as data
input, memory display, mini assembler, disassembler and
8
simulation at specific memory address. For convenience,
there are five types of SA for different operations instead
of just one.
pi3000 --- Set the starting address at 3000 to input the
data, i.e. iSA= 3000.
pm2000 --- Set the starting address at 2000 to display the
data in memory, mSA= 2000.
pd1000 --- Set the starting address at 1000 to disassemble
the machine codes, dSA= 1000.
ps100 --- Set the starting address at 100 for step and go,
sSA=100.
pa300 --- Set the starting address to assemble the mini
assembly syntax, aSA= 300.
pe700 --- Set all SAs to 700.
pp --- Print all of the SA values.
tf --- Toggle fix_SA to determine whether or not to fix
SA's.
When the fix_SA flag is not set, the values of aSA, dSA, iSA
and sSA will be only changed after some related operations,
whereas the value of mSA will always be fixed. For instance,
dSA is the starting address to disassemble the machine
codes. After the operation "d5", not only will five lines of
mini assembly syntax be displayed, but also dSA will be
advanced to the address of the sixth instruction.
However, sometimes you would like to fix dSA. Then you
should type the "tf" command (toggle the value of fix_SA to
1) before the pdN command so that the value of dSA will not
be changed (advanced) after the operation of the
disassembler. This way you can repeatedly display the same
lines of instructions. The "tf" command is a toggle command
that sets the flag to fix SA (fix_SA) to toggle from one to
zero or zero to one.
2.6 Input Commands 2.6 Input Commands
The following commands are used to modify the data inside
the memory. All of the numbers from N1 to Nn occupy only one
byte with the value range from 0 to 255.
ix N1..Nn --- Input as many binary codes as you want
starting from iSA.
9
id N1..Nn --- Input decimal numbers starting at iSA.
is text --- Input ASCII text starting at iSA.
a text --- Assemble one mini assembly instruction
starting from aSA.
ay --- Assemble a series of mini assembly
instructions which follow.
Note: An "END" statement is always necessary
to exit from "ay" and "an" commands.
an --- Same as "ay" but no assembled machine code
will be displayed.
A series of mini assembly syntax can be entered line by line
after the "ay" command is entered. If there is no error in
your instruction, then the machine code created and the
address it was stored into will be shown on the terminal
immediately. The "end" statement is used to quit a series of
assembled code when no more assembly syntax will be entered.
The mnemonic instructions accepted by UMPS may be slightly
different from what you have learned from other computer
systems or manufacturers. Therefore special care is advised.
Files with the extension ".tab" for the 6502, 65C02, 6800,
Z80, and 8085 contain the formats of the syntax instructions
in numerical and alphabetical order. These files serve as a
handy review and reference for you.
2.7 Memory and Register Display Commands 2.7 Memory and Register Display Commands
m -- Display one line of memory starting from mSA.
mN -- Display N/8 lines of memory starting from mSA.
d -- Display one line of disassembled instruction
starting from dSA.
dN -- Display N lines of disassembled instructions
starting from dSA.
rp -- Display all the values of processor's registers
and flags.
rx -- Input and display the contents of the registers
of the microprocessor.
rf -- Input and display the values of the flags of
the condition code register.
rxSS,N -- Set register SS to value N.
10
rfSS,N -- Set flag SS to value N.
The "m" and "d" commands are used to display the data inside
the memory. These displays can be stopped by hitting any key
other than the "q" key which will quit the display.
The "rx" command is used to modify the MPU's registers and
the "rf" command is used to modify the flags of the MPU.
When you use a register modification routine, you can change
the value of the registers one by one with the guidance of
the program. One of the following steps can be used to
respond to a particular register or flag.
a. return key : leave the value unchanged.
b. q key : quit the modification routine.
c. N number : change the value of the register to N.
d. + key : skip over 5 registers (or flags)
without modification.
e. - key : go backward 5 registers (or flags).
The commands "rxSS,N" and "rfSS,N" save you time if you just
want to modify a single register or flag. N is the
hexadecimal value of the register.
2.8 STEP, GO and Break Commands 2.8 STEP, GO and Break Commands
s --- Execute one machine instruction.
sN --- Execute N machine instructions.
sn --- Execute one mini assembly instruction without
going into the subroutine.
snN --- Execute N steps without going into any subroutines.
sg --- Start executing the program from sSA
(Hit "/" key to stop the execution).
bl --- List all the break points.
bc --- Clear all the break points.
beN --- Erase break point N.
bpN --- Set a break point at N.
qq --- Quit and exit from the UMPS11 program.
qp --- Pause (press any key to resume).
11
The step and go commands both start at the memory address of
sSA. The "s" command will only simulate one instruction and
stop at the next Program Counter (PC). Hence the next step
may be the instruction following the previously executed
one, or the beginning address of a subroutine, or any other
address specified by the PC. The "sN" command will simulate
N instructions.
"sn" is a special command similar to the "s" command except
that it treats a subroutine as a single machine instruction.
The "snN" command executes N instructions and treats any
subroutines the same way as the "sn" command does. You can
save time by using the "sn" or "snN" command to skip over
any subroutines which are already known to work properly.
The break commands are adapted to serve for the "sg"
command. You may place break points at every desired address
with the "bpN" command, and erase break points by the "beN"
command. Hitting "sg" will continuously execute the program
without stop until it meets one of the following conditions:
a. when '/' key is hit.
b. implemented software includes the instruction "STP".
c. the break point is reached.
Once the "sg" command is entered the program will stop at
any special CPU instructions such as "HALT" (for the Z80),
or "HLT" (for the 8085), or "WAI" (for the 6800) until the
"/" key is hit for UMPS version 1.1. For the next version
the "Reset" and "Interrupt" will be implemented to exit at
hung-up situations.
When the execution of the machine code stops, the program
will list the current status of flags, registers and PC. You
may resume the simulation simply by entering the "sg"
command again.
2.9 File Input and Output Commands 2.9 File Input and Output Commands
fc MPU_file -- Read in the processor's rule or
speeding file
fw o B_file addr len -- Write the machine code starting at
address addr with a total length of
len to the file named B_file
fr o B_file -- Read the file named B_file into the
default memory address
fr o B_file addr -- Read the file named B_file into the
specified memory address addr
12
fb batch_file -- load the batch file named batch_file
fa -- Toggle to open/close the file
Temp.txt
fa text_file -- Toggle to open/close text_file
fx string -- Enable the use of the commands in
PC-DOS environment
where "o" can be U, B, I, or M. Each of them represents the
data format of UMPS, Binary, Intel or Mostek. You do not
need to add extensions to the file names for B_file,
batch_file and text_file. Special extensions will be added
to these file names automatically.
The "fc" command is utilized to switch between different
types of processors. This command should be executed at the
very beginning to enable the usage of some other commands of
this package.
The "fw" command serves to save the machine codes from a
special memory address to the disk and "fr" is used to read
the data from the external disk. Since there are four types
of data formats, remember that the file you want to read by
"fr o" has to be in the data format specified by "o". This
program allows you to read data files created by other
sources in Binary code, or in Intel's or Mostek's format.
When you read a data file in binary code be sure to specify
the destination address to load the file.
Users of the educational version are allowed to use "fr" and
"fw" for data files not larger than 64 bytes. There is also
a five times limit to using "fr" and "fw" respectively each
time you enter the UMPS's environment.
The batch file command is designed for the user's
convenience. You can use your favorite editing program to
type the batch file, then load it in by the "fb" command. In
addition to this advantage it can be used for a
demonstration to help beginners exercise UMPS or some other
techniques. The batch files are always specified by an
extension ".sim".
The "fa" command is used to toggle the text_file open/close.
The text_file will always have the extension ".txt". The
display on the terminal after the text_file was opened and
before it was closed will be stored in the text_file. You
can investigate all the information in the text_file by
using other editing programs. In this manner, access to more
than one page of results may offer you more efficiency in
debugging.
13
The "fx" command enables you to execute the commmands used
in the PC-DOS environment. For example "fx dir A:" will list
the files in A drive.
2.10 Debugging with Toggle Commands 2.10 Debugging with Toggle Commands
tf --- Toggle the flag to fix SA.
te --- Toggle the flag to echo the command line.
ti --- Set software interrupt.
tm --- Toggle the flag to trace memory reading-writing.
tn --- Set nmi interrupt.
tr --- Reset interrupt.
The "tm" command toggles the flag to trace memory reading
and writing. The print-out of memory read/write status can
save you time and be helpful in your program debugging. For
example there is an assembly syntax "STA $2020,X" of 6502
beginning at $2010. The next three lines are displayed on
the terminal after the command "ps2010" is entered.
2010 : 9D 20 20 STA $2020,X
A=33 X=03 Y=00 SP=0000 ST=30 PC=2010
C=0 Z=0 I=0 D=0 O=0 N=0
RW ADDR=2011 DATA=2020 ***
RB ADDR=2023 DATA=00 ***
WB ADDR=2023 DATA=33 ***
2013 : 00 BRK
A=33 X=03 Y=00 SP=0000 ST=30 PC=2013
C=0 Z=0 I=0 D=0 O=0 N=0
The last six lines above will print out on the screen when
this assembly instruction is executed and the "tm" command
toggles the trace flag to "one" before the execution. If the
trace flag was not toggled to one, those three lines marked
with "***" will not be displayed. The first line shows that
UMPS read a word (RW), 2020, beginning at $2011. The second
line shows that UMPS read a byte (RB), 00, from $2023. The
third lines shows that UMPS wrote a byte (WB), 33 (which is
the contents of A register) to $2023.
2.11 Data Train Input Commands 2.11 Data Train Input Commands
xc --- Close the data train input.
xm addr LNN....LNN --- Set special memory port at addr
14
by data train in the format of a
series of LNN.
xi addr LNN....LNN --- Set a special I/O port at addr
by data train in the format of a
series of LNN.
where L can be any of the letters listed below, and NN is
any number.
R : repeat NN times next NN data.
N : data NN.
L : loop NN times, the loops end with 'ENN'.
E : end the loop.
S : data stays at value NN.
The data train input command allows the user to assign a
certain data input sequence to a particular port of the MPU
in order to debug the code program before the hardware which
contains this MPU is assembled. In other words, instead of
setting up the hardware device to test your routine's
validity, your software is tested by certain types of data
patterns with which you may predict all the possible
configurations in your hardware circuit design.
The data train for a particular port acts as a first-in
first-out (FIFO) buffer. The "xm" and "xi" commands let you
stack the data one by one into the special memory port or
input port according to the rules listed above. The first
data stacked into the buffer will be first accessed by
either the CPU's instruction related to port access or
UMPS's command, like "m" (memory display) or "d"
(disassemble).
There is always an "NN2" string after the "RN1" string. The
combination of these two strings will stack data "N2" for N1
times into the buffer. The "SN" string lets the data
directed to the port stay at the value N after the output of
all the data. For example, the command "xm C000 R05 N31 S32"
will stack the data "31" five times into the buffer and
after that all the data stays at the value "32". More
examples are list below for the data train input to a
specific port.
partial commands the data stacked in order into buffer
--------------------- --------------------------------
r04 n31 s32 31 31 31 31 32 32 32 32 .....
r05 n32 s35 32 32 32 32 32 35 35 35 .....
r03 n32 r03 n34 s33 32 32 32 34 34 34 33 33 .....
The "LN" string is always coupled with a "EN" string later
on. All the actions of the strings after "LN" and before
"EN" will loop N times. The sequence inside the loop can be
15
any repeated step or another loop sequence. For example
"L04 N31 N32 E00 S33" will produce the data sequence "31 32
31 32 31 32 31 32 33 33.....". More examples are shown
below.
L03 N35 N33 N35 E00 S32
will give "35 33 35 35 33 35 35 33 35 32 32 ...."
L02 R03 N31 R02 N32 E00 S39
will give "31 31 31 32 32 31 31 31 32 32 39 39 ...."
L02 N33 L03 N31 N32 E00 E00 S39
will give "33 31 32 31 32 31 32 33 31 32 31 32 31 32 39
39....."
The following batch file clearly demonstrates how the data
train cooperates with the code program. If you submit this
batch file, the program will print out the characters as the
next line until you hit the '/' key.
11111222222222222222.........
fc 6502
xm C000 R06 N31 S32
pe1000
ay
LDA $C000
CSO A
JMP $1000
end
sg
The command in the first line of the batch file selects the
6502 CPU. The command in the second line assigns the data
buffer sequence " 31 31 31 31 31 32 32 ...." to the memory
address $C000. The command in the third line sets all the
starting addresses at 0x1000, and in the fourth line the
"ay" command let UMPS start to input the assembly code until
the "end" statement. The "sg" command in the final line lets
UMPS execute the code program starting at 0x1000.
As the code program starts execution, the command "LDA
$C000" will try to load the A register with the content of
the memory address C000, "31" (After this "31" was accessed
the next "31" will pop up for the next action). The next
instruction "CSO A" will print out the contents of the A
register in the format of ASCII code which is "1". The last
instruction causes a jump to the first instruction at $1000.
Since the code program is a loop to continuously load
$C000's contents into this A register and display it on the
terminal, the display is six repetitions of "1" followed by
"2".
16
If you change the second line of this mini batch file to a
different data train "xm C000 R10 N31 R10 N32 S35", then the
result appearing on the screen will look like the next line:
111111111122222222225555..................
2.12 How to Utilize Your PC's I/O Ports 2.12 How to Utilize Your PC's I/O Ports
One of the most valuable features of the UMPS program is
that it provides a connection between the user's program and
the outside world by using the PC's I/O ports. Some of the
user's controller circuitry, such as a temperature
controller with D/A converter, data acquisition with an A/D
converter, or a stepping motor's driving circuitry may be
tested by mapping the I/O addresses of the MPU (8085 or Z80)
or the memory addresses of the MPU (6502, 6800, 8085 or Z80)
to the PC's I/O ports before the target system of the
microcomputer is finished.
Not all of the PC's I/O addresses are available for use, as
some of them may already be used as a control for the hard
disk or as a timer. The use of some address may change the
configuration of the PC's system and hinder the capability
to boot the computer system or cause the computer to hang up
until reboot. Be very careful when you try to read/write
from the PC's I/O ports already adopted for special
purposes. Check the detailed port assignments and their
meanings in your PC's technical manual before you try to run
your program.
If you want to alter the contents of some memory addresses
which have been mapped to the PC's I/O ports be aware that
many instructions will cause the transfer of data between
the memory and the I/O ports. You should also avoid some
instructions which are used to send or receive data through
the PC's I/O port if the number of pulses each of these
instruction executes is of importance in your circuit design
(like timers or counters). You may want to check with the
"tm" command to see how the UMPS handles the memory's R/W
process.
Before your program can send/receive data to/from the PC's
I/O ports, these I/O ports have to be be initialized by
using the proper command listed below. Otherwise the program
would treat the MPU's I/O port address simply as a memory
address.
poN :Map the CPU's I/O port addresses with the PC's
I/O port addresses beginning at N.
poN1,N2 :Map the CPU's memory beginning at N2 (256 bytes)
with the PC's I/O port beginning at N1.
17
po :Turn off the PC's I/O ports.
Only 256 bytes of the PC's I/O port addresses will be
assigned each time the "poN" or "poN1,N2" command is used.
The "poN" command is used to map the PC's I/O port addresses
beginning at N with the CPU's (Z80 or 8085) I/O ports. For
example "po280" will assign the PC's I/O port address to the
CPU's I/O ports as listed below:
CPU's I/O address PC's I/O address
0 280
1 281
.. ...
0xFF 37F
The "poN1,N2" command is used to map the CPU's (6502, 6800,
8085 or Z80) page address starting at N2 (used only for one
byte) to the PC's port address starting at N1. For example,
the command "po280,C0" will assign the PC's I/O port address
to the CPU's memory address as shown below:
CPU's memory address PC's I/O address
C000 280
C001 281
.... ...
C0FF 37F
Once the PC's I/O port addresses have been assigned to the
special memory addresses (or MPU's I/O ports) they will be
affected by any command or instruction which involves their
corresponding special memory addresses. For instance, the
command to display the contents of the special memory
addresses will read the data from the corresponding input
ports, whereas the command to input the data to the special
memory addresses will send the data to the corresponding
output ports. All of the CPU's instructions which load or
store the data into the special memory addresses affect the
PC's I/O ports in the same way. Mapping between the P/C's
I/O ports to the CPU's I/O ports or special memory addresses
can be turned off by the "po" command.
In addition to enabling the user's program to send or
receive the data through the PC's I/O, UMPS also provides
access to PC's I/O test routine to help the user to trace
any problems in his circuit design with the use of some
tools like an ocilloscope, logic probe, or digital volt
meter. The following commands serve the purpose just
mentioned:
prN : Display the contents of the PC's I/O port N
on the terminal.
puN : Continuously display the contents of the
18
PC's I/O port N.
pwN1,N2 : Write data N2 into the PC's I/O port N1.
pyN : Continuously write data 0 to 0xFF
into the PC's I/O port N.
pzN : Sequentially write the data into the PC's
I/O ports N to N+1F.
The "pr" or "pw" is single step read or write command which
reads the data from the PC's I/O port or writes the data to
the PC's I/O port. The "pu", "py", and "pz" commands
continuously read or write negative pulses through the
specified port addresses. With the help of an ocilloscope or
logic probe the user can quickly locate any faulty circuitry
owing to the address decoding. The users of the educational
version will not be able to utilize the PC's I/O port
through UMPS.
3.1 Differences between UMPS and CPU 3.1 Differences between UMPS and CPU
Although UMPS simulates most of the instructions for certain
kinds of CPU (Central Processor Unit) UMPS will not match
every CPU action. These no-match conditions include non-
existing codes, decimal adjust accumulator (DAA), undefined
flags, special operations and memory read/ write operations.
The following outlines how UMPS treats all these conditions.
Non-existing codes
Different types of CPUs treat non-existing codes
differently. One may hang up on the process, one may perform
an unexpected operation (like the 6502), one may advance PC
by 2 (like the 65C02) and one may do some other operation.
Three of the non-existing codes of each CPU are adopted by
UMPS for the implemented assembly syntax CSO, CSI and STP CSO, CSI STP
(for details see "The capabilities of the UMPS"). Besides
these special purpose codes, the UMPS treats all other non-
existing codes as no operation (NOP). All the registers and
flags are left intact. However the program counter will
advance by some number (from 1 to 4 depending on the type of
CPU). For the 6502, 65C02, 8085 and 6800, this number would
be 1. For the Z80 it will be 1 to 4 depending on how many
fetch codes are needed for one instruction. You are strongly
advised not to include non-existing codes unless you are
well versed in their use.
Decimal Adjust Accumulator
DAA will work properly only under certain conditions. The
primary condition is that the number for arithmetic
19
operations must be in binary code decimal (BCD) format.
Otherwise the result from the simulator will not be the same
as that from the CPU. Besides this restriction, certain
different conditions are required for different CPUs as
described as follows.
For the 6502 and 65C02, there is no DAA instruction. Once
the D flag is set there will be a decimal adjustment for
each arithmetic operation. When the D flag is set,
executions involving all the addressing modes for Add with
Carry (ADC) and Subtract with Carry (SBC) will undergo
decimal adjustment.
For the 6800 and 8085, the DAA instructions will work only
immediately after those instructions related to addition
such as Add Immediate (ADI), ADC, and ADD. Note that DAA
will not work for subtraction.
For the Z80, the DAA will work if it immediately follows an
instruction for addition or subtraction. The addition
instruction can be ADD, ADC, or INC. The subtraction
instructions are SUB, SBC, DEC or NEG. For details please
see a Z80 programming manual.
Undefined flags
In many manufaturer's MPU data books some types of flags are
left undefined after the execution of certain types of
intruction. We have traced out some rules for some undefined
flags using real CPUs coupled with in-circuit emulators
designed by our company. These results have been integrated
into the UMPS. Even so, it is strongly recommended that you
use them only as reference aids and your final program
design should not utilize these undefined flags. Some of
these cases are listed below.
1. The S and P/V flags of Z80's instructions "BIT b,r",
"BIT b,(HL)", "BIT b,(IX+d)" and "BIT b,(IY+d) are
undefined.
2. Except for the Z flag, all the other flags of Z80's INI,
IND, INIR, INDR, OUTI, OUTD, OUIR and OUDR instructions
are undefined.
3. The V flag of 6800's DAA instruction is undefined.
Special Instructions
UMPS treats the special instructions of these MPUs in
somewhat different ways. For example, special instructions
like "HALT" in the Z80 and 8085 and "WAI" in the 6800
generally either hold the CPU until the next interrupt comes
along or make it wait for an input signal from the outside.
Apparently UMPS can not treat situations like these exactly
20
the same as the CPUs would. Specifications for these
situations are described as follows:
1. The "HALT" (used in Z80), "HLT" (used in 8085) and "WAI"
(used in 6800) will not advance the program counter (PC)
in UMPS. The program will hang up until you enter the
UMPS command "tr" (reset) or "ti" (software interrupt).
2. The "IM1", "IM2", "LD A,R", and "LD R,A" assembly syntax
of the Z80 will not work in UMPS.
3. The "SIM" and "RIM" assembly syntax of the 8085 also will
not work in UMPS.
Memory read/write operations
The toggle command "tm" of UMPS is used to toggle the flag
to print the trace of memory reading and writing. The print-
out of memory read/write is very helpful for you to
understand how each instruction works. Though the program is
designed in such a way that the trace of reading and writing
memory in UMPS is similar to that of the real CPU you should
not expect that these two systems will operate through
exactly the same route for every instruction.
3.2 CPU compatibility 3.2 CPU compatibility
Some of the simpler MPUs have much of the same capability as
similar, higher level units. The execution of the compatible
machine codes by these MPUs will give the same results for
the registers and memory. For example Zilog's Z80 can
execute almost 85% of Intel 8085's machine codes. The
65C02's MPU was developed from the 6502, but with more
instructions implemented. Keep in mind that some of the
instruction codes designed for lower level CPUs like the
6502 or the 8085 may not work on higher level CPUs such as
the 65C02 or the Z80.
21
4.1 Examples 4.1 Examples
Example 1.
Enter a mini assembly program which will print from 1 to 9
on the terminal (for the 6502 microprocessor).
Note: "!" represents the beginning of a comment line
"^" begins a line which is the response from the
program. All numbers are in hexadecimal format.
! The first command activates the 6502 simulator.
>fc 6502 <ret>
^ Rule file 6502.rul is O.K.
! The next command sets the input address of
! the mini assembly syntax to start at 1000.
>pa1000 <ret>
^ aSA= 1000
>ay <ret>
^ End with "end" statement for asm.
! Now enter the mini assembly instructions line by line.
! The machine codes of assembly syntax which follow will
! be stored into the memory starting at aSA=0x1000.
LDX #$31 <ret>
^ 1000 : A2 31 LDX #$31
! Only hexadecimal values (#$) can be accepted by
! this version. Any decimal values (#) entered will
! cause errors.
TXA <ret>
^ 1002 : 8A TXA
INX <ret>
^ 1003 : E8 INX
CSO A <ret>
^ 1004 : 02 CSO A
! "CSO A" is a non-6502 assembly instruction, which was
! built in for your convenience to display the contents of
! the accumulator on your terminal.
CPX #$3A <ret>
22
^ 1005 : E0 3A CPX #$3A
! If "CPX #3A" was entered instead of "CPX #$3A"
! Then ^ There is no match for * CPX #3A * ^
! and ^ 1005 : 00 BRK ^ will appear on the screen;
! this should remind you to enter the correct instruction.
BNE $1002 <ret>
^ 1007 : D0 F9 BNE $1002
STP <ret>
^ 1009: 0B STP
END <ret>
! "STP" is another non-6502 assembly instruction
! which was built in for your convenience.
! The next command saves 30 bytes of the memory contents
! starting from address 1000 into a file
! named 6502.UMP in the format of UMPS.
>fw u 6502 1000 30 <ret>
^ File name= 6502.UMP
^ Starting address= 1000
^ Length= 0x30(48)
! You can also save them in b(inary), i(ntel), or m(ostek)
! instead of u(mps).
! The next command sets sSA to start at $1000.
>ps1000 <ret>
^ 1000 : A2 31 LDX #$31
^ A=00 X=00 Y=00 SP=0100 ST=30 PC=1000
^ C=0 Z=0 I=0 D=0 V=0 N=0
! The next command executes the first instruction step.
>s <ret>
^ 1002:8A TXA
^ A=00 X=31 Y=00 SP=0100 ST=30 PC=1002
^ C=0 Z=0 I=0 D=0 V=0 N=0
! The first line shows the next instruction and its
! machine code after the execution of one step.
! The second and the third lines show the contents of
! all the registers and all the flags of the
! processor's status register.
23
! You can execute as many instructions as you like.
! "s5" will execute five steps in sequence.
! All the results for each five steps will be printed out.
! This "sN" command is a very useful tool in debugging.
! The next command will execute the rest of the program.
>sg <ret>
^ 123456789
^ 100A:00 BRK
^ A=39 X=3A Y=00 SP=0100 ST=33 PC=100A
^ C=1 Z=1 I=0 D=0 V=0 N=0
! If you want to print out 5 to 8 instead of 1 to 9,
! the contents of location $1001 and $1006 need
! to be $35 and $39, respectively.
! The following commands will make the changes.
! Enter hexadecimal number 35 for location 0x1001.
>pi1001 <ret>
^ iSA= 1001
>ix 35 <ret>
! Next we move to new address 0x1006
! and enter the decimal number 57 for location 0x1006.
>pi1006 <ret>
^ iSA= 1006
>id 57 <ret> (0x39=57)
! To see the whole program after this modification,
! assign dSA at 0x1000 to start the disassembler
! and display 0x7 instrucion codes.
>pd1000 <ret>
^ dSA= 1000
>d7 <ret>
^ 1000 A2 35 LDX #$35
^ 1002 8A TXA
^ 1003 E8 INX
^ 1004 02 CSO A
^ 1005 E0 39 CPX #$39
^ 1007 D0 F9 BNE $1002
^ 1009 0B STP
^ 100A 00 BRK
>pp <ret>
^ mSA=0000 iSA=1007 dSA=100B sSA=100B aSA=100B
24
! You are advised to use "pp" command whenever
! you feel that the program is not responding properly.
! This "pp" command displays the current status of
! mSA, iSA, dSA, sSA, and aSA.
! Make sure that all these data are correct.
! To execute the newly altered program
! the sSA needs to be changed from 100A to 1000.
>ps1000 <ret>
^ 1000 : A2 31 LDX #$31
^ A=39 X=3A Y=00 SP=0100 ST=33 PC=1000
^ C=1 Z=1 I=0 D=0 V=0 N=0
>sg <ret>
^ 5678
^ 100A : 00 BRK
^ A=38 X=39 Y=0 SP=0100 ST=33 PC=100A
^ C=1 Z=1 I=0 D=0 O=0 N=0
>fr u 6502 <ret>
^ File name = 6502.UMP
^ Starting address = 1000
^ Length = 0x30(48)
! Remember that the old program had been written into the
! file "6502.UMP". The "fr u 6502" command reads this file
! back into the default address $1000.
! Do you want to view the changes?
! What commands do you need?
! There are files 6800.UMP, 8085.UMP and z80.UMP for users
! of MPU other than the 6502 to practice with UMPS.
! The files with extension ".UMP" provide the same function
! as the 6502.UMP file.
! Files 6502.BIN, 6502.INT and 6502.MOS are included for
! your reference. These files and 6502.UMP all have the same
! original data but are stored in different data formats.
! When you use the "fr" command to read a ".BIN" file
! you always need to specify the destination.
25
Example 2.
Enter a batch file which is a multiplying subroutine called
6800ml.sim (for the 6800 microprocessor). Store your
multiplier into $150,$151. Load your multiplicand into
$154,$155. The result of the multiplication will be stored
into $152,$153,$154 and $155.
>fb 6800ml.sim <ret>
^ Rule file 6800.rul is O.K.
^aSA= 0100
^ 0100 : C6 10 LDAB #$10
^ 0102 : 7F 01 52 CLR $152
^ 0105 : 7F 01 53 CLR $153
^ 0108 : 76 01 54 ROR $154
^ 010B : 76 01 55 ROR $155
^ 010E : 24 12 BCC $122
^ 0110 : B6 01 53 LDAA $153
^ 0113 : BB 01 51 ADDA $151
^ 0116 : B7 01 53 STAA $153
^ 0119 : B6 01 52 LDAA $152
^ 011C : B9 01 50 ADCA $150
^ 011F : B7 01 52 STAA $152
^ 0122 : 76 01 52 ROR $152
^ 0125 : 76 01 53 ROR $153
^ 0128 : 76 01 54 ROR $154
^ 012B : 76 01 55 ROR $155
^ 012E : 5A DECB
^ 012F : 26 DD BNE $10E
^ 0131 : 3D STP
! This multiplication program is now introduced into
! memory from $100 to $131.
>pi150 <ret>
^ iSA= 0150
>ix 10 10 00 00 00 33 <ret>
>pm150 <ret>
^ mSA= 0150
>m7 <ret>
^ 0150 : 10 10 00 00 00 33 00 00 .....3..
! The multiplier 0x1010 is stored into $150,$151
! while the multiplicand 0x33 is stored into $154,$155.
>ps100 <ret>
^ C6 10 LDAB #$10
^ A=00 B=00 X=0000 SP=0000 ST=C0 PC=0100
^ C=0 V=0 Z=0 N=0 I=0 H=0
>sg <ret>
26
^ 0132 : 00 ???
^ A=19 B=00 X=0000 SP=0000 ST=C4 PC=0132
^ C=0 V=0 Z=1 N=0 I=0 H=0
>m7 <ret>
^ 0150 : 10 10 00 03 33 30 00 00 ....30..
! The result of the multiplication, 0x00033330, is stored
! at locations $152, $153, $154 and $155.
! The files 6502ml.sim, 8085ml.sim and z80ml.sim contain
! subroutines which work the same way as 6800ml.sim.
Example 3.
Use the batch file 8085bd.sim to practice the break function
of the UMPS package. The file 8085bd.sim contains a
subroutine which will change your binary data starting from
0700H into binary coded decimal (BCD) data starting from
0708H.
>fb 8085bd.sim <ret>
^ Rule file 8085.rul is O.K.
^aSA= 1000
^ 1000 : AF XRA A
^ 1001 : 43 MOV B,E
^ 1002 : 21 08 07 LXI H,0708H
^ 1005 : 77 MOV M,A
^ 1006 : 23 INX H
^ 1007 : 05 DCR B
^ 1008 : C2 05 10 JNZ 1005H
^ 100B : 7A MOV A,D
^ 100C : 87 ADD A
^ 100D : 87 ADD A
^ 100E : 87 ADD A
^ 100F : 4F MOV C,A
^ 1010 : 2E 00 MVI L,00H
^ 1012 : 42 MOV B,D
^ 1013 : 7E MOV A,M
^ 1014 : 17 RAL
^ 1015 : 77 MOV M,A
^ 1016 : 23 INX H
^ 1017 : 05 DCR B
^ 1018 : C2 13 10 JNZ 1013H
^ 101B : 2E 08 MVI L,08H
^ 101D : 43 MOV B,E
^ 101E : 7E MOV A,M
^ 101F : 8F ADC A
^ 1020 : 27 DAA
^ 1021 : 77 MOV M,A
^ 1022 : 23 INX H
^ 1023 : 05 DCR B
27
^ 1024 : C2 1E 10 JNZ 101EH
^ 1027 : 0D DCR C
^ 1028 : C2 10 10 JNZ 1010H
^ 102B : 18 STP
! The 8085bd.sim file is stored into locations
! 1000H to 102BH.
! At the beginning of the program, the number of bytes for
! both binary data and BCD data needs to be loaded into
! D and E registers respectively.
! Set D=2, E=3.
>rxd,2 <ret>
>rxe,3 <ret>
>rp <ret>
^ A=00 B=00 C=00 D=02 E=03 H=00 L=00 SP=0000 PSW=22
^ PC=0000
^ CY=0 P=0 AC=0 Z=0 S=0
! Store the binary data 1100 1101 (CD) into 0700H.
>pi0700 <ret>
^ iSA= 0700
>ix cd <ret>
>pm0700
^ mSA= 0700
>m8 <ret>
^ 0700 : CD 00 00 00 00 00 00 00 M.......
^ 0708 : 00 00 00 00 00 00 00 00 ........
! There is a loop beginning at 1010H.
! If C register (detected at 1028H) is not set to zero
! there will be a jump to 1010H.
! Let's set a break point at 1028.
>bp1028 <ret>
>bl <ret>
^ Break point : 1028
! Let's execute the first loop and look at the result.
>ps1000 <ret>
^ 1000 : AF XRA A
^ A=00 B=00 C=00 D=02 E=03 H=00 L=00 SP=0000 PSW=22
^ PC=1000
^ CY=0 P=0 AC=0 Z=0 S=0
>sg <ret>
28
^ 1010 : 2E 00 MVI L,00H
^ A=00 B=00 C=0F D=02 E=03 H=07 L=0B SP=0000 PSW=26
^ PC=1010
^ CY=0 P=1 AC=0 Z=0 S=0
>m8 <ret>
^ 0700 : 9A 01 00 00 00 00 00 00 ........
^ 0708 : 00 00 00 00 00 00 00 00 ........
! After the first loop C=0F.
! At 0700H, "CD" (1100 1101) rotated left through carry
! and became "9A" (1001 1010).
! At 0701H, "00" rotated left through carry and became "01".
>sg <ret>
^ 1010 : 2E 00 MVI L,00H
^ A=00 B=00 C=0E D=02 E=03 H=07 L=0B SP=0000 PSW=32
^ PC=1010
^ CY=0 P=0 AC=1 Z=0 S=0
>m8 <ret>
^ 0700 : 34 03 00 00 00 00 00 00 4.......
^ 0708 : 00 00 00 00 00 00 00 00 ........
! After the second loop C=0E.
! At 0700H, "9A" rotated left through carry and became "34".
! At 0701H, "01" rotated left through carry and became "03".
! You already have seen what each loop does.
! To see the result from the rest of the loops,
! just remove the break point at 1028H.
>be1028 <ret>
>bl <ret>
^ Break point : None
>sg <ret>
^ 102C : 00 NOP
^ A=00 B=00 C=00 D=02 E=03 H=07 L=0B SP=0000 PSW=76
^ PC=102C
^ CY=0 P=1 AC=1 Z=1 S=0
>m8 <ret>
^ 0700 : 00 00 00 00 00 00 00 00 ........
^ 0708 : 05 02 00 00 00 00 00 00 ........
! The binary data "CD" stored at 0700H has been changed
29
! to BCD "0205" and stored into 0709H and 0708H.
! To see what the BCD value is for the biggest
! four bytes of binary data "FF FF FF FF",
! enter the following:
>rxd,4 <ret>
>rxe,5 <ret>
>rp <ret>
^ A=00 B=00 C=00 D=04 E=05 H=07 L=0B SP=0000 PSW=76
^ PC=102C
^ CY=0 P=1 AC=1 Z=1 S=0
>pi0700 <ret>
^ iSA= 0700
>ix FF FF FF FF <ret>
>m8 <ret>
^ 0700 : FF FF FF FF 00 00 00 00 ....
^ 0708 : 05 02 00 00 00 00 00 00 ........
>ps1000 <ret>
^ 1000 : AF XRA A
^ A=00 B=00 C=00 D=04 E=05 H=07 L=0B SP=0000 PSW=76
^ PC=1000
^ CY=0 P=1 AC=1 Z=1 S=0
>sg <ret>
^ 102C : 00 NOP
^ A=42 B=00 C=00 D=04 E=05 H=07 L=0D SP=0000 PSW=76
^ PC=102C
^ CY=0 P=1 AC=1 Z=1 S=0
>m8 <ret>
^ 0700 : 00 00 00 00 00 00 00 00 ........
^ 0708 : 95 72 96 94 42 00 00 00 .r..B...
! The binary data "FF FF FF FF" in locations
! 0703H to 0700H has been converted into BCD data
! "4,294,967,295" at locations 070CH to 0708H.
! The subroutines in files 6502bd.sim, 6800bd.sim and
! z80bd.sim all have the same function as the subroutine
! in 8085bd.sim.
! Initially, the number of bytes for the binary data and BCD
! data needs to be loaded into the D and E registers for the
! Z80 whereas for the 6502 and 6800 this information must be
! stored into locations $0710 and $0711.
30
Example 4.
Use the z80 instruction "INDR" to write a series of data
trains from the selected port 08H into the memory location
starting from 1050H, 104FH.......
>fc z80 <ret>
^ Rule file z80.rul is O.K.
! First let's take a look at memory locations 1020H to
! 1058H.
>pm1020 <ret>
^ mSA= 1020
>m32 <ret>
^ 1020 : 00 00 00 00 00 00 00 00 ........
^ 1028 : 00 00 00 00 00 00 00 00 ........
^ 1030 : 00 00 00 00 00 00 00 00 ........
^ 1038 : 00 00 00 00 00 00 00 00 ........
^ 1040 : 00 00 00 00 00 00 00 00 ........
^ 1048 : 00 00 00 00 00 00 00 00 ........
^ 1050 : 00 00 00 00 00 00 00 00 ........
! Input the instruction "INDR", beginning at 1000H.
>pa1000 <ret>
^ aSA= 1000
>a INDR <ret>
^ 1000 : ED BA INDR
>a STP <ret>
^ 1002 : DD 01 STP
! The selected I/O port address 08H will be stored in C
! register while the starting destination address 1050H
! will be stored in register pair HL. A counter 28H for
! B register will be decremented for each step. The
! instruction will be terminated when the value of B
! register reaches zero.
>rx <ret>
^ A=00 <ret>
^ B=00 28 <ret>
^ C=00 08 <ret>
^ D=00 <ret>
^ E=00 <ret>
^ H=00 10 <ret>
^ L=00 50 <ret>
^ IX=0000 q <ret>
31
! The second number will become the new value for each
! register. The command "rxB,28" can also change B register
! to the same value.
>xm 08 L06 N11 N22 N33 N44 E00 N55 N66 N77 N88 S99 <ret>
! The data train input command "xm" will introduce a series
! of data into the I/O port 08H byte by byte. This series of
! data will begin with 11H, followed by 22H, 33H, and 44H.
! This first set of numbers "11H, 22H, 33H, 44H" will be
! repeated five more times. After that, numbers 55H, 66H,
! 77H and 88H will appear. The last data "s99" makes the
! last value stay at 99H.
>ps1000 <ret>
^ 1000 : ED BA INDR
^ A=00 B=28 C=08 D=00 E=00 H=10 L=50 IX=0000 IY=0000
^ I=00 SP=0000 PSW=28 PC=1000
^ C=0 N=0 PV=0 H=0 Z=0 S=0
>s <ret>
^ 1000 : ED BA INDR
^ A=00 B=27 C=08 D=00 E=00 H=10 L=4F IX=0000 IY=0000
^ I=00 SP=0000 PSW=EE PC=1000
^ C=0 N=1 PV=1 H=0 Z=1 S=1
>m32 <ret>
^ 1020 : 00 00 00 00 00 00 00 00 ........
^ 1028 : 00 00 00 00 00 00 00 00 ........
^ 1030 : 00 00 00 00 00 00 00 00 ........
^ 1038 : 00 00 00 00 00 00 00 00 ........
^ 1040 : 00 00 00 00 00 00 00 00 ........
^ 1048 : 00 00 00 00 00 00 00 00 ........
^ 1050 : 11 00 00 00 00 00 00 00 ........
! After executing one step, B changed to 27 and HL changed
! to 104F. The first number in the data train, 11H, was
! stored in 1050H.
>s <ret>
^ 1000 : ED BA INDR
^ A=00 B=26 C=08 D=00 E=00 H=10 L=4E IX=0000 IY=0000
^ I=00 SP=0000 PSW=EE PC=1000
^ C=0 N=1 PV=1 H=0 Z=1 S=1
>m32 <ret>
^ 1020 : 00 00 00 00 00 00 00 00 ........
^ 1028 : 00 00 00 00 00 00 00 00 ........
32
^ 1030 : 00 00 00 00 00 00 00 00 ........
^ 1038 : 00 00 00 00 00 00 00 00 ........
^ 1040 : 00 00 00 00 00 00 00 00 ........
^ 1048 : 00 00 00 00 00 00 00 22 ......."
^ 1050 : 11 00 00 00 00 00 00 00 ........
! The next step of execution decremented B and HL again, and
! stored the second value in the data train, 22H, into
! location 104FH.
>s <ret>
^ 1000 : ED BA INDR
^ A=00 B=25 C=08 D=00 E=00 H=10 L=4D IX=0000 IY=0000
^ I=00 SP=0000 PSW=EE PC=1000
^ C=0 N=1 PV=1 H=0 Z=1 S=1
>m32 <ret>
^ 1020 : 00 00 00 00 00 00 00 00 ........
^ 1028 : 00 00 00 00 00 00 00 00 ........
^ 1030 : 00 00 00 00 00 00 00 00 ........
^ 1038 : 00 00 00 00 00 00 00 00 ........
^ 1040 : 00 00 00 00 00 00 00 00 ........
^ 1048 : 00 00 00 00 00 00 33 22 ......3"
^ 1050 : 11 00 00 00 00 00 00 00 ........
>sg <ret>
^ 1004 : 00 NOP
^ A=00 B=00 C=08 D=00 E=00 H=10 L=28 IX=0000 IY=0000
^ I=00 SP=0000 PSW=EA PC=1004
^ C=0 N=1 PV=0 H=0 Z=1 S=1
>m32 <ret>
^ 1020 : 00 00 00 00 00 00 00 00 ........
^ 1028 : 00 99 99 99 99 99 99 99 ........
^ 1030 : 99 99 99 99 99 88 77 66 ......wf
^ 1038 : 55 44 33 22 11 44 33 22 UD3".D3"
^ 1040 : 11 44 33 22 11 44 33 22 .D3".D3"
^ 1048 : 11 44 33 22 11 44 33 22 .D3".D3"
^ 1050 : 11 00 00 00 00 00 00 00 ........
! The display above shows how the instruction "INDR" stored
! the sequence of data available at the I/O port 08H into
! memory locations 1029H to 1050H. You can also see that
! when the value of B becomes 0, HL becomes 1028H.
33
5.1 Summary of commands for UMPS 1.1 5.1 Summary of commands for UMPS 1.1
a text -- Assemble one mini assembly
instruction starting from aSA.
ay -- Assemble a series of mini assembly
instructions which follow
(An "END" statement is always needed
to exit from the "ay" and "an"
commands).
an -- Same as "ay", but no assembled
machine code will be displayed.
bc -- Clear all the break points.
beN -- Erase break point N.
bl -- List all the break points.
bpN -- Set a break point at N.
d -- Display one line of disassembled
instruction, starting from dSA.
dN -- Display N lines of disassembled
instruction, starting from dSA.
fa -- Toggle to open/close file Temp.text.
fa text_file -- Toggle to open/close text_file.
fb batch_file -- load the batch file batch_file.
fc MPU_file -- Read in the processor's rule or
speeding file.
fr o B_file -- Read the file named B_file into the
default memory address.
fr o B_file addr -- Read the file named B_file into the
specified memory address addr.
fw o B_file addr len -- Write the machine codes starting at
address addr with a total length of
len to the file named B_file.
fx string -- Enable the use of the commands in
PC-DOS environment.
id N1..Nn -- Input decimal numbers starting at
iSA.
34
is text -- Input ASCII text starting at iSA.
ix N1..Nn -- Input as many binary codes as
desired, starting from iSA.
m -- Display one line of memory,
starting from mSA.
mN -- Display N/8 lines of memory,
starting from mSA.
paN -- Set starting address to assemble the
mini assembly syntax, aSA=N.
pdN -- Set starting address at 1 (dSA=N)
to disassemble the machine codes.
piN -- Set starting address at N1 to input
data, iSA=N.
pmN -- Set starting address at N to
display the data in memory, mSA=N.
poN -- Map the CPU's I/O port addresses
with the PC's I/O port addresses,
beginning at N.
poN1,N2 -- Map the CPU's memory beginning at N2
(256 bytes) with the PC's I/O ports,
beginning at N1.
po -- Turn off the PC's I/O ports.
pp -- Print all of the SA values.
psN -- Set starting address at N for step
and go, sSA=N.
prN -- Print the contents of the PC's I/O
port N on the terminal.
puN -- Continuously display the contents of
the PC's I/O port N.
pwN1,N2 -- Write data N2 into the PC's I/O port
N1
pyN -- Continuously write data 0 to 0xFF
into the PC's I/O port N.
pzN -- Sequentially write the data into the
I/O ports N to N+1F.
qq -- Quit and exit from the UMPS11
35
program.
qp -- Pause (press any key to continue).
rf -- Input and display the values of the
flags of the status register.
rfSS,N -- Set flag SS to value N.
rp -- Display the values of all the
processor's registers and flags.
rx -- Input and display the contents of
the registers of the microprocessor.
rxSS,N -- Set register SS to value N.
s -- Execute one machine instruction.
sn -- Execute one mini assembly syntax
without going into any subroutines.
sN -- Execute N machine instructions.
snN -- Execute N steps without going into
any subroutines.
sg -- Start executing the program from sSA
(Hit "/" key to stop the execution).
te -- Toggle the flag to echo the command
line.
tf -- Toggle the flag to fix SA.
ti -- Set software interrupt.
tm -- Toggle the flag to trace memory's
read/write.
tn -- Set nmi interrupt.
tr -- Reset interrupt.
xc -- Close the data train input.
xi addr LNN....LNN -- Set a special I/O port at addr by
a data train in the format of a
series of LNN.
xm addr LNN....LNN -- Set a special memory port at addr
by a data train formated by a series
of LNN.
36