home *** CD-ROM | disk | FTP | other *** search
/ Share Gallery 1 / share_gal_1.zip / share_gal_1 / LA / LA026.ZIP / UMPS.DOC < prev    next >
Text File  |  1990-10-16  |  94KB  |  2,377 lines

  1.  
  2.  
  3.  
  4.                                                                         1
  5.  
  6.  
  7.             1.1 Introduction            1.1 Introduction
  8.             
  9.             
  10.             Digital circuit hardware designers have come to recognize
  11.             the value of the versatile, low cost microprocessor. Along
  12.             with an MPU (microprocessor unit), the circuit design of a
  13.             microcontroller might typically contain components such as
  14.             VLSI, ASIC or TTL chips, memory, LED display, A/D converter
  15.             and an I/O port which can be accessed by the MPU. The
  16.             inclusion of appropriate microprocessor software is almost
  17.             always required to complete the design and make it useful.
  18.             
  19.             To establish a series of instruction codes for a particular
  20.             type of MPU from the ground up is tedious and time
  21.             consuming. It is almost impossible to conduct this
  22.             complicated step without the aid of other software programs.
  23.             The most popular and economical software for this job is a
  24.             cross assembler which allows you to write the program in the
  25.             assembly language of a chosen MPU on a host computer such as
  26.             an IBM PC1 (or compatible) and convert it to the machine
  27.             code of that particular MPU.
  28.             
  29.             More sophisticated software can even allow you to use a high
  30.             level language such as C, Fortran, or Basic, and then
  31.             translate it into the machine code of the specified MPU. In
  32.             this manner, MPU software design becomes greatly simplified.
  33.             
  34.             Many experienced programmers know that the first finished
  35.             set of machine codes rarely works the first time. Each
  36.             instruction or subroutine needs to pass a series of tests
  37.             before you feel confident enough to utilize it. These
  38.             machine codes cannot be tested by a debugging program like
  39.             DOS Debug2 or Microsoft's Coview2 on the host computer such
  40.             as a PC/AT1 since they are not compatible to the instruction
  41.             set of the 8086-based host computer. To test the validity of
  42.             the machine codes, several tools such as in-circuit
  43.             emulators (ICE), logic analyzers or software simulators are
  44.             usually used to debug the machine codes.
  45.             
  46.             Our company has designed a low priced but powerful software
  47.             program called the Universal Microprocessor Simulator (UMPS)
  48.             for use with any 8086-based PC system. On these PC systems
  49.             UMPS can accept your mini assembly program, translate it
  50.             into the executable machine instruction codes, execute them
  51.             and display the same result as if that particular MPU was
  52.             resident in your PC. This package has been designed to be an
  53.             easy-to-use tool to aid your software development. Our goal
  54.             is to help you write and maintain efficient programs.
  55.             
  56.             
  57.             1. IBM PC, PC/AT and PC-DOS are trademarks of International
  58.                Business Machines Corporation.
  59.             
  60.             2. Debug and Coview are trademarks of Microsoft Corporation.
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.                                                                         2
  71.  
  72.  
  73.             
  74.             UMPS has been designed to work for as many kinds of
  75.             microprocessors as possible. A Rule file for the chosen
  76.             microprocessor must be included in the same directory of the
  77.             same disk to let UMPS work for the processor you like. Rule
  78.             files of Intel's 8085, Motorola's M6800, Zilog's Z80,
  79.             Rockwell's 6502 and 65C02 are all included on the
  80.             accompanying floppy disk.
  81.             
  82.             Rule files for popular microprocessor like Motorola's
  83.             M68HC11, MC6805, MC6801, MC6809, Intel's 8048, 8051, 8096,
  84.             Zilog's Z8, TI's 7000 and RCA's 1802 are currently under
  85.             development by our company. Write to us if you are
  86.             interested in any other 8-bit microprocessor. We will
  87.             develop rule files for other microprocessors if there is
  88.             sufficient demand. Your suggestions for the implementation
  89.             of the program are also welcome.
  90.             
  91.             All of the machine code instruction in this package have
  92.             been tested using in-circuit emulators designed by our
  93.             company. After thorough, rigorous testing we believe this
  94.             package is more accurate than those described in some
  95.             microprocessor programming manuals (very few errors were
  96.             found when we tested the UMPS package). Reliable as it is,
  97.             J&M Software Hardware Design, Inc. does not assume any
  98.             liability caused by the application or use of this package.
  99.             We welcome your report of any critical bugs which your
  100.             programming can not circumvent. An updated version of this
  101.             package will be sent to you free of charge if you are the
  102.             first person to report such a bug to us.
  103.             
  104.             Be aware that this program enables you to directly access
  105.             your PC's I/O ports, and so there exists a real possibility
  106.             that your hard disk can be overwritten, making it impossible
  107.             to reboot your PC. Refer to section 2.12 for more specific
  108.             information. Note: Because the educational version does not
  109.             permit I/O port access, you cannot overwrite your disk with
  110.             the educational version.
  111.             
  112.             
  113.             1.2 The Capabilities of the UMPS            1.2 The Capabilities of the UMPS
  114.             
  115.             The UMPS program provides an environment in PC-DOS1 to let
  116.             you execute many different types of machine codes such as
  117.             6502 (65C02), Z80, 8085 and 6800, without having that MPU
  118.             inside the host computer. For example, if you want to write
  119.             a mini assembly program or some machine code for a 6502, you
  120.             don't need to have an Apple II3 or a Commondore C-64 (or any
  121.             other computer system which contains the 6502 MPU) to do the
  122.             programming. You also don't need a CP/M system to exercise
  123.             Z80 or 8085 machine instructions or mini assembly programs.
  124.             
  125.             3. Apple II is a registered tradmark of Apple Computer, Inc.
  126.             
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.                                                                         3
  137.  
  138.  
  139.             This program also allows you to switch quickly between
  140.             different kinds of microprocessors (by typing "fc < name of
  141.             microprocessor >" at any time) without quitting and starting
  142.             the program again. The rule file of the microprocessor is
  143.             all you need to run the simulator without further
  144.             reconfiguration.
  145.             
  146.             The UMPS provides 64K bytes memory for users to modify the
  147.             data resident in memory or to start executing an instruction
  148.             from any memory address. The data can be input in the form
  149.             of binary code, ASCII text, decimal code, or as a mini
  150.             assembly instruction through a special command. The contents
  151.             of the memory can be displayed either in the form of binary
  152.             or ASCII code or the mnemonic syntax obtained from the
  153.             disassembler.
  154.             
  155.             The program provides many different ways to observe the
  156.             execution of an instrution. You can simply execute the
  157.             instruction step by step and observe the changes in the
  158.             registers, status flags, the program counter, and the memory
  159.             content as the result of the execution. The reset, non-mask
  160.             interrupt, interrupt, one step, step without going through
  161.             the subroutine, any number of steps, or any number of steps
  162.             without going through subroutines, can be executed as you
  163.             wish. The status of the MPU's registers or flags can also be
  164.             manipulated while you debug your program.
  165.             
  166.             You may also set up several break points to halt the program
  167.             at any desired address points so that you can examine the
  168.             registers and flags after the execution of a group of
  169.             machine codes. Several pseudo-instruction codes such as "CSO
  170.             A" (output the contents of the accumulator to the terminal),
  171.             "STP" (stop the microprocessor) and "CSI A" (input a byte
  172.             from terminal into register A) have been implemented which
  173.             may be helpful for the purpose above.
  174.             
  175.             Running another MPU's machine codes on PC-DOS without an
  176.             opportunity to connect with outside devices may make your
  177.             microcontroller design impractical. To bring it closer to
  178.             the real world, UMPS utilizes your PC's I/O ports as the I/O
  179.             ports for some types of MPUs like the Z80 and 8085. It also
  180.             utilizes your PC's I/O ports as a special memory address for
  181.             those MPUs (like the 6502 and 6800) which do not have I/O
  182.             port capability. With this advantage you may use any
  183.             existing peripheral card such as a printer card, an RS232
  184.             card, a data acquisition card, or a design of your own to
  185.             test your program with UMPS. Note: For users of the
  186.             educational version, the utilization of your PC's I/O ports
  187.             is not provided.
  188.             
  189.             In addition, you can introduce a series of data trains as an
  190.             outside signal to a particular I/O port or memory address;
  191.             then each time the processor accesses that I/O port or
  192.             memory address the data can be accessed byte by byte. With
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.                                                                         4
  203.  
  204.  
  205.             this capability it is much easier to debug your program
  206.             before your hardware is set up.
  207.             
  208.             This package also allows you to type in a command from your
  209.             terminal and immediately observe the result. You can also
  210.             submit (by typing "fb batch_name") a batch file to ask the
  211.             program to execute it. The batch file is a text file which
  212.             is a collection of many commands in the same format as the
  213.             command you typed in from the terminal. The batch file is
  214.             useful for you to read in data without repeated typing or
  215.             having to run the demonstration designed to help beginners.
  216.             
  217.             The codes at any particular section of memory can be saved
  218.             in many types of data formats like UMPS's or Mostek's or
  219.             Intel's or binary code to your hard or floppy disk. The data
  220.             in one of the four formats just mentioned can also be loaded
  221.             from the external disk. UMPS will accept most of the data
  222.             codes created by the most popular cross assembler programs
  223.             and create the data codes for an EPROM programming device.
  224.             Hence you may exercise the machine codes resulting from
  225.             other commercial products or easily transfer your binary
  226.             data codes to the EPROM programming device.
  227.             
  228.             The output display on the screen in response to your
  229.             commands can be stored in a text file which you specify by
  230.             the "fa" command. Then you can use any editing program to
  231.             view the whole text file you have saved. You may also modify
  232.             this output text file into a batch file for demonstration
  233.             purposes.
  234.             
  235.             
  236.             2.1 The UMPS Package            2.1 The UMPS Package
  237.             
  238.             
  239.             The advanced version package of UMPS 1.1 contains the
  240.             following files:
  241.             
  242.                  UMPS.EXE         UMPS.DOC        README.DOC
  243.                  6502.rul         6502.sim     *    6502.spc
  244.                 65C02.rul        65C02.sim     *   65C02.spc
  245.                  6800.rul         6800.sim     *    6800.spc
  246.                  8085.rul         8085.sim     *    8085.spc
  247.                   Z80.rul          z80.sim     *     z80.spc
  248.             
  249.                  6502.ump        6502ml.sim       6502bd.sim
  250.                  6800.ump        6800ml.sim       6800bd.sim
  251.                  8085.ump        8085ml.sim       8085bd.sim
  252.                   Z80.ump         z80ml.sim        z80bd.sim
  253.             
  254.                  6502.tab            ln1.sim        6502.bin
  255.                 65C02.tab            ln2.sim        6502.int
  256.                  6800.tab            ln3.sim        6502.mos
  257.                  8085.tab            ln4.sim         REG.FRM
  258.                   z80.tab            ln5.sim
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.                                                                         5
  269.  
  270.  
  271.             
  272.             Note: The educational version does not include the files
  273.                   which are marked with "*".
  274.             
  275.             The UMPS can run on any PC-DOS computer which has at least
  276.             256K bytes of RAM. The average speed of the advanced version
  277.             on a PC/AT is approximately 500 instructions per second.
  278.             With the same type of computer system the educational
  279.             version will simulate the instructions ten times slower. You
  280.             are encouraged to upgrade to the advanced version by paying
  281.             the registration fee (please see the registration form in
  282.             file REG.FRM).
  283.             
  284.             
  285.             2.2 Getting Started            2.2 Getting Started
  286.             
  287.             
  288.             The UMPS is not copy protected, and there should not be any
  289.             problem for you to copy the program and data files to your
  290.             hard disk or to another floppy disk. Enter "copy a:*.*
  291.             c:dir_name" to copy all the files to your hard disk. Use
  292.             "diskcopy a: a:" to back up the floppy disk (diskcopy is one
  293.             of the external commands of DOS). Before you try to run the
  294.             program, be sure to back up your floppy disk to prevent loss
  295.             of the program.
  296.             
  297.             The program can be started either from the floppy disk of A
  298.             drive or from the hard disk of C drive as long as the
  299.             program and data files have been stored in the same disk and
  300.             directory.
  301.             
  302.             To start the program simply type
  303.             
  304.                     MPS11   <ret>
  305.             
  306.             In about a minute, the terminal will respond with a
  307.             greeting. The first step is to select the desired MPU, since
  308.             this package works for five different types of MPU. The
  309.             command to load in the MPU file is shown below.
  310.             
  311.                     fc 6502    <ret>
  312.             
  313.             Instead of 6502, you may substitute any of the following.
  314.             
  315.                      65C02
  316.                      6800
  317.                      8085
  318.                      Z80
  319.             
  320.             The "fc" command will load in the MPU's rule file with the
  321.             extension ".rul".
  322.             
  323.             Some of the commands work only after some other special
  324.             commands have already been introduced. For example, loading
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.                                                                         6
  335.  
  336.  
  337.             an MPU's rule or speeding file will enable you to use the
  338.             commands described in the following paragraphs for
  339.             assembler, disassembler, and simulator.
  340.             
  341.             When you start the program, you can also load in any MPU's
  342.             batch file with the extension ".sim" by typing "MPS11
  343.             batch_file" instead of just "MPS11". Remember that "fc
  344.             MPU_file" is always the first line of this batch file
  345.             otherwise you may get lines of error message.
  346.             
  347.             
  348.             2.3 Outline of Commands            2.3 Outline of Commands
  349.             
  350.             
  351.             Most of the commands start with a letter and may be followed
  352.             by a number or another letter or a character string. Most of
  353.             the numbers are expressed in hexadecimal format and are used
  354.             for words (16 bits) but some of them may be used for bytes
  355.             (8 bits). UMPS will not check the validity of these
  356.             hexadecimal numbers. Improper entry of a number may result
  357.             in an unexpected result.  All the commands are case
  358.             insensitive. Punch the "Enter" or "Return" key after each
  359.             command.
  360.             
  361.             Commands are categorized in one of the following forms.
  362.             
  363.              c        : only one letter.
  364.                         For example 's' is for one step of simulation,  
  365.                         'm' is for displaying 8 bytes of memory.
  366.             
  367.              cN       : one letter followed by a hexadecimal number.
  368.                         For example "s3" is for 3 steps of simulation
  369.                         (note there is no space between the number and
  370.                         the letter).
  371.             
  372.              cc       : two letters.
  373.                         For example "pp" will print out all the starting
  374.                         addresses (SAs) for each mode.
  375.             
  376.              ccN      : two letters followed by a hexadecimal number.
  377.                         For example "pi1000" will set the starting
  378.                         address to input the data at 1000 (in
  379.                         hexadecimal).
  380.             
  381.              cc N1..Nn: two letters followed by a series of
  382.                         either decimal or hexadecimal numbers.
  383.                         For example "ix 12 34 56 78 90 00" after
  384.                         "pi1000" will set the contents of 1000 to be
  385.                         0x12, the contents of 1001 to be 0x34 and so on.
  386.             
  387.              cc text  : two letters followed by a text string.          
  388.                         For example "fc 6502" will load in the 6502's
  389.                         rule file (note there is a space between the
  390.                         letters and the text).
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.                                                                         7
  401.  
  402.  
  403.             2.4 How to Get Help            2.4 How to Get Help
  404.             
  405.             
  406.             The "h" command will list a summary of the group commands
  407.             and group functions. The response from the "h" command is
  408.             shown below.
  409.             
  410.             a?    :Assemble syntax starting from aSA
  411.             b?    :Break utility
  412.             f?    :File utility
  413.             h     :List the group commands
  414.             hh    :List all of the commamds
  415.             h?    :List the subgroup commands
  416.             dN    :Disassemble N instructions starting from dSA
  417.             mN    :Display N bytes of memory starting from mSA
  418.             i?    :Input data starting from iSA
  419.             p?    :Set SA commands
  420.             q?    :Quit command
  421.             r?    :Set register commands
  422.             s?    :Step commands starting from sSA
  423.             t?    :Toggle commands
  424.             x?    :Set special memory and I/O port commands
  425.                    Where SA is the starting address
  426.             
  427.             Some of the responses are displayed as a letter followed
  428.             with a question mark. These commands represent a group of
  429.             commands which all begin with the same letter. To list the
  430.             functions of a group of commands simply type 'h' plus the
  431.             letter before the "?" mark. For example the "hp" command
  432.             will list the functions of all the commmands which begin
  433.             with letter 'p'. The response from the "hp" command is shown
  434.             below.
  435.             
  436.             paN    :Set aSA (starting assemble address) to N
  437.             pdN    :Set dSA (starting disassemble address) to N
  438.             peN    :Set all SAs to N
  439.             piN    :Set iSA (starting input address) to N
  440.             pmN    :Set mSA (starting memory display address) to N
  441.             pp     :Print all SA values
  442.             psN    :Set sSA (starting simulation address) to N
  443.                     Note: All Ns are hexadecimal numbers
  444.             
  445.             The "hh" commmand will list all of the commands with their
  446.             functions available in UMPS. By using the "fa" command (for
  447.             details see file utility) you can save the output from the
  448.             "hh" command into a file.
  449.             
  450.             
  451.             2.5 Starting Address (SA) Commands            2.5 Starting Address (SA) Commands
  452.             
  453.             
  454.             There are situations in which you need to set the Starting
  455.             Address (SA) for certain types of operations such as data
  456.             input, memory display, mini assembler, disassembler and
  457.  
  458.  
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.                                                                         8
  467.  
  468.  
  469.             simulation at specific memory address. For convenience,
  470.             there are five types of SA for different operations instead
  471.             of just one.
  472.             
  473.             pi3000  --- Set the starting address at 3000 to input the
  474.                         data, i.e. iSA= 3000.
  475.             
  476.             pm2000  --- Set the starting address at 2000 to display the
  477.                         data in memory, mSA= 2000.
  478.             
  479.             pd1000  --- Set the starting address at 1000 to disassemble
  480.                         the machine codes, dSA= 1000.
  481.             
  482.             ps100   --- Set the starting address at 100 for step and go,
  483.                         sSA=100.
  484.             
  485.             pa300   --- Set the starting address to assemble the mini
  486.                         assembly syntax, aSA= 300.
  487.             
  488.             pe700   --- Set all SAs to 700.
  489.             
  490.             pp      --- Print all of the SA values.
  491.             
  492.             tf      --- Toggle fix_SA to determine whether or not to fix
  493.                         SA's.
  494.             
  495.             When the fix_SA flag is not set, the values of aSA, dSA, iSA
  496.             and sSA will be only changed after some related operations,
  497.             whereas the value of mSA will always be fixed. For instance,
  498.             dSA is the starting address to disassemble the machine
  499.             codes. After the operation "d5", not only will five lines of
  500.             mini assembly syntax be displayed, but also dSA will be
  501.             advanced to the address of the sixth instruction.
  502.             
  503.             However, sometimes you would like to fix dSA. Then you
  504.             should type the "tf" command (toggle the value of fix_SA to
  505.             1) before the pdN command so that the value of dSA will not
  506.             be changed (advanced) after the operation of the
  507.             disassembler. This way you can repeatedly display the same
  508.             lines of instructions. The "tf" command is a toggle command
  509.             that sets the flag to fix SA (fix_SA) to toggle from one to
  510.             zero or zero to one.
  511.             
  512.             
  513.             2.6 Input Commands            2.6 Input Commands
  514.             
  515.             
  516.             The following commands are used to modify the data inside
  517.             the memory. All of the numbers from N1 to Nn occupy only one
  518.             byte with the value range from 0 to 255.
  519.             
  520.             ix N1..Nn  --- Input as many binary codes as you want
  521.                            starting from iSA.
  522.             
  523.  
  524.  
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.                                                                         9
  533.  
  534.  
  535.             id N1..Nn  --- Input decimal numbers starting at iSA.
  536.             
  537.             is text    --- Input ASCII text starting at iSA.
  538.             
  539.             a text     --- Assemble one mini assembly instruction
  540.                            starting from aSA.
  541.             
  542.             ay         --- Assemble a series of mini assembly
  543.                            instructions which follow.
  544.                            Note: An "END" statement is always necessary
  545.                                  to exit from "ay" and "an" commands.
  546.             
  547.             an         --- Same as "ay" but no assembled machine code
  548.                            will be displayed.
  549.             
  550.             A series of mini assembly syntax can be entered line by line
  551.             after the "ay" command is entered. If there is no error in
  552.             your instruction, then the machine code created and the
  553.             address it was stored into will be shown on the terminal
  554.             immediately. The "end" statement is used to quit a series of
  555.             assembled code when no more assembly syntax will be entered.
  556.             
  557.             The mnemonic instructions accepted by UMPS may be slightly
  558.             different from what you have learned from other computer
  559.             systems or manufacturers. Therefore special care is advised.
  560.             Files with the extension ".tab" for the 6502, 65C02, 6800,
  561.             Z80, and 8085 contain the formats of the syntax instructions
  562.             in numerical and alphabetical order. These files serve as a
  563.             handy review and reference for you.
  564.             
  565.             
  566.             2.7 Memory and Register Display Commands            2.7 Memory and Register Display Commands
  567.             
  568.             
  569.             m       -- Display one line of memory starting from mSA.
  570.             
  571.             mN      -- Display N/8 lines of memory starting from mSA.
  572.             
  573.             d       -- Display one line of disassembled instruction
  574.                        starting from dSA.
  575.             
  576.             dN      -- Display N lines of disassembled instructions
  577.                        starting from dSA.
  578.             
  579.             rp      -- Display all the values of processor's registers
  580.                        and flags.
  581.             
  582.             rx      -- Input and display the contents of the registers
  583.                        of the microprocessor.
  584.             
  585.             rf      -- Input and display the values of the flags of
  586.                        the condition code register.
  587.             
  588.             rxSS,N  -- Set register SS to value N.
  589.  
  590.  
  591.  
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598.                                                                         10
  599.  
  600.  
  601.             
  602.             rfSS,N  -- Set flag SS to value N.
  603.             
  604.             The "m" and "d" commands are used to display the data inside
  605.             the memory. These displays can be stopped by hitting any key
  606.             other than the "q" key which will quit the display.
  607.             
  608.             The "rx" command is used to modify the MPU's registers and
  609.             the "rf" command is used to modify the flags of the MPU.
  610.             When you use a register modification routine, you can change
  611.             the value of the registers one by one with the guidance of
  612.             the program. One of the following steps can be used to
  613.             respond to a particular register or flag.
  614.             
  615.                a. return key : leave the value unchanged.
  616.                b. q key      : quit the modification routine.
  617.                c. N number   : change the value of the register to N.
  618.                d. + key      : skip over 5 registers (or flags)
  619.                                without modification.
  620.                e. - key      : go backward 5 registers (or flags).
  621.             
  622.             The commands "rxSS,N" and "rfSS,N" save you time if you just
  623.             want to modify a single register or flag. N is the
  624.             hexadecimal value of the register.
  625.             
  626.             
  627.             2.8 STEP, GO and Break Commands            2.8 STEP, GO and Break Commands
  628.             
  629.             
  630.             s    --- Execute one machine instruction.
  631.             
  632.             sN   --- Execute N machine instructions.
  633.             
  634.             sn   --- Execute one mini assembly instruction without
  635.                      going into the subroutine.
  636.             
  637.             snN  --- Execute N steps without going into any subroutines.
  638.             
  639.             sg   --- Start executing the program from sSA
  640.                      (Hit "/" key to stop the execution).
  641.             
  642.             bl   --- List all the break points.
  643.             
  644.             bc   --- Clear all the break points.
  645.             
  646.             beN  --- Erase break point N.
  647.             
  648.             bpN  --- Set a break point at N.
  649.             
  650.             qq   --- Quit and exit from the UMPS11 program.
  651.             
  652.             qp   --- Pause (press any key to resume).
  653.             
  654.  
  655.  
  656.  
  657.  
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664.                                                                         11
  665.  
  666.  
  667.             The step and go commands both start at the memory address of
  668.             sSA. The "s" command will only simulate one instruction and
  669.             stop at the next Program Counter (PC). Hence the next step
  670.             may be the instruction following the previously executed
  671.             one, or the beginning address of a subroutine, or any other
  672.             address specified by the PC. The "sN" command will simulate
  673.             N instructions.
  674.             
  675.             "sn" is a special command similar to the "s" command except
  676.             that it treats a subroutine as a single machine instruction.
  677.             The "snN" command executes N instructions and treats any
  678.             subroutines the same way as the "sn" command does. You can
  679.             save time by using the "sn" or "snN" command to skip over
  680.             any subroutines which are already known to work properly.
  681.             
  682.             The break commands are adapted to serve for the "sg"
  683.             command. You may place break points at every desired address
  684.             with the "bpN" command, and erase break points by the "beN"
  685.             command. Hitting "sg" will continuously execute the program
  686.             without stop until it meets one of the following conditions:
  687.             
  688.                  a. when '/' key is hit.
  689.                  b. implemented software includes the instruction "STP".
  690.                  c. the break point is reached.
  691.             
  692.             Once the "sg" command is entered the program will stop at
  693.             any special CPU instructions such as "HALT" (for the Z80),
  694.             or "HLT" (for the 8085), or "WAI" (for the 6800) until the
  695.             "/" key is hit for UMPS version 1.1. For the next version
  696.             the "Reset" and "Interrupt" will be implemented to exit at
  697.             hung-up situations.
  698.             
  699.             When the execution of the machine code stops, the program
  700.             will list the current status of flags, registers and PC. You
  701.             may resume the simulation simply by entering the "sg"
  702.             command again.
  703.             
  704.             
  705.             2.9 File Input and Output Commands            2.9 File Input and Output Commands
  706.             
  707.             
  708.             fc MPU_file          -- Read in the processor's rule or
  709.                                     speeding file                   
  710.             
  711.             fw o B_file addr len -- Write the machine code starting at
  712.                                     address addr with a total length of
  713.                                     len to the file named B_file
  714.             
  715.             fr o B_file          -- Read the file named B_file into the
  716.                                     default memory address
  717.             
  718.             fr o B_file addr     -- Read the file named B_file into the
  719.                                     specified memory address addr
  720.             
  721.  
  722.  
  723.  
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730.                                                                         12
  731.  
  732.  
  733.             fb batch_file        -- load the batch file named batch_file
  734.             
  735.             fa                   -- Toggle to open/close the file
  736.                                     Temp.txt
  737.             
  738.             fa text_file         -- Toggle to open/close text_file
  739.             
  740.             fx string            -- Enable the use of the commands in
  741.                                     PC-DOS environment
  742.             
  743.             where "o" can be U, B, I, or M. Each of them represents the
  744.             data format of UMPS, Binary, Intel or Mostek. You do not
  745.             need to add extensions to the file names for B_file,
  746.             batch_file and text_file. Special extensions will be added
  747.             to these file names automatically.
  748.             
  749.             The "fc" command is utilized to switch between different
  750.             types of processors. This command should be executed at the
  751.             very beginning to enable the usage of some other commands of
  752.             this package.
  753.             
  754.             The "fw" command serves to save the machine codes from a
  755.             special memory address to the disk and "fr" is used to read
  756.             the data from the external disk. Since there are four types
  757.             of data formats, remember that the file you want to read by
  758.             "fr o" has to be in the data format specified by "o". This
  759.             program allows you to read data files created by other
  760.             sources in Binary code, or in Intel's or Mostek's format.
  761.             When you read a data file in binary code be sure to specify
  762.             the destination address to load the file.
  763.             
  764.             Users of the educational version are allowed to use "fr" and
  765.             "fw" for data files not larger than 64 bytes. There is also
  766.             a five times limit to using "fr" and "fw" respectively each
  767.             time you enter the UMPS's environment.
  768.             
  769.             The batch file command is designed for the user's
  770.             convenience.  You can use your favorite editing program to
  771.             type the batch file, then load it in by the "fb" command. In
  772.             addition to this advantage it can be used for a
  773.             demonstration to help beginners exercise UMPS or some other
  774.             techniques. The batch files are always specified by an
  775.             extension ".sim".
  776.             
  777.             The "fa" command is used to toggle the text_file open/close.
  778.             The text_file will always have the extension ".txt". The
  779.             display on the terminal after the text_file was opened and
  780.             before it was closed will be stored in the text_file. You
  781.             can investigate all the information in the text_file by
  782.             using other editing programs. In this manner, access to more
  783.             than one page of results may offer you more efficiency in
  784.             debugging.
  785.             
  786.  
  787.  
  788.  
  789.  
  790.  
  791.  
  792.  
  793.  
  794.  
  795.  
  796.                                                                         13
  797.  
  798.  
  799.             The "fx" command enables you to execute the commmands used
  800.             in the PC-DOS environment. For example "fx dir A:" will list
  801.             the files in A drive.
  802.             
  803.             
  804.             2.10 Debugging with Toggle Commands            2.10 Debugging with Toggle Commands
  805.             
  806.             
  807.             tf --- Toggle the flag to fix SA.
  808.             
  809.             te --- Toggle the flag to echo the command line.
  810.             
  811.             ti --- Set software interrupt.
  812.             
  813.             tm --- Toggle the flag to trace memory reading-writing.
  814.             
  815.             tn --- Set nmi interrupt.
  816.             
  817.             tr --- Reset interrupt.
  818.             
  819.             The "tm" command toggles the flag to trace memory reading
  820.             and writing. The print-out of memory read/write status can
  821.             save you time and be helpful in your program debugging. For
  822.             example there is an assembly syntax "STA $2020,X" of 6502
  823.             beginning at $2010. The next three lines are displayed on
  824.             the terminal after the command "ps2010" is entered.
  825.             
  826.             2010 : 9D  20 20          STA     $2020,X
  827.             A=33 X=03 Y=00 SP=0000 ST=30 PC=2010
  828.             C=0 Z=0 I=0 D=0 O=0 N=0
  829.             
  830.             RW ADDR=2011 DATA=2020             ***
  831.             RB ADDR=2023 DATA=00               ***
  832.             WB ADDR=2023  DATA=33              ***
  833.             2013 : 00                 BRK
  834.             A=33 X=03 Y=00 SP=0000 ST=30 PC=2013
  835.             C=0 Z=0 I=0 D=0 O=0 N=0
  836.             
  837.             The last six lines above will print out on the screen when
  838.             this assembly instruction is executed and the "tm" command
  839.             toggles the trace flag to "one" before the execution. If the
  840.             trace flag was not toggled to one, those three lines marked
  841.             with "***" will not be displayed. The first line shows that
  842.             UMPS read a word (RW), 2020, beginning at $2011. The second
  843.             line shows that UMPS read a byte (RB), 00, from $2023. The
  844.             third lines shows that UMPS wrote a byte (WB), 33 (which is
  845.             the contents of A register) to $2023.
  846.             
  847.             
  848.             2.11 Data Train Input Commands            2.11 Data Train Input Commands
  849.             
  850.             xc                 --- Close the data train input.
  851.             
  852.             xm addr LNN....LNN --- Set special memory port at addr
  853.  
  854.  
  855.  
  856.  
  857.  
  858.  
  859.  
  860.  
  861.  
  862.                                                                         14
  863.  
  864.  
  865.                                    by data train in the format of a
  866.                                    series of LNN.
  867.             
  868.             xi addr LNN....LNN --- Set a special I/O port at addr
  869.                                    by data train in the format of a
  870.                                    series of LNN.
  871.             
  872.             where L can be any of the letters listed below, and NN is
  873.             any number.
  874.             
  875.             R : repeat NN times next NN data.
  876.             N : data NN.
  877.             L : loop NN times, the loops end with 'ENN'.
  878.             E : end the loop.
  879.             S : data stays at value NN.
  880.             
  881.             The data train input command allows the user to assign a
  882.             certain data input sequence to a particular port of the MPU
  883.             in order to debug the code program before the hardware which
  884.             contains this MPU is assembled. In other words, instead of
  885.             setting up the hardware device to test your routine's
  886.             validity, your software is tested by certain types of data
  887.             patterns with which you may predict all the possible
  888.             configurations in your hardware circuit design.
  889.             
  890.             The data train for a particular port acts as a first-in
  891.             first-out (FIFO) buffer. The "xm" and "xi" commands let you
  892.             stack the data one by one into the special memory port or
  893.             input port according to the rules listed above. The first
  894.             data stacked into the buffer will be first accessed by
  895.             either the CPU's instruction related to port access or
  896.             UMPS's command, like "m" (memory display) or "d"
  897.             (disassemble).
  898.             
  899.             There is always an "NN2" string after the "RN1" string. The
  900.             combination of these two strings will stack data "N2" for N1
  901.             times into the buffer. The "SN" string lets the data
  902.             directed to the port stay at the value N after the output of
  903.             all the data. For example, the command "xm C000 R05 N31 S32"
  904.             will stack the data "31" five times into the buffer and
  905.             after that all the data stays at the value "32". More
  906.             examples are list below for the data train input to a
  907.             specific port.
  908.             
  909.               partial commands    the data stacked in order into buffer
  910.             ---------------------   --------------------------------
  911.              r04 n31 s32              31 31 31 31 32 32 32 32 .....
  912.              r05 n32 s35              32 32 32 32 32 35 35 35 .....
  913.              r03 n32 r03 n34 s33      32 32 32 34 34 34 33 33 .....
  914.             
  915.             
  916.             The "LN" string is always coupled with a "EN" string later
  917.             on. All the actions of the strings after "LN" and before
  918.             "EN" will loop N times. The sequence inside the loop can be
  919.  
  920.  
  921.  
  922.  
  923.  
  924.  
  925.  
  926.  
  927.  
  928.                                                                         15
  929.  
  930.  
  931.             any repeated step or another loop sequence. For example
  932.             "L04 N31 N32 E00 S33"  will produce the data sequence "31 32
  933.             31 32 31 32 31 32 33 33.....". More examples are shown
  934.             below.
  935.             
  936.             L03 N35 N33 N35 E00 S32
  937.             will give "35 33 35 35 33 35 35 33 35 32 32 ...."
  938.             
  939.             L02 R03 N31 R02 N32 E00 S39
  940.             will give "31 31 31 32 32 31 31 31 32 32 39 39 ...."
  941.             
  942.             L02 N33 L03 N31 N32 E00 E00 S39
  943.             will give "33 31 32 31 32 31 32 33 31 32 31 32 31 32 39
  944.             39....."
  945.             
  946.             The following batch file clearly demonstrates how the data
  947.             train cooperates with the code program. If you submit this
  948.             batch file, the program will print out the characters as the
  949.             next line until you hit the '/' key.
  950.             
  951.             11111222222222222222.........
  952.             
  953.             fc 6502
  954.             xm C000 R06 N31 S32
  955.             pe1000
  956.             ay
  957.             LDA $C000
  958.             CSO A
  959.             JMP $1000
  960.             end
  961.             sg
  962.             
  963.             The command in the first line of the batch file selects the
  964.             6502 CPU. The command in the second line assigns the data
  965.             buffer sequence " 31 31 31 31 31 32 32 ...." to the memory
  966.             address $C000. The command in the third line sets all the
  967.             starting addresses at 0x1000, and in the fourth line the
  968.             "ay" command let UMPS start to input the assembly code until
  969.             the "end" statement. The "sg" command in the final line lets
  970.             UMPS execute the code program starting at 0x1000.
  971.             
  972.             As the code program starts execution, the command "LDA
  973.             $C000" will try to load the A register with the content of
  974.             the memory address C000, "31" (After this "31" was accessed
  975.             the next "31" will pop up for the next action). The next
  976.             instruction "CSO A" will print out the contents of the A
  977.             register in the format of ASCII code which is "1". The last
  978.             instruction causes a jump to the first instruction at $1000.
  979.             Since the code program is a loop to continuously load
  980.             $C000's contents into this A register and display it on the
  981.             terminal, the display is six repetitions of "1" followed by
  982.             "2".
  983.             
  984.  
  985.  
  986.  
  987.  
  988.  
  989.  
  990.  
  991.  
  992.  
  993.  
  994.                                                                         16
  995.  
  996.  
  997.             If you change the second line of this mini batch file to a
  998.             different data train "xm C000 R10 N31 R10 N32 S35", then the
  999.             result appearing on the screen will look like the next line:
  1000.             
  1001.             111111111122222222225555..................
  1002.             
  1003.             
  1004.             2.12 How to Utilize Your PC's I/O Ports            2.12 How to Utilize Your PC's I/O Ports
  1005.             
  1006.             
  1007.             One of the most valuable features of the UMPS program is
  1008.             that it provides a connection between the user's program and
  1009.             the outside world by using the PC's I/O ports. Some of the
  1010.             user's controller circuitry, such as a temperature
  1011.             controller with D/A converter, data acquisition with an A/D
  1012.             converter, or a stepping motor's driving circuitry may be
  1013.             tested by mapping the I/O addresses of the MPU (8085 or Z80)
  1014.             or the memory addresses of the MPU (6502, 6800, 8085 or Z80)
  1015.             to the PC's I/O ports before the target system of the
  1016.             microcomputer is finished.
  1017.             
  1018.             Not all of the PC's I/O addresses are available for use, as
  1019.             some of them may already be used as a control for the hard
  1020.             disk or as a timer. The use of some address may change the
  1021.             configuration of the PC's system and hinder the capability
  1022.             to boot the computer system or cause the computer to hang up
  1023.             until reboot. Be very careful when you try to read/write
  1024.             from the PC's I/O ports already adopted for special
  1025.             purposes. Check the detailed port assignments and their
  1026.             meanings in your PC's technical manual before you try to run
  1027.             your program.
  1028.             
  1029.             If you want to alter the contents of some memory addresses
  1030.             which have been mapped to the PC's I/O ports be aware that
  1031.             many instructions will cause the transfer of data between
  1032.             the memory and the I/O ports. You should also avoid some
  1033.             instructions which are used to send or receive data through
  1034.             the PC's I/O port if the number of pulses each of these
  1035.             instruction executes is of importance in your circuit design
  1036.             (like timers or counters). You may want to check with the
  1037.             "tm" command to see how the UMPS handles the memory's R/W
  1038.             process.
  1039.             
  1040.             Before your program can send/receive data to/from the PC's
  1041.             I/O ports, these I/O ports have to be be initialized by
  1042.             using the proper command listed below. Otherwise the program
  1043.             would treat the MPU's I/O port address simply as a memory
  1044.             address.
  1045.             
  1046.             poN       :Map the CPU's I/O port addresses with the PC's   
  1047.                        I/O port addresses beginning at N.
  1048.             
  1049.             poN1,N2   :Map the CPU's memory beginning at N2 (256 bytes)
  1050.                        with the PC's I/O port beginning at N1.
  1051.  
  1052.  
  1053.  
  1054.  
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060.                                                                         17
  1061.  
  1062.  
  1063.             
  1064.             po        :Turn off the PC's I/O ports.
  1065.             
  1066.             Only 256 bytes of the PC's I/O port addresses will be
  1067.             assigned each time the "poN" or "poN1,N2" command is used.
  1068.             The "poN" command is used to map the PC's I/O port addresses
  1069.             beginning at N with the CPU's (Z80 or 8085) I/O ports. For
  1070.             example "po280" will assign the PC's I/O port address to the
  1071.             CPU's I/O ports as listed below:
  1072.             
  1073.                     CPU's I/O address    PC's I/O address
  1074.                            0                   280
  1075.                            1                   281
  1076.                            ..                  ...
  1077.                           0xFF                 37F
  1078.             
  1079.             The "poN1,N2" command is used to map the CPU's (6502, 6800,
  1080.             8085 or Z80) page address starting at N2 (used only for one
  1081.             byte) to the PC's port address starting at N1. For example,
  1082.             the command "po280,C0" will assign the PC's I/O port address
  1083.             to the CPU's memory address as shown below:
  1084.             
  1085.                  CPU's memory address      PC's I/O address
  1086.                          C000                   280
  1087.                          C001                   281
  1088.                          ....                   ...
  1089.                          C0FF                   37F
  1090.             
  1091.             Once the PC's I/O port addresses have been assigned to the
  1092.             special memory addresses (or MPU's I/O ports) they will be
  1093.             affected by any command or instruction which involves their
  1094.             corresponding special memory addresses. For instance, the
  1095.             command to display the contents of the special memory
  1096.             addresses will read the data from the corresponding input
  1097.             ports, whereas the command to input the data to the special
  1098.             memory addresses will send the data to the corresponding
  1099.             output ports. All of the CPU's instructions which load or
  1100.             store the data into the special memory addresses affect the
  1101.             PC's I/O ports in the same way. Mapping between the P/C's
  1102.             I/O ports to the CPU's I/O ports or special memory addresses
  1103.             can be turned off by the "po" command.
  1104.             
  1105.             In addition to enabling the user's program to send or
  1106.             receive the data through the PC's I/O, UMPS also provides
  1107.             access to PC's I/O test routine to help the user to trace
  1108.             any problems in his circuit design with the use of some
  1109.             tools like an ocilloscope, logic probe, or digital volt
  1110.             meter. The following commands serve the purpose just
  1111.             mentioned:
  1112.             
  1113.             prN     : Display the contents of the PC's I/O port N
  1114.                       on the terminal.
  1115.             
  1116.             puN     : Continuously display the contents of the
  1117.  
  1118.  
  1119.  
  1120.  
  1121.  
  1122.  
  1123.  
  1124.  
  1125.  
  1126.                                                                         18
  1127.  
  1128.  
  1129.                       PC's I/O port N.
  1130.             
  1131.             pwN1,N2 : Write data N2 into the PC's I/O port N1.
  1132.             
  1133.             pyN     : Continuously write data 0 to 0xFF
  1134.                       into the PC's I/O port N.
  1135.             
  1136.             pzN     : Sequentially write the data into the PC's
  1137.                       I/O ports N to N+1F.
  1138.             
  1139.             The "pr" or "pw" is single step read or write command which
  1140.             reads the data from the PC's I/O port or writes the data to
  1141.             the PC's I/O port. The "pu", "py", and "pz" commands
  1142.             continuously read or write negative pulses through the
  1143.             specified port addresses. With the help of an ocilloscope or
  1144.             logic probe the user can quickly locate any faulty circuitry
  1145.             owing to the address decoding. The users of the educational                                                                       
  1146.             version will not be able to utilize the PC's I/O port
  1147.             through UMPS.
  1148.             
  1149.             
  1150.             3.1 Differences between UMPS and CPU            3.1 Differences between UMPS and CPU
  1151.             
  1152.             
  1153.             Although UMPS simulates most of the instructions for certain
  1154.             kinds of CPU (Central Processor Unit) UMPS will not match
  1155.             every CPU action. These no-match conditions include non-
  1156.             existing codes, decimal adjust accumulator (DAA), undefined
  1157.             flags, special operations and memory read/ write operations.
  1158.             The following outlines how UMPS treats all these conditions.
  1159.             
  1160.             Non-existing codes
  1161.             
  1162.             Different types of CPUs treat non-existing codes
  1163.             differently. One may hang up on the process, one may perform
  1164.             an unexpected operation (like the 6502), one may advance PC
  1165.             by 2 (like the 65C02) and one may do some other operation.
  1166.             Three of the non-existing codes of each CPU are adopted by
  1167.             UMPS for the implemented assembly syntax CSO, CSI and STP                                                     CSO, CSI     STP
  1168.             (for details see "The capabilities of the UMPS"). Besides
  1169.             these special purpose codes, the UMPS treats all other non-
  1170.             existing codes as no operation (NOP). All the registers and
  1171.             flags are left intact. However the program counter will
  1172.             advance by some number (from 1 to 4 depending on the type of
  1173.             CPU). For the 6502, 65C02, 8085 and 6800, this number would
  1174.             be 1. For the Z80 it will be 1 to 4 depending on how many
  1175.             fetch codes are needed for one instruction. You are strongly
  1176.             advised not to include non-existing codes unless you are
  1177.             well versed in their use.
  1178.             
  1179.             Decimal Adjust Accumulator
  1180.             
  1181.             DAA will work properly only under certain conditions. The
  1182.             primary condition is that the number for arithmetic
  1183.  
  1184.  
  1185.  
  1186.  
  1187.  
  1188.  
  1189.  
  1190.  
  1191.  
  1192.                                                                         19
  1193.  
  1194.  
  1195.             operations must be in binary code decimal (BCD) format.
  1196.             Otherwise the result from the simulator will not be the same
  1197.             as that from the CPU. Besides this restriction, certain
  1198.             different conditions are required for different CPUs as
  1199.             described as follows.
  1200.             
  1201.             For the 6502 and 65C02, there is no DAA instruction. Once
  1202.             the D flag is set there will be a decimal adjustment for
  1203.             each arithmetic operation. When the D flag is set,
  1204.             executions involving all the addressing modes for Add with
  1205.             Carry (ADC) and Subtract with Carry (SBC) will undergo
  1206.             decimal adjustment.
  1207.             
  1208.             For the 6800 and 8085, the DAA instructions will work only
  1209.             immediately after those instructions related to addition
  1210.             such as Add Immediate (ADI), ADC, and ADD. Note that DAA
  1211.             will not work for subtraction.
  1212.             
  1213.             For the Z80, the DAA will work if it immediately follows an
  1214.             instruction for addition or subtraction. The addition
  1215.             instruction can be ADD, ADC, or INC. The subtraction
  1216.             instructions are SUB, SBC, DEC or NEG. For details please
  1217.             see a Z80 programming manual.
  1218.             
  1219.             Undefined flags
  1220.             
  1221.             In many manufaturer's MPU data books some types of flags are
  1222.             left undefined after the execution of certain types of
  1223.             intruction. We have traced out some rules for some undefined
  1224.             flags using real CPUs coupled with in-circuit emulators
  1225.             designed by our company. These results have been integrated
  1226.             into the UMPS. Even so, it is strongly recommended that you
  1227.             use them only as reference aids and your final program
  1228.             design should not utilize these undefined flags. Some of
  1229.             these cases are listed below.
  1230.             
  1231.             1. The S and P/V flags of Z80's instructions "BIT b,r",
  1232.                "BIT b,(HL)", "BIT b,(IX+d)" and "BIT b,(IY+d) are
  1233.                undefined.
  1234.             
  1235.             2. Except for the Z flag, all the other flags of Z80's INI,
  1236.                IND, INIR, INDR, OUTI, OUTD, OUIR and OUDR instructions
  1237.                are undefined.
  1238.             
  1239.             3. The V flag of 6800's DAA instruction is undefined.
  1240.             
  1241.             Special Instructions
  1242.             
  1243.             UMPS treats the special instructions of these MPUs in
  1244.             somewhat different ways. For example, special instructions
  1245.             like "HALT" in the Z80 and 8085 and "WAI" in the 6800
  1246.             generally either hold the CPU until the next interrupt comes
  1247.             along or make it wait for an input signal from the outside.
  1248.             Apparently UMPS can not treat situations like these exactly
  1249.  
  1250.  
  1251.  
  1252.  
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258.                                                                         20
  1259.  
  1260.  
  1261.             the same as the CPUs would. Specifications for these
  1262.             situations are described as follows:
  1263.             
  1264.             1. The "HALT" (used in Z80), "HLT" (used in 8085) and "WAI"
  1265.                (used in 6800) will not advance the program counter (PC)
  1266.                in UMPS. The program will hang up until you enter the
  1267.                UMPS command "tr" (reset) or "ti" (software interrupt).
  1268.             
  1269.             2. The "IM1", "IM2", "LD A,R", and "LD R,A" assembly syntax
  1270.                of the Z80 will not work in UMPS.
  1271.             
  1272.             3. The "SIM" and "RIM" assembly syntax of the 8085 also will
  1273.                not work in UMPS.
  1274.             
  1275.             Memory read/write operations
  1276.             
  1277.             The toggle command "tm" of UMPS is used to toggle the flag
  1278.             to print the trace of memory reading and writing. The print-
  1279.             out of memory read/write is very helpful for you to
  1280.             understand how each instruction works. Though the program is
  1281.             designed in such a way that the trace of reading and writing
  1282.             memory in UMPS is similar to that of the real CPU you should
  1283.             not expect that these two systems will operate through
  1284.             exactly the same route for every instruction.
  1285.             
  1286.             
  1287.             3.2 CPU compatibility            3.2 CPU compatibility
  1288.             
  1289.             
  1290.             Some of the simpler MPUs have much of the same capability as
  1291.             similar, higher level units. The execution of the compatible
  1292.             machine codes by these MPUs will give the same results for
  1293.             the registers and memory. For example Zilog's Z80 can
  1294.             execute almost 85% of Intel 8085's machine codes. The
  1295.             65C02's MPU was developed from the 6502, but with more
  1296.             instructions implemented. Keep in mind that some of the
  1297.             instruction codes designed for lower level CPUs like the
  1298.             6502 or the 8085 may not work on higher level CPUs such as
  1299.             the 65C02 or the Z80.
  1300.             
  1301.             
  1302.             
  1303.             
  1304.             
  1305.             
  1306.             
  1307.             
  1308.             
  1309.             
  1310.             
  1311.             
  1312.             
  1313.             
  1314.             
  1315.  
  1316.  
  1317.  
  1318.  
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324.                                                                         21
  1325.  
  1326.  
  1327.             4.1 Examples            4.1 Examples
  1328.             
  1329.             
  1330.             Example 1.
  1331.             Enter a mini assembly program which will print from 1 to 9
  1332.             on the terminal (for the 6502 microprocessor).
  1333.             
  1334.             Note: "!" represents the beginning of a comment line
  1335.                   "^" begins a line which is the response from the
  1336.                       program. All numbers are in hexadecimal format.
  1337.             
  1338.             ! The first command activates the 6502 simulator.
  1339.             
  1340.             >fc 6502  <ret>
  1341.             
  1342.             ^ Rule file 6502.rul is O.K.
  1343.             
  1344.             ! The next command sets the input address of
  1345.             ! the mini assembly syntax to start at 1000.
  1346.             
  1347.             >pa1000   <ret>
  1348.             ^ aSA= 1000
  1349.             >ay     <ret>
  1350.             ^ End with "end" statement for asm.
  1351.             
  1352.             ! Now enter the mini assembly instructions line by line.
  1353.             ! The machine codes of assembly syntax which follow will
  1354.             ! be stored into the memory starting at aSA=0x1000.
  1355.             
  1356.             LDX #$31   <ret>
  1357.             
  1358.             ^ 1000 : A2 31         LDX  #$31
  1359.             
  1360.             ! Only hexadecimal values (#$) can be accepted by
  1361.             ! this version. Any decimal values (#) entered will
  1362.             ! cause errors.
  1363.             
  1364.             TXA     <ret>
  1365.             
  1366.             ^ 1002 : 8A            TXA
  1367.             
  1368.             INX     <ret>
  1369.             
  1370.             ^ 1003 : E8            INX
  1371.             
  1372.             CSO A    <ret>
  1373.             
  1374.             ^ 1004 : 02            CSO  A
  1375.             
  1376.             ! "CSO A" is a non-6502 assembly instruction, which was
  1377.             ! built in for your convenience to display the contents of
  1378.             ! the accumulator on your terminal.
  1379.             
  1380.             CPX #$3A  <ret>
  1381.  
  1382.  
  1383.  
  1384.  
  1385.  
  1386.  
  1387.  
  1388.  
  1389.  
  1390.                                                                         22
  1391.  
  1392.  
  1393.             
  1394.             ^ 1005 : E0 3A         CPX  #$3A
  1395.             
  1396.             ! If "CPX #3A" was entered instead of "CPX #$3A"
  1397.             ! Then ^ There is no match for * CPX #3A * ^
  1398.             ! and ^ 1005 : 00   BRK ^ will appear on the screen;
  1399.             ! this should remind you to enter the correct instruction.
  1400.             
  1401.             BNE $1002   <ret>
  1402.             
  1403.             ^ 1007 : D0 F9         BNE   $1002
  1404.             
  1405.             STP        <ret>
  1406.             
  1407.             ^ 1009: 0B             STP
  1408.             END      <ret>
  1409.             
  1410.             ! "STP" is another non-6502 assembly instruction
  1411.             ! which was built in for your convenience.
  1412.             
  1413.             ! The next command saves 30 bytes of the memory contents
  1414.             ! starting from address 1000 into a file
  1415.             ! named 6502.UMP in the format of UMPS.
  1416.             
  1417.             >fw u 6502 1000 30    <ret>
  1418.             
  1419.             ^ File name= 6502.UMP
  1420.             ^ Starting address= 1000
  1421.             ^ Length= 0x30(48)
  1422.             
  1423.             ! You can also save them in b(inary), i(ntel), or m(ostek)
  1424.             ! instead of u(mps).
  1425.             
  1426.             ! The next command sets sSA to start at $1000.
  1427.             
  1428.             >ps1000     <ret>
  1429.             
  1430.             ^ 1000 : A2  31            LDX       #$31
  1431.             ^ A=00 X=00 Y=00 SP=0100 ST=30 PC=1000
  1432.             ^ C=0 Z=0 I=0 D=0 V=0 N=0
  1433.             
  1434.             ! The next command executes the first instruction step.
  1435.             
  1436.             >s       <ret>
  1437.             
  1438.             ^ 1002:8A     TXA
  1439.             ^ A=00 X=31 Y=00  SP=0100  ST=30  PC=1002
  1440.             ^ C=0 Z=0 I=0 D=0 V=0 N=0
  1441.             
  1442.             ! The first line shows the next instruction and its
  1443.             ! machine code after the execution of one step.
  1444.             ! The second and the third lines show the contents of
  1445.             ! all the registers and all the flags of the
  1446.             ! processor's status register.
  1447.  
  1448.  
  1449.  
  1450.  
  1451.  
  1452.  
  1453.  
  1454.  
  1455.  
  1456.                                                                         23
  1457.  
  1458.  
  1459.             
  1460.             ! You can execute as many instructions as you like.
  1461.             ! "s5"  will execute five steps in sequence.
  1462.             ! All the results for each five steps will be printed out.
  1463.             ! This "sN" command is a very useful tool in debugging.
  1464.             
  1465.             ! The next command will execute the rest of the program.
  1466.             
  1467.             >sg    <ret>
  1468.             
  1469.             ^ 123456789
  1470.             ^ 100A:00            BRK
  1471.             ^ A=39  X=3A  Y=00  SP=0100  ST=33  PC=100A
  1472.             ^ C=1 Z=1 I=0 D=0  V=0  N=0
  1473.             
  1474.             ! If you want to print out 5 to 8 instead of 1 to 9,
  1475.             ! the contents of location $1001 and $1006 need
  1476.             ! to be $35 and $39, respectively.
  1477.             ! The following commands will make the changes.
  1478.             
  1479.             ! Enter hexadecimal number 35 for location 0x1001.
  1480.             
  1481.             >pi1001   <ret>
  1482.             ^ iSA= 1001
  1483.             >ix 35    <ret>
  1484.             
  1485.             ! Next we move to new address 0x1006
  1486.             ! and enter the decimal number 57 for location 0x1006.
  1487.             
  1488.             >pi1006   <ret>
  1489.             ^ iSA= 1006
  1490.             >id 57    <ret>     (0x39=57)
  1491.             
  1492.             ! To see the whole program after this modification,
  1493.             ! assign dSA at 0x1000 to start the disassembler
  1494.             ! and display 0x7 instrucion codes.
  1495.             
  1496.             >pd1000   <ret>
  1497.             ^ dSA= 1000
  1498.             >d7       <ret>
  1499.             
  1500.             ^ 1000 A2 35              LDX   #$35
  1501.             ^ 1002 8A                 TXA
  1502.             ^ 1003 E8                 INX
  1503.             ^ 1004 02                 CSO   A
  1504.             ^ 1005 E0 39              CPX   #$39
  1505.             ^ 1007 D0 F9              BNE   $1002
  1506.             ^ 1009 0B                 STP
  1507.             ^ 100A 00                 BRK
  1508.             
  1509.             >pp        <ret>
  1510.             
  1511.             ^ mSA=0000  iSA=1007  dSA=100B  sSA=100B  aSA=100B
  1512.             
  1513.  
  1514.  
  1515.  
  1516.  
  1517.  
  1518.  
  1519.  
  1520.  
  1521.  
  1522.                                                                         24
  1523.  
  1524.  
  1525.             ! You are advised to use "pp" command whenever
  1526.             ! you feel that the program is not responding properly.
  1527.             ! This "pp" command displays the current status of
  1528.             ! mSA, iSA, dSA, sSA, and aSA.
  1529.             ! Make sure that all these data are correct.
  1530.             
  1531.             ! To execute the newly altered program
  1532.             ! the sSA needs to be changed from 100A to 1000.
  1533.             
  1534.             >ps1000     <ret>
  1535.             
  1536.             ^ 1000 : A2  31            LDX       #$31
  1537.             ^ A=39 X=3A Y=00 SP=0100 ST=33 PC=1000
  1538.             ^ C=1 Z=1 I=0 D=0 V=0 N=0
  1539.             
  1540.             >sg         <ret>
  1541.             
  1542.             ^ 5678
  1543.             ^ 100A : 00          BRK
  1544.             ^ A=38  X=39  Y=0  SP=0100  ST=33  PC=100A
  1545.             ^ C=1  Z=1  I=0  D=0  O=0  N=0
  1546.             
  1547.             >fr u 6502    <ret>
  1548.             
  1549.             ^ File name = 6502.UMP
  1550.             ^ Starting address = 1000
  1551.             ^ Length = 0x30(48)
  1552.             
  1553.             ! Remember that the old program had been written into the
  1554.             ! file "6502.UMP". The "fr u 6502" command reads this file
  1555.             ! back into the default address $1000.
  1556.             ! Do you want to view the changes?
  1557.             ! What commands do you need?
  1558.             
  1559.             ! There are files 6800.UMP, 8085.UMP and z80.UMP for users
  1560.             ! of MPU other than the 6502 to practice with UMPS.
  1561.             ! The files with extension ".UMP" provide the same function
  1562.             ! as the 6502.UMP file.
  1563.             
  1564.             ! Files 6502.BIN, 6502.INT and 6502.MOS are included for
  1565.             ! your reference. These files and 6502.UMP all have the same
  1566.             ! original data but are stored in different data formats.
  1567.             ! When you use the "fr" command to read a ".BIN" file
  1568.             ! you always need to specify the destination.
  1569.             
  1570.             
  1571.             
  1572.             
  1573.             
  1574.             
  1575.             
  1576.             
  1577.             
  1578.             
  1579.  
  1580.  
  1581.  
  1582.  
  1583.  
  1584.  
  1585.  
  1586.  
  1587.  
  1588.                                                                         25
  1589.  
  1590.  
  1591.             Example 2.
  1592.             Enter a batch file which is a multiplying subroutine called
  1593.             6800ml.sim (for the 6800 microprocessor). Store your
  1594.             multiplier into $150,$151. Load your multiplicand into
  1595.             $154,$155. The result of the multiplication will be stored
  1596.             into $152,$153,$154 and $155.
  1597.             
  1598.             >fb 6800ml.sim    <ret>
  1599.             
  1600.             ^ Rule file 6800.rul is O.K.
  1601.             ^aSA= 0100
  1602.             ^ 0100 : C6  10                       LDAB    #$10
  1603.             ^ 0102 : 7F  01 52                    CLR     $152
  1604.             ^ 0105 : 7F  01 53                    CLR     $153
  1605.             ^ 0108 : 76  01 54                    ROR     $154
  1606.             ^ 010B : 76  01 55                    ROR     $155
  1607.             ^ 010E : 24  12                       BCC     $122
  1608.             ^ 0110 : B6  01 53                    LDAA    $153
  1609.             ^ 0113 : BB  01 51                    ADDA    $151
  1610.             ^ 0116 : B7  01 53                    STAA    $153
  1611.             ^ 0119 : B6  01 52                    LDAA    $152
  1612.             ^ 011C : B9  01 50                    ADCA    $150
  1613.             ^ 011F : B7  01 52                    STAA    $152
  1614.             ^ 0122 : 76  01 52                    ROR     $152
  1615.             ^ 0125 : 76  01 53                    ROR     $153
  1616.             ^ 0128 : 76  01 54                    ROR     $154
  1617.             ^ 012B : 76  01 55                    ROR     $155
  1618.             ^ 012E : 5A                           DECB
  1619.             ^ 012F : 26  DD                       BNE     $10E
  1620.             ^ 0131 : 3D                           STP
  1621.             
  1622.             ! This multiplication program is now introduced into
  1623.             ! memory from $100 to $131.
  1624.             
  1625.             >pi150       <ret>
  1626.             ^ iSA= 0150
  1627.             >ix 10 10 00 00 00 33    <ret>
  1628.             >pm150       <ret>
  1629.             ^ mSA= 0150
  1630.             >m7          <ret>
  1631.             
  1632.             ^ 0150 : 10  10 00 00 00 33 00 00   .....3..
  1633.             
  1634.             ! The multiplier 0x1010 is stored into $150,$151
  1635.             ! while the multiplicand 0x33 is stored into $154,$155.
  1636.             
  1637.             >ps100       <ret>
  1638.             
  1639.             ^ C6  10             LDAB    #$10
  1640.             ^ A=00 B=00 X=0000 SP=0000 ST=C0 PC=0100
  1641.             ^ C=0 V=0 Z=0 N=0 I=0 H=0
  1642.             
  1643.             >sg          <ret>
  1644.             
  1645.  
  1646.  
  1647.  
  1648.  
  1649.  
  1650.  
  1651.  
  1652.  
  1653.  
  1654.                                                                         26
  1655.  
  1656.  
  1657.             ^ 0132 : 00                 ???
  1658.             ^ A=19 B=00 X=0000 SP=0000 ST=C4 PC=0132
  1659.             ^ C=0 V=0 Z=1 N=0 I=0 H=0
  1660.             
  1661.             >m7          <ret>
  1662.             
  1663.             ^ 0150 : 10  10 00 03 33 30 00 00   ....30..
  1664.             
  1665.             ! The result of the multiplication, 0x00033330, is stored
  1666.             ! at locations $152, $153, $154 and $155.
  1667.             
  1668.             ! The files 6502ml.sim, 8085ml.sim and z80ml.sim contain
  1669.             ! subroutines which work the same way as 6800ml.sim.
  1670.             
  1671.             
  1672.             Example 3.
  1673.             Use the batch file 8085bd.sim to practice the break function
  1674.             of the UMPS package. The file 8085bd.sim contains a
  1675.             subroutine which will change your binary data starting from
  1676.             0700H into binary coded decimal (BCD) data starting from
  1677.             0708H.
  1678.             
  1679.             >fb 8085bd.sim   <ret>
  1680.             
  1681.             ^ Rule file 8085.rul is O.K.
  1682.             ^aSA= 1000
  1683.             ^ 1000 : AF                  XRA     A
  1684.             ^ 1001 : 43                  MOV     B,E
  1685.             ^ 1002 : 21  08 07           LXI     H,0708H
  1686.             ^ 1005 : 77                  MOV     M,A
  1687.             ^ 1006 : 23                  INX     H
  1688.             ^ 1007 : 05                  DCR     B
  1689.             ^ 1008 : C2  05 10           JNZ     1005H
  1690.             ^ 100B : 7A                  MOV     A,D
  1691.             ^ 100C : 87                  ADD     A
  1692.             ^ 100D : 87                  ADD     A
  1693.             ^ 100E : 87                  ADD     A
  1694.             ^ 100F : 4F                  MOV     C,A
  1695.             ^ 1010 : 2E  00              MVI     L,00H
  1696.             ^ 1012 : 42                  MOV     B,D
  1697.             ^ 1013 : 7E                  MOV     A,M
  1698.             ^ 1014 : 17                  RAL
  1699.             ^ 1015 : 77                  MOV     M,A
  1700.             ^ 1016 : 23                  INX     H
  1701.             ^ 1017 : 05                  DCR     B
  1702.             ^ 1018 : C2  13 10           JNZ     1013H
  1703.             ^ 101B : 2E  08              MVI     L,08H
  1704.             ^ 101D : 43                  MOV     B,E
  1705.             ^ 101E : 7E                  MOV     A,M
  1706.             ^ 101F : 8F                  ADC     A
  1707.             ^ 1020 : 27                  DAA
  1708.             ^ 1021 : 77                  MOV     M,A
  1709.             ^ 1022 : 23                  INX     H
  1710.             ^ 1023 : 05                  DCR     B
  1711.  
  1712.  
  1713.  
  1714.  
  1715.  
  1716.  
  1717.  
  1718.  
  1719.  
  1720.                                                                         27
  1721.  
  1722.  
  1723.             ^ 1024 : C2  1E 10           JNZ     101EH
  1724.             ^ 1027 : 0D                  DCR     C
  1725.             ^ 1028 : C2  10 10           JNZ     1010H
  1726.             ^ 102B : 18                  STP
  1727.             
  1728.             ! The 8085bd.sim file is stored into locations
  1729.             ! 1000H to 102BH.
  1730.             
  1731.             ! At the beginning of the program, the number of bytes for
  1732.             ! both binary data and BCD data needs to be loaded into
  1733.             ! D and E registers respectively.
  1734.             ! Set D=2, E=3.
  1735.             
  1736.             >rxd,2     <ret>
  1737.             >rxe,3     <ret>
  1738.             >rp        <ret>
  1739.             
  1740.             ^ A=00 B=00 C=00 D=02 E=03 H=00 L=00 SP=0000 PSW=22
  1741.             ^ PC=0000
  1742.             ^ CY=0 P=0 AC=0 Z=0 S=0
  1743.             
  1744.             ! Store the binary data 1100 1101 (CD) into 0700H.
  1745.             
  1746.             >pi0700    <ret>
  1747.             ^ iSA= 0700
  1748.             >ix cd     <ret>
  1749.             >pm0700
  1750.             ^ mSA= 0700
  1751.             >m8        <ret>
  1752.             
  1753.             ^ 0700 : CD  00 00 00 00 00 00 00   M.......
  1754.             ^ 0708 : 00  00 00 00 00 00 00 00   ........
  1755.             
  1756.             ! There is a loop beginning at 1010H.
  1757.             ! If C register (detected at 1028H) is not set to zero
  1758.             ! there will be a jump to 1010H.
  1759.             
  1760.             ! Let's set a break point at 1028.
  1761.             
  1762.             >bp1028     <ret>
  1763.             >bl        <ret>
  1764.             
  1765.             ^ Break point :     1028
  1766.             
  1767.             ! Let's execute the first loop and look at the result.
  1768.             
  1769.             >ps1000     <ret>
  1770.             
  1771.             ^ 1000 : AF                 XRA     A
  1772.             ^ A=00 B=00 C=00 D=02 E=03 H=00 L=00 SP=0000 PSW=22
  1773.             ^ PC=1000
  1774.             ^ CY=0 P=0 AC=0 Z=0 S=0
  1775.             
  1776.             >sg         <ret>
  1777.  
  1778.  
  1779.  
  1780.  
  1781.  
  1782.  
  1783.  
  1784.  
  1785.  
  1786.                                                                         28
  1787.  
  1788.  
  1789.             
  1790.             ^ 1010 : 2E  00            MVI       L,00H
  1791.             ^ A=00 B=00 C=0F D=02 E=03 H=07 L=0B SP=0000 PSW=26
  1792.             ^ PC=1010
  1793.             ^ CY=0 P=1 AC=0 Z=0 S=0
  1794.             
  1795.             >m8         <ret>
  1796.             
  1797.             ^ 0700 : 9A  01 00 00 00 00 00 00   ........
  1798.             ^ 0708 : 00  00 00 00 00 00 00 00   ........
  1799.             
  1800.             ! After the first loop C=0F.
  1801.             ! At 0700H, "CD" (1100 1101) rotated left through carry
  1802.             ! and became "9A" (1001 1010).
  1803.             ! At 0701H, "00" rotated left through carry and became "01".
  1804.             
  1805.             >sg          <ret>
  1806.             
  1807.             ^ 1010 : 2E  00            MVI       L,00H
  1808.             ^ A=00 B=00 C=0E D=02 E=03 H=07 L=0B SP=0000 PSW=32
  1809.             ^ PC=1010
  1810.             ^ CY=0 P=0 AC=1 Z=0 S=0
  1811.             
  1812.             >m8          <ret>
  1813.             
  1814.             ^ 0700 : 34  03 00 00 00 00 00 00   4.......
  1815.             ^ 0708 : 00  00 00 00 00 00 00 00   ........
  1816.             
  1817.             ! After the second loop C=0E.
  1818.             ! At 0700H, "9A" rotated left through carry and became "34".
  1819.             ! At 0701H, "01" rotated left through carry and became "03".
  1820.             
  1821.             ! You already have seen what each loop does.
  1822.             ! To see the result from the rest of the loops,
  1823.             ! just remove the break point at 1028H.
  1824.             
  1825.             >be1028      <ret>
  1826.             >bl          <ret>
  1827.             
  1828.             ^ Break point : None
  1829.             
  1830.             >sg          <ret>
  1831.             
  1832.             ^ 102C : 00           NOP
  1833.             ^ A=00 B=00 C=00 D=02 E=03 H=07 L=0B SP=0000 PSW=76
  1834.             ^ PC=102C
  1835.             ^ CY=0 P=1 AC=1 Z=1 S=0
  1836.             
  1837.             >m8          <ret>
  1838.             
  1839.             ^ 0700 : 00  00 00 00 00 00 00 00   ........
  1840.             ^ 0708 : 05  02 00 00 00 00 00 00   ........
  1841.             
  1842.             ! The binary data "CD" stored at 0700H has been changed
  1843.  
  1844.  
  1845.  
  1846.  
  1847.  
  1848.  
  1849.  
  1850.  
  1851.  
  1852.                                                                         29
  1853.  
  1854.  
  1855.             ! to BCD "0205" and stored into 0709H and 0708H.
  1856.             
  1857.             ! To see what the BCD value is for the biggest
  1858.             ! four bytes of binary data "FF FF FF FF",
  1859.             ! enter the following:
  1860.             
  1861.             >rxd,4      <ret>
  1862.             >rxe,5      <ret>
  1863.             >rp         <ret>
  1864.             
  1865.             ^ A=00 B=00 C=00 D=04 E=05 H=07 L=0B SP=0000 PSW=76
  1866.             ^ PC=102C
  1867.             ^ CY=0 P=1 AC=1 Z=1 S=0
  1868.             
  1869.             >pi0700           <ret>
  1870.             ^ iSA= 0700
  1871.             >ix FF FF FF FF   <ret>
  1872.             >m8               <ret>
  1873.             
  1874.             ^ 0700 : FF  FF FF FF 00 00 00 00   ....
  1875.             ^ 0708 : 05  02 00 00 00 00 00 00   ........
  1876.             
  1877.             >ps1000     <ret>
  1878.             
  1879.             ^ 1000 : AF           XRA A
  1880.             ^ A=00 B=00 C=00 D=04 E=05 H=07 L=0B SP=0000 PSW=76
  1881.             ^ PC=1000
  1882.             ^ CY=0 P=1 AC=1 Z=1 S=0
  1883.             
  1884.             >sg         <ret>
  1885.             
  1886.             ^ 102C : 00           NOP
  1887.             ^ A=42 B=00 C=00 D=04 E=05 H=07 L=0D SP=0000 PSW=76
  1888.             ^ PC=102C
  1889.             ^ CY=0 P=1 AC=1 Z=1 S=0
  1890.             
  1891.             >m8         <ret>
  1892.             
  1893.             ^ 0700 : 00  00 00 00 00 00 00 00   ........
  1894.             ^ 0708 : 95  72 96 94 42 00 00 00   .r..B...
  1895.             
  1896.             ! The binary data "FF FF FF FF" in locations
  1897.             ! 0703H to 0700H has been converted into BCD data
  1898.             ! "4,294,967,295" at locations 070CH to 0708H.
  1899.             
  1900.             ! The subroutines in files 6502bd.sim, 6800bd.sim and
  1901.             ! z80bd.sim all have the same function as the subroutine
  1902.             ! in 8085bd.sim.
  1903.             ! Initially, the number of bytes for the binary data and BCD
  1904.             ! data needs to be loaded into the D and E registers for the
  1905.             ! Z80 whereas for the 6502 and 6800 this information must be
  1906.             ! stored into locations $0710 and $0711.
  1907.             
  1908.             
  1909.  
  1910.  
  1911.  
  1912.  
  1913.  
  1914.  
  1915.  
  1916.  
  1917.  
  1918.                                                                         30
  1919.  
  1920.  
  1921.             Example 4.
  1922.             Use the z80 instruction "INDR" to write a series of data
  1923.             trains from the selected port 08H into the memory location
  1924.             starting from 1050H, 104FH.......
  1925.             
  1926.             >fc z80     <ret>
  1927.             
  1928.             ^ Rule file z80.rul is O.K.
  1929.             
  1930.             ! First let's take a look at memory locations 1020H to
  1931.             ! 1058H.
  1932.             
  1933.             >pm1020     <ret>
  1934.             ^ mSA= 1020
  1935.             >m32        <ret>
  1936.             
  1937.             ^ 1020 : 00  00 00 00 00 00 00 00   ........
  1938.             ^ 1028 : 00  00 00 00 00 00 00 00   ........
  1939.             ^ 1030 : 00  00 00 00 00 00 00 00   ........
  1940.             ^ 1038 : 00  00 00 00 00 00 00 00   ........
  1941.             ^ 1040 : 00  00 00 00 00 00 00 00   ........
  1942.             ^ 1048 : 00  00 00 00 00 00 00 00   ........
  1943.             ^ 1050 : 00  00 00 00 00 00 00 00   ........
  1944.             
  1945.             ! Input the instruction "INDR", beginning at 1000H.
  1946.             
  1947.             >pa1000     <ret>
  1948.             ^ aSA= 1000
  1949.             
  1950.             >a INDR     <ret>
  1951.             
  1952.             ^ 1000 : ED  BA                       INDR
  1953.             
  1954.             >a STP    <ret>
  1955.             
  1956.             ^ 1002 : DD  01                       STP
  1957.             
  1958.             ! The selected I/O port address 08H will be stored in C
  1959.             ! register while the starting destination address 1050H
  1960.             ! will be stored in register pair HL. A counter 28H for
  1961.             ! B register will be decremented for each step. The
  1962.             ! instruction will be terminated when the value of B
  1963.             ! register reaches zero.
  1964.             
  1965.             >rx         <ret>
  1966.             
  1967.             ^ A=00          <ret>
  1968.             ^ B=00 28       <ret>
  1969.             ^ C=00 08       <ret>
  1970.             ^ D=00          <ret>
  1971.             ^ E=00          <ret>
  1972.             ^ H=00 10       <ret>
  1973.             ^ L=00 50       <ret>
  1974.             ^ IX=0000 q     <ret>
  1975.  
  1976.  
  1977.  
  1978.  
  1979.  
  1980.  
  1981.  
  1982.  
  1983.  
  1984.                                                                         31
  1985.  
  1986.  
  1987.             
  1988.             ! The second number will become the new value for each
  1989.             ! register. The command "rxB,28" can also change B register
  1990.             ! to the same value.
  1991.             
  1992.             >xm 08 L06 N11 N22 N33 N44 E00 N55 N66 N77 N88 S99 <ret>
  1993.             
  1994.             ! The data train input command "xm" will introduce a series
  1995.             ! of data into the I/O port 08H byte by byte. This series of
  1996.             ! data will begin with 11H, followed by 22H, 33H, and 44H.
  1997.             ! This first set of numbers "11H, 22H, 33H, 44H" will be
  1998.             ! repeated five more times. After that, numbers 55H, 66H,
  1999.             ! 77H and 88H will appear. The last data "s99" makes the
  2000.             ! last value stay at 99H.
  2001.             
  2002.             >ps1000    <ret>
  2003.             
  2004.             ^ 1000 : ED  BA             INDR
  2005.             ^ A=00 B=28 C=08 D=00 E=00 H=10 L=50 IX=0000 IY=0000
  2006.             ^ I=00 SP=0000 PSW=28 PC=1000
  2007.             ^ C=0 N=0 PV=0 H=0 Z=0 S=0
  2008.             
  2009.             >s         <ret>
  2010.             
  2011.             ^ 1000 : ED  BA             INDR
  2012.             ^ A=00 B=27 C=08 D=00 E=00 H=10 L=4F IX=0000 IY=0000
  2013.             ^ I=00 SP=0000 PSW=EE PC=1000
  2014.             ^ C=0 N=1 PV=1 H=0 Z=1 S=1
  2015.             
  2016.             >m32       <ret>
  2017.             
  2018.             ^ 1020 : 00  00 00 00 00 00 00 00   ........
  2019.             ^ 1028 : 00  00 00 00 00 00 00 00   ........
  2020.             ^ 1030 : 00  00 00 00 00 00 00 00   ........
  2021.             ^ 1038 : 00  00 00 00 00 00 00 00   ........
  2022.             ^ 1040 : 00  00 00 00 00 00 00 00   ........
  2023.             ^ 1048 : 00  00 00 00 00 00 00 00   ........
  2024.             ^ 1050 : 11  00 00 00 00 00 00 00   ........
  2025.             
  2026.             ! After executing one step, B changed to 27 and HL changed
  2027.             ! to 104F. The first number in the data train, 11H, was
  2028.             ! stored in 1050H.
  2029.             
  2030.             >s       <ret>
  2031.             
  2032.             ^ 1000 : ED  BA             INDR
  2033.             ^ A=00 B=26 C=08 D=00 E=00 H=10 L=4E IX=0000 IY=0000
  2034.             ^ I=00 SP=0000 PSW=EE PC=1000
  2035.             ^ C=0 N=1 PV=1 H=0 Z=1 S=1
  2036.             
  2037.             >m32     <ret>
  2038.             
  2039.             ^ 1020 : 00  00 00 00 00 00 00 00   ........
  2040.             ^ 1028 : 00  00 00 00 00 00 00 00   ........
  2041.  
  2042.  
  2043.  
  2044.  
  2045.  
  2046.  
  2047.  
  2048.  
  2049.  
  2050.                                                                         32
  2051.  
  2052.  
  2053.             ^ 1030 : 00  00 00 00 00 00 00 00   ........
  2054.             ^ 1038 : 00  00 00 00 00 00 00 00   ........
  2055.             ^ 1040 : 00  00 00 00 00 00 00 00   ........
  2056.             ^ 1048 : 00  00 00 00 00 00 00 22   ......."
  2057.             ^ 1050 : 11  00 00 00 00 00 00 00   ........
  2058.             
  2059.             ! The next step of execution decremented B and HL again, and
  2060.             ! stored the second value in the data train, 22H, into
  2061.             ! location 104FH.
  2062.             
  2063.             >s        <ret>
  2064.             
  2065.             ^ 1000 : ED  BA             INDR
  2066.             ^ A=00 B=25 C=08 D=00 E=00 H=10 L=4D IX=0000 IY=0000
  2067.             ^ I=00 SP=0000 PSW=EE PC=1000
  2068.             ^ C=0 N=1 PV=1 H=0 Z=1 S=1
  2069.             
  2070.             >m32      <ret>
  2071.             
  2072.             ^ 1020 : 00  00 00 00 00 00 00 00   ........
  2073.             ^ 1028 : 00  00 00 00 00 00 00 00   ........
  2074.             ^ 1030 : 00  00 00 00 00 00 00 00   ........
  2075.             ^ 1038 : 00  00 00 00 00 00 00 00   ........
  2076.             ^ 1040 : 00  00 00 00 00 00 00 00   ........
  2077.             ^ 1048 : 00  00 00 00 00 00 33 22   ......3"
  2078.             ^ 1050 : 11  00 00 00 00 00 00 00   ........
  2079.             
  2080.             >sg      <ret>
  2081.             
  2082.             ^ 1004 : 00                 NOP
  2083.             ^ A=00 B=00 C=08 D=00 E=00 H=10 L=28 IX=0000 IY=0000
  2084.             ^ I=00 SP=0000 PSW=EA PC=1004
  2085.             ^ C=0 N=1 PV=0 H=0 Z=1 S=1
  2086.             
  2087.             >m32     <ret>
  2088.             
  2089.             ^ 1020 : 00  00 00 00 00 00 00 00   ........
  2090.             ^ 1028 : 00  99 99 99 99 99 99 99   ........
  2091.             ^ 1030 : 99  99 99 99 99 88 77 66   ......wf
  2092.             ^ 1038 : 55  44 33 22 11 44 33 22   UD3".D3"
  2093.             ^ 1040 : 11  44 33 22 11 44 33 22   .D3".D3"
  2094.             ^ 1048 : 11  44 33 22 11 44 33 22   .D3".D3"
  2095.             ^ 1050 : 11  00 00 00 00 00 00 00   ........
  2096.             
  2097.             ! The display above shows how the instruction "INDR" stored
  2098.             ! the sequence of data available at the I/O port 08H into
  2099.             ! memory locations 1029H to 1050H. You can also see that
  2100.             ! when the value of B becomes 0, HL becomes 1028H.
  2101.             
  2102.             
  2103.             
  2104.             
  2105.             
  2106.             
  2107.  
  2108.  
  2109.  
  2110.  
  2111.  
  2112.  
  2113.  
  2114.  
  2115.  
  2116.                                                                         33
  2117.  
  2118.  
  2119.             5.1 Summary of commands for UMPS 1.1            5.1 Summary of commands for UMPS 1.1
  2120.             
  2121.             
  2122.             a text               -- Assemble one mini assembly
  2123.                                     instruction starting from aSA.
  2124.             
  2125.             ay                   -- Assemble a series of mini assembly
  2126.                                     instructions which follow
  2127.                                     (An "END" statement is always needed
  2128.                                     to exit from the "ay" and "an"
  2129.                                     commands).
  2130.             
  2131.             an                   -- Same as "ay", but no assembled
  2132.                                     machine code will be displayed.
  2133.             
  2134.             bc                   -- Clear all the break points.
  2135.             
  2136.             beN                  -- Erase break point N.
  2137.             
  2138.             bl                   -- List all the break points.
  2139.             
  2140.             bpN                  -- Set a break point at N.
  2141.             
  2142.             d                    -- Display one line of disassembled
  2143.                                     instruction, starting from dSA.
  2144.             
  2145.             dN                   -- Display N lines of disassembled
  2146.                                     instruction, starting from dSA.
  2147.             
  2148.             fa                   -- Toggle to open/close file Temp.text.
  2149.             
  2150.             fa text_file         -- Toggle to open/close text_file.
  2151.             
  2152.             fb batch_file        -- load the batch file batch_file.
  2153.             
  2154.             fc MPU_file          -- Read in the processor's rule or
  2155.                                     speeding file.                   
  2156.             
  2157.             fr o B_file          -- Read the file named B_file into the
  2158.                                     default memory address.
  2159.             
  2160.             fr o B_file addr     -- Read the file named B_file into the
  2161.                                     specified memory address addr.
  2162.             
  2163.             fw o B_file addr len -- Write the machine codes starting at
  2164.                                     address addr with a total length of
  2165.                                     len to the file named B_file.
  2166.             
  2167.             fx string            -- Enable the use of the commands in
  2168.                                     PC-DOS environment.
  2169.             
  2170.             id N1..Nn            -- Input decimal numbers starting at
  2171.                                     iSA.
  2172.             
  2173.  
  2174.  
  2175.  
  2176.  
  2177.  
  2178.  
  2179.  
  2180.  
  2181.  
  2182.                                                                         34
  2183.  
  2184.  
  2185.             is text              -- Input ASCII text starting at iSA.
  2186.             
  2187.             ix N1..Nn            -- Input as many binary codes as
  2188.                                     desired, starting from iSA.
  2189.             
  2190.             m                    -- Display one line of memory,
  2191.                                     starting from mSA.
  2192.             
  2193.             mN                   -- Display N/8 lines of memory,
  2194.                                     starting from mSA.
  2195.             
  2196.             paN                  -- Set starting address to assemble the
  2197.                                     mini assembly syntax, aSA=N.
  2198.             
  2199.             pdN                  -- Set starting address at 1 (dSA=N)
  2200.                                     to disassemble the machine codes.
  2201.             
  2202.             piN                  -- Set starting address at N1 to input
  2203.                                     data, iSA=N.
  2204.             
  2205.             pmN                  -- Set starting address at N to
  2206.                                     display the data in memory, mSA=N.
  2207.             
  2208.             poN                  -- Map the CPU's I/O port addresses
  2209.                                     with the PC's I/O port addresses,
  2210.                                     beginning at N.
  2211.             
  2212.             poN1,N2              -- Map the CPU's memory beginning at N2
  2213.                                     (256 bytes) with the PC's I/O ports,
  2214.                                     beginning at N1.
  2215.             
  2216.             po                   -- Turn off the PC's I/O ports.
  2217.             
  2218.             pp                   -- Print all of the SA values.
  2219.             
  2220.             psN                  -- Set starting address at N for step
  2221.                                     and go, sSA=N.
  2222.             
  2223.             prN                  -- Print the contents of the PC's I/O
  2224.                                     port N on the terminal.
  2225.             
  2226.             puN                  -- Continuously display the contents of
  2227.                                     the PC's I/O port N.
  2228.             
  2229.             pwN1,N2              -- Write data N2 into the PC's I/O port
  2230.                                     N1
  2231.             
  2232.             pyN                  -- Continuously write data 0 to 0xFF
  2233.                                     into the PC's I/O port N.
  2234.             
  2235.             pzN                  -- Sequentially write the data into the
  2236.                                     I/O ports N to N+1F.
  2237.             
  2238.             qq                   -- Quit and exit from the UMPS11
  2239.  
  2240.  
  2241.  
  2242.  
  2243.  
  2244.  
  2245.  
  2246.  
  2247.  
  2248.                                                                         35
  2249.  
  2250.  
  2251.                                     program.
  2252.             
  2253.             qp                   -- Pause (press any key to continue).
  2254.             
  2255.             rf                   -- Input and display the values of the
  2256.                                     flags of the status register.
  2257.             
  2258.             rfSS,N               -- Set flag SS to value N.
  2259.             
  2260.             rp                   -- Display the values of all the
  2261.                                     processor's registers and flags.
  2262.             
  2263.             rx                   -- Input and display the contents of
  2264.                                     the registers of the microprocessor.
  2265.             
  2266.             rxSS,N               -- Set register SS to value N.
  2267.             
  2268.             s                    -- Execute one machine instruction.
  2269.             
  2270.             sn                   -- Execute one mini assembly syntax
  2271.                                     without going into any subroutines.
  2272.             
  2273.             sN                   -- Execute N machine instructions.
  2274.             
  2275.             snN                  -- Execute N steps without going into
  2276.                                     any subroutines.
  2277.             
  2278.             sg                   -- Start executing the program from sSA
  2279.                                     (Hit "/" key to stop the execution).
  2280.             
  2281.             te                   -- Toggle the flag to echo the command
  2282.                                     line.
  2283.             
  2284.             tf                   -- Toggle the flag to fix SA.
  2285.             
  2286.             ti                   -- Set software interrupt.
  2287.             
  2288.             tm                   -- Toggle the flag to trace memory's
  2289.                                     read/write.
  2290.             
  2291.             tn                   -- Set nmi interrupt.
  2292.             
  2293.             tr                   -- Reset interrupt.
  2294.             
  2295.             xc                   -- Close the data train input.
  2296.             
  2297.             xi addr LNN....LNN   -- Set a special I/O port at addr by
  2298.                                     a data train in the format of a
  2299.                                     series of LNN.
  2300.             
  2301.             xm addr LNN....LNN   -- Set a special memory port at addr
  2302.                                     by a data train formated by a series
  2303.                                     of LNN.
  2304.             
  2305.  
  2306.  
  2307.  
  2308.  
  2309.  
  2310.  
  2311.  
  2312.  
  2313.  
  2314.                                                                         36
  2315.  
  2316.  
  2317.             
  2318.  
  2319.  
  2320.  
  2321.  
  2322.  
  2323.  
  2324.  
  2325.  
  2326.  
  2327.  
  2328.  
  2329.  
  2330.  
  2331.  
  2332.  
  2333.  
  2334.  
  2335.  
  2336.  
  2337.  
  2338.  
  2339.  
  2340.  
  2341.  
  2342.  
  2343.  
  2344.  
  2345.  
  2346.  
  2347.  
  2348.  
  2349.  
  2350.  
  2351.  
  2352.  
  2353.  
  2354.  
  2355.  
  2356.  
  2357.  
  2358.  
  2359.  
  2360.  
  2361.  
  2362.  
  2363.  
  2364.  
  2365.  
  2366.  
  2367.  
  2368.  
  2369.  
  2370.  
  2371.  
  2372.  
  2373.  
  2374.  
  2375.  
  2376.  
  2377.