home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / ENTERPRS / CPM / UTILS / S / Z80MU310.ZIP / Z80MU.DOC < prev    next >
Text File  |  1992-07-01  |  188KB  |  5,720 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.                  "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide
  7.  
  8.                                        or
  9.  
  10.                    The Care and Feeding of Your Imaginary Z80
  11.  
  12.                                        or
  13.  
  14.                          Fakeware For The Techie Masses!
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.                       A Guide to the Complete Z80 Emulator
  23.  
  24.                          Z80MU.EXE version 3.10  3/14/86
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.      This document describes Z80MU, a software emulation of the Z80 and CP/M
  39.      2.2. The program was written by Joan Riff for Computerwise Consulting
  40.      Services.
  41.  
  42.      Placed in the public domain. No copyright notice. No legal mumbo-jumbo.
  43.      No request for a financial contribution. No warrantee. Just a bunch of
  44.      marvelous software magic.
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  54.  
  55.     "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 1
  56.  
  57.                                   INTRODUCTION
  58.  
  59.      What is it?      __________
  60.      Z80MU is a software emulator of the ZILOG Z80 processor, which runs on
  61.      the IBM PC. It also provides an emulation of Digital Research's CP/M
  62.      version 2.2 operating system.
  63.  
  64.  
  65.      It includes the following facilities:
  66.           Complete emulation of Z80 object code, including all six
  67.                active bits within the Z80 Flags Register.
  68.           Emulation of CP/M 2.2, with the exception of hardware-specific
  69.                functions.
  70.           Advanced commands for debugging Z80 software (eliminating the
  71.                need for DDT.COM), including:
  72.                Illegal Opcode control (treat 'em as FAULTs or NOPs).
  73.                BDOS function trace.
  74.                Instruction TRACE and NOTRACE, with Z80 PC traceback.
  75.                Breakpoints.
  76.                Dump CP/M memory in HEX and ASCII.
  77.                Patch CP/M memory in HEX, decimal, binary, ASCII charac-
  78.                ters, or ASCII strings. 
  79.                Symbolic labels may be defined and used instead of CP/M
  80.                 addresses.
  81.  
  82.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  83.  
  84.     "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide Page 2
  85.      INTRODUCTION
  86.  
  87.                Z80 register and flag display and alter, including
  88.                     alternate regs/flags and IFF1, IFF2, IMF, I, R regs.
  89.                CP/M memory move and find. 
  90.                Intel HEX files can be properly read into CP/M memory,
  91.                     as well as created from CP/M memory. 
  92.           An "emulated VT52 terminal" for full-screen CP/M applications.
  93.           A full disassembler much like Ward Christensen's RESOURCE,
  94.                built right in, with: 
  95.                Symbolic addresses. 
  96.                Control breakpoints for Instructions, Bytes (DB), Words
  97.                     (DW), Table of Words (DW), and Storage (DS). 
  98.                Automatic label generation. 
  99.                Comments associated with Z80 addresses.
  100.           Online help summaries. 
  101.           Limited SUBMIT file support (built right in - no need for
  102.                SUBMIT.COM).
  103.           Access to all PCDOS programs and commands. 
  104.           CP/M software reads and writes PCDOS files, and can be
  105.                organized with the PCDOS directory structure (instead of
  106.                using CP/M's "user number" idea). 
  107.  
  108.      Z80MU (from now on called "the Emulator") can be used quite transpar-
  109.      ently to run CP/M applications on the IBM PC. It contains many advanced
  110.      commands not found in CP/M, but there's no law that says that you have
  111.      to use 'em all. By ignoring the advanced commands, you can run the
  112.      emulated CP/M all day long and you'll swear that you're running CP/M. 
  113.  
  114.      You can also take advantage of the advanced commands and features, and
  115.      have a user interface more powerful than that available with CP/M. 
  116.  
  117.      Advanced Z80 programmers can even ignore CP/M entirely and use the
  118.      Emulator as a generic Z80 development tool for developing device
  119.      controllers and other non-CP/M based Z80 code.
  120.  
  121.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  122.  
  123.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 3
  124.      INTRODUCTION
  125.  
  126.      At CCS, we use the Emulator to develop things like Z80-based hard disk
  127.      controller card software, device-switching hardware, and even a few
  128.      boring old standard CP/M applications. We have also used it to regen-
  129.      erate the source code for the 32K ROM in the Radio Shack Model 100
  130.      laptop computer, to figure out how it works.
  131.  
  132.      The Emulator consists of a high-speed 8088 assembler subroutine (which
  133.      does the actual Z80 emulation), and a 'C'-language main program which
  134.      provides the CP/M-like interface to the user, the disassembler, the
  135.      RESOURCE facility, and the rest of the advanced features. 
  136.  
  137.      Why Did We Do It?     _________________
  138.  
  139.      At CCS, we have quite an investment in CP/M software. Most of that
  140.      software consists of fairly esoteric software development tools, things
  141.      that are hard to find in the IBM PC world. Furthermore, we continue to
  142.      develop software for the Z80. The old chip just won't die, although
  143.      nowadays it is used more in controller boards than as a primary system
  144.      processor.
  145.  
  146.      We wanted to keep these Z80 tools, yet apply our numerous IBM PC tools
  147.      (especially some fantastic IBM PC editors) to our Z80 development
  148.      process.
  149.  
  150.      We were also keenly interested in creating source code for some object-
  151.      only Z80 applications, with a view to converting them to 8088 assembler
  152.      source code for re-assembly as native IBM PC programs.
  153.  
  154.      We scouted around and discovered several software packages which sup-
  155.      posedly allowed us to run CP/M programs on the IBM PC. Needless to say,
  156.      they just couldn't cut it. The Heath User's Group (HUG) emulator, 80Mate
  157.      by Vertex, and a host of similar packages (both public domain and
  158.      commercial) were considered. There were many things that we were looking
  159.      for, and every currently-available product flunked one or more tests:
  160.  
  161.           Speed of emulation: some packages performed the actual Z80      
  162.           emulation much slower than theoretical calculations said that
  163.           they should have.
  164.  
  165.           Accuracy of the Emulation: many packages ignored one or more
  166.           of the Z80 flag bits, especially the all-important overflow
  167.           flag. And no available package accurately emulated CP/M's
  168.           BDOS function calls. Most seemed to simply translate CP/M
  169.           BDOS functions into their PCDOS equivalents, without allowing
  170.           for the many differences in operation between the similar
  171.           (but not identical) operating system calls.
  172.  
  173.  
  174.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  175.  
  176.  
  177.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 4
  178.      INTRODUCTION
  179.  
  180.           User Interface: some packages didn't even try to provide a 
  181.           user environment that looked like CP/M's CCP. Some, in fact,
  182.           made you re-run their emulator with each CP/M program that you
  183.           wanted to run.
  184.  
  185.           Special headers 'bound' to programs: some packages required 
  186.           you to 'bind' a special header to the front of every CP/M
  187.           .COM file that you wanted to run, and then made you run that
  188.           program straight from PCDOS.
  189.  
  190.           Debug support and environment control: most of the packages 
  191.           assumed that you would use DDT for whatever debugging needed
  192.           to be done. They had nothing built in. And no package provided
  193.           a proper interface to PCDOS commands or to the PCDOS environ-
  194.           ment.
  195.  
  196.      Since we couldn't trust our software to any available Z80 emulators, we
  197.      started thinking about developing our own. What's more, we kept bumping
  198.      into folks who were in the business of Z80 development, and who kept
  199.      badgering us to solve this problem "the right way" (whatever that
  200.      means).
  201.  
  202.      At first, we were skeptical. On the surface, it appeared that a truly
  203.      accurate software emulation of the Z80 would run "hundreds" of times
  204.      slower on an IBM PC than on a real Z80. But then Joan Riff got involved,
  205.      and started playing around with register assignments and a memory model
  206.      that "just might work." By keeping images of most of the Z80 registers
  207.      in 8088 registers (as opposed to memory), and by very careful main-
  208.      tenance of the Z80's flags, Joan was able to hand-code a low-level Z80
  209.      emulator which as far as we can tell is 100% accurate, and only four
  210.      times slower than a 1 Mhz Z80.
  211.  
  212.      To this basic emulator we added the user interface (written in Lattice
  213.      C) which did all of the control and debug operations that we needed.
  214.  
  215.      After six man-months of work, we had our Emulator. 
  216.  
  217.  
  218.  
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  231.  
  232.  
  233.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 5
  234.      INTRODUCTION
  235.  
  236.  
  237.      How Does It Work?     _________________
  238.       
  239.      When it runs under PCDOS, the Emulator looks like this: 
  240.       
  241.           +------------------------------------+ 
  242.           | Z80MU 'C' main program             |            
  243.           |                                    | 
  244.           | This is what you talk to, the guy  | 
  245.           | that emulates CP/M Console Command | 
  246.           | Processor.                         | 
  247.           |                                    | 
  248.           +------------------------------------+ 
  249.           | Z80 Emulation 8088 Assembler Code  |            
  250.           |                                    | 
  251.           | Which actually emulates the Z80 as | 
  252.           | it "executes" in the CP/M Segment. | 
  253.           |                                    | 
  254.           +------------------------------------+ 
  255.           | 64K CP/M Segment                   |            
  256.           |                                    | 
  257.           | In which the Z80 code is held as   | 
  258.           | it executes. The size of the       | 
  259.           | Transient Program Area is 65022    | 
  260.           | bytes.                             | 
  261.           |                                    | 
  262.           |                                    | 
  263.           |                                    | 
  264.           |                                    | 
  265.           |                                    | 
  266.           |                                    | 
  267.           |                                    | 
  268.           | - - - - - - - - - - - - - - - - - -| 
  269.           | BDOS and BIOS hooks                |            
  270.           |                                    |
  271.           | Which trap CP/M BIOS and BDOS      | 
  272.           | calls, so that they can be         |
  273.           | emulated.                          |
  274.           |                                    |
  275.           +------------------------------------+ 
  276.       
  277.  
  278.      The main program accepts the user's commands, and processes them. When
  279.      and if it comes time to run a Z80 program, the Z80 code is loaded into
  280.      the CP/M Segment, and the 8088 assembler code which actually emulates
  281.      the Z80 is called to run the program there.
  282.  
  283.      As the Z80 program executes, it accesses the outside world via calls to
  284.      the BDOS and BIOS hooks. The code that is executed for a given BDOS or
  285.  
  286.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  287.  
  288.  
  289.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 6
  290.      INTRODUCTION
  291.  
  292.      BIOS function actually resides within the 8088 assembler code that
  293.      emulates the Z80.
  294.       
  295.       
  296.      What Does It Require To Run?      ____________________________
  297.       
  298.      The Emulator runs on the IBM PC under PCDOS 2.x or above. The first
  299.      thing that it does when it runs is allocate 64K to be used as CP/M
  300.      memory (the "CP/M Segment"). Additionally, the various RESOURCE commands
  301.      dynamically allocate memory for labels and comments. A safe rule to use
  302.      is to allow an extra 64K for a large RESOURCE control table.
  303.  
  304.      In short, if a CHKDSK of your system shows at least 256K free memory
  305.      bytes, then you have enough room to run the Emulator.
  306.       
  307.       
  308.       
  309.      How Accurate an Emulation Is It?      ________________________________
  310.       
  311.      There are two aspects to the accuracy of the Emulator: 
  312.       
  313.           1) How accurately it emulates the Z80 
  314.           2) How accurately it emulates CP/M 2.2
  315.       
  316.      The Emulator emulates the Z80 almost perfectly, even down to an exact
  317.      emulation of all six flag bits in the Flags Register. Even the untest-
  318.      able Half-carry and Add/Subtract flag bits are emulated. For faster
  319.      execution, the Emulator ignores the two unused bits in the Flags
  320.      Register, so these will not act exactly as they would on a real Z80.
  321.  
  322.      Input/Output instructions (the IN's and OUT's) perform everything except
  323.      the actual strobe of the I/O data lines. You can't very well have Z80
  324.      code accessing I/O addresses that mean something entirely different on
  325.      the IBM PC. So the actual data transfer has been disabled. But any
  326.      setup, auto-increment of registers, and flag effects have been emulated
  327.      even for the IN's and OUT's. 
  328.       
  329.      The Z80 HALT instruction is used as a hook to return control to the main
  330.      'C' program, and as a call to the emulated CP/M BIOS and BDOS. 
  331.  
  332.      When it came to emulating CP/M 2.2, we took a less precise approach. We
  333.      weren't interested in emulating the limitations of CP/M. We wanted to
  334.      include many of the benefits of PCDOS. And we wanted to add many more
  335.      "builtin" commands than were available with CP/M. We also demanded the
  336.      largest possible TPA (Transient Program Area - the amount of memory
  337.      available to be used by a Z80 program). Yet we wanted to keep the
  338.      interface very close to CP/M's.
  339.       
  340.  
  341.  
  342.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  343.  
  344.  
  345.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 7
  346.      INTRODUCTION
  347.  
  348.      So we decided to support "standard" CP/M applications, ones that stood a
  349.      good chance of executing on a wide variety of CP/M systems and thus were
  350.      hardware independent. 
  351.       
  352.      This we have succeeded in doing. 
  353.       
  354.      The user interface is just like CP/M's, so that someone used to CP/M
  355.      will feel right at home. 
  356.       
  357.      The program interface (via the BIOS and BDOS) is exactly the same as
  358.      CP/M's. There are some BIOS and BDOS functions that are hardware-
  359.      specific, or expect diskettes to have the CP/M format. These are in
  360.      general not supported. The differences are explained in a later section.
  361.      A tremendous amount of work has gone into translating CP/M BDOS func-
  362.      tions into their PCDOS equivalents, and back again. Many folks assume
  363.      that a given BDOS function can be emulated simply by calling PCDOS with
  364.      the function in the 8088 AH register. This is not true. On the surface,
  365.      PCDOS functions are similar to CP/M BDOS functions. In fact, there are a
  366.      host of very small but very important differences, which are handled by
  367.      the emulated CP/M within the Emulator.
  368.       
  369.      The handling of commands and command arguments (the command "tail")
  370.      appears to the Z80 application exactly as it would on a real CP/M
  371.      system. The default FCB at 5Ch is formatted with the filename implied by
  372.      the first command-line argument, and the FCB at 6Ch with the second
  373.      argument. The byte at 80h is set to the number of characters in the
  374.      command tail, and is followed by an uppercase version of the command
  375.      tail as typed by the user.
  376.       
  377.      We have achieved a TPA size of 65022 bytes. This is more than is
  378.      available on almost all "real" CP/M systems, including the Baby Blue Z80
  379.      add-on board (for the IBM PC) from MicroLog. 
  380.       
  381.      We have also built a fake VT52 terminal into the Emulator, since
  382.      many CP/M applications (especially those doing full-screen editing)
  383.      assume that they are being run from a serial ASCII terminal.
  384.  
  385.      All in all, the compatability of the Emulator is so good that we have
  386.      been able to move all of our CP/M applications to the Emulator, and to
  387.      have them run perfectly (although a tad slow). 
  388.       
  389.      Here is a partial list of CP/M applications that we have tested with the
  390.      Emulator and found to run as they do on a "real" CP/M system: 
  391.       
  392.           ASM       LOAD      ED        DDT       DUMP
  393.           PIP       M80       L80       LIB       MBASIC 
  394.           LASM      MAC       dBase II 
  395.  
  396.           WORDSTAR 3.0 & 3.3 with MAILMERGE (but not SPELSTAR!) 
  397.  
  398.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  399.  
  400.  
  401.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 8
  402.      INTRODUCTION
  403.  
  404.           PMATE-80 rev. 3.02 
  405.           Software Toolworks 'C' compiler
  406.           Telecon 'C' compiler
  407.           Chang Labs' MemoPlan 
  408.           LU version 3.00
  409.           S-BASIC Basic compiler v5.4b
  410.           Target PlannerCalc spreadsheet
  411.  
  412.  
  413.  
  414.      This is more a list of the software that we happened to have on hand
  415.      than an exhaustive list of software that will run under the Emulator.
  416.  
  417.  
  418.      What WON'T Run Under the Emulator?     __________________________________
  419.  
  420.      There are some CP/M programs (like STAT.COM provided by Digital Re-
  421.      search) which are hardware-specific. These cannot be run under the
  422.      Emulator, or must be run "carefully" to avoid functions that look to the
  423.      hardware. STAT, for instance, starts out by interrogating the physical
  424.      layout of the diskette, and interpreting it as if it were formatted for
  425.      CP/M. Since PCDOS disks aren't in CP/M format, this makes no sense. So
  426.      this is unsupported under the Emulator, and STAT is immediately aborted
  427.      by the Emulator. 
  428.  
  429.      WORDSTAR's SPELSTAR won't work, either. It tries to call CP/M's Console
  430.      Command Processor (CCP) within the 64K CP/M segment. In the Emulator,
  431.      however, there is no CCP in the CP/M segment. It's really quite sad. 
  432.      SPELSTAR goes to a lot of work to calculate just where in Z80 memory the
  433.      CCP is located, relative to the BDOS address held in location 0005h.
  434.      Then it calls that address. Unfortunately, there's nothing there...
  435.  
  436.      There are some CP/M programs which look too closely at the "reserved"
  437.      fields of the FCB. These may have trouble. We have seen some products
  438.      written by Microsoft which do this. They are thus highly release-
  439.      dependent, and thus ought not to be emulatable at all. We have, however,
  440.      added special code to the Emulator which keeps FCB+14 and FCB+15
  441.      somewhat sensible, and that seems to have allowed these Microsoft
  442.      programs to work.
  443.  
  444.       
  445.       
  446.      How Fast Is It?      _______________
  447.       
  448.      Aye, there's the rub. 
  449.       
  450.      Because the Z80 used by the Emulator is an imaginary one whose instruc-
  451.      tions must be emulated in software, the effective speed of a Z80 program
  452.      is considerably less than the speed of the IBM PC. One 12-cycle Z80
  453.  
  454.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  455.  
  456.  
  457.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 9
  458.      INTRODUCTION
  459.  
  460.      instruction, for example, may take from 47 to over 100 IBM PC cycles
  461.      (depending on the instruction, its addressing mode, etc). 
  462.       
  463.      For detail on the effective speed of the emulated Z80 and what it means,
  464.      see the description of the "speed?" and "howfast?" Builtin Commands 
  465.      later in this Guide. 
  466.       
  467.      We have not found the speed of the emulated Z80 to be entirely accept-
  468.      able. Z80MU is the fastest software-based accurate Z80 emulator that
  469.      we've seen for the IBM PC. Yet we would like to have something that
  470.      would run the standard CP/M utilities on an IBM PC at an effective cpu
  471.      speed of at least 1 MegaHertz, and still have all of the subtleties
  472.      (like flag updating) performed with 100% accuracy. 
  473.       
  474.      The solution is to run the Emulator on an IBM PC/AT, Compaq DeskPro
  475.      286, or similarly speedy CPU.
  476.       
  477.  
  478.  
  479.       
  480.      How Do I Get My CP/M Programs Into The IBM PC?     
  481.       ______________________________________________
  482.       
  483.      Assuming that you want to emulate some CP/M applications on the IBM PC,
  484.      the first realization is that these CP/M files don't already reside on
  485.      the PC. What's more, they currently exist (by definition) on disks
  486.      formatted for CP/M, not for the IBM PC. So they can't be read by a
  487.      vanilla IBM PC using PCDOS. They must be copied to standard PCDOS disk
  488.      files. 
  489.       
  490.      We have used several approaches, all with excellent results. 
  491.       
  492.      The first approach is to transfer the CP/M files straight from the CP/M
  493.      disks to PCDOS disks using a utility that runs on the IBM PC and is
  494.      capable of reading the foreign CP/M format. Such utilities include:
  495.       
  496.           CONVERT  (from Selfware, Inc.  Fairfax, VA)
  497.           XENOCOPY (from Vertex Systems, Inc.  L.A., Calif)
  498.       
  499.  
  500.      This approach is nice, when it works. The major disadvantages are:
  501.  
  502.           Only certain CP/M formats are recognized by each of these
  503.                utilities. Apple ][ and NorthStar Horizon CP/M disks, for
  504.                example, cannot be read on the IBM PC without special
  505.                hardware.
  506.  
  507.           You must have the CP/M disks at hand. 
  508.       
  509.  
  510.  
  511.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  512.  
  513.  
  514.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 10
  515.      INTRODUCTION
  516.  
  517.      Another approach is to transfer the CP/M files to the IBM PC via a
  518.      communications line. This is Joan Riff's personal favorite. If the
  519.      CP/M system is at hand, then the two machines are direct-connected and
  520.      cranked up to 9600 baud. If the CP/M system is not handy, then the
  521.      transfer is made over the phone at whatever speeds the respective modems
  522.      can handle. In either case, the CP/M system running BYE and XMODEM is
  523.      controlled by the IBM PC running Crosstalk VI version 3.5 (from Micro-
  524.      Stuf) and Joan Riff's excellent XMODEM (with CRC) Crosstalk RUN command.
  525.  
  526.       
  527.      When direct connected, files really fly across at 9600 baud. 
  528.       
  529.      The major advantages of this approach are: 
  530.       
  531.           Who cares what the CP/M disk format is? If the CP/M system can
  532.                read its own files, then we can get them. This works very
  533.                well when transferring Apple ][ and NorthStar Horizon
  534.                CP/M files. 
  535.  
  536.           Public Domain CP/M software can be gathered just by dialing
  537.                into a CP/M Bulletin Board or RCPM system. You need never
  538.                know what hardware system is on the other end. 
  539.       
  540.       
  541.      CP/M and PCDOS files are similar enough that we have never had to alter
  542.      a file that was transferred using either of the above two approaches.
  543.      We just download the files to the IBM PC and run 'em under the Emulator.
  544.       
  545.      The biggest problem is remembering which files are PCDOS files and
  546.      which are CP/M files. If you transfer a CP/M file called DUMP.COM, for
  547.      example, from a CP/M system to the IBM PC's disk, you really do want to
  548.      remember that it is a CP/M file (to be run with the Emulator) and not an
  549.      IBM PC .COM file. If you accidentally invoke DUMP.COM from PCDOS, you
  550.      will be unpleasantly surprised. The CP/M DUMP.COM file contains Z80
  551.      opcodes, which will be executed by the IBM PC as 8088 opcodes. Time to
  552.      reach for the Big Red Switch... 
  553.       
  554.      You must run such CP/M command (.COM) files under the Emulator!
  555.       
  556.      At CCS, we keep things straight by storing CP/M files under separate
  557.      PCDOS directories. The "Z80PATH" environment string (explained else-
  558.      where) makes this particularly convenient. 
  559.       
  560.      The saving grace to this CP/M-to-PCDOS conversion is that it needs to be
  561.      done only once for a given file. We spent quite a while transferring 10
  562.      megabytes of CP/M files to the IBM PC. But we need never do it again.
  563.      Now we just run everything on the IBM PC. 
  564.  
  565.  
  566.  
  567.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  568.  
  569.  
  570.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 11
  571.      INTRODUCTION
  572.  
  573.  
  574.      How Do I Run It?
  575.      _________________
  576.       
  577.      The Emulator is just another PCDOS program. There are no arguments to
  578.      give it. There is no syntax. Just type 
  579.       
  580.           Z80MU           Z80MU
  581.       
  582.      and bingo! - you're in CP/M.          bingo!
  583.       
  584.      To make things easier, you may want to copy Z80MU.EXE to one of your
  585.      PCDOS "PATH" directories (if you have any). If you don't have any PATH
  586.      directories set up, then just insert the floppy that holds Z80MU, start
  587.      the program, and then remove the floppy. You don't need it until you
  588.      want to run the Emulator again. 
  589.       
  590.      The next section ("The PCDOS Environment") describes the PCDOS environ-
  591.      ment that applies to the Emulator. You may want to study it before you
  592.      run the thing. 
  593.  
  594.       
  595.       
  596.      What Can Go Wrong?     __________________
  597.  
  598.      The Emulator is as safe a program as ever you'll find on the IBM PC.
  599.      You will probably never experience any problem with it.
  600.  
  601.      There is one important thing to watch out for, however:
  602.  
  603.           If the Emulator itself is ever aborted, then you should 
  604.           immediately reboot your IBM PC. 
  605.  
  606.      Why? Because the Emulator must trap the IBM PC's BREAK interrupt. When
  607.      the Emulator returns to PCDOS (i.e. - when you type the "exit" command),
  608.      it restores this interrupt the way it was before. If the Emulator never
  609.      gets a chance to exit gracefully, then it never gets a chance to restore
  610.      this interrupt. The thing is left pointing to now-dead code somewhere in
  611.      the IBM PC's memory. This is bad news for you, and good news for that
  612.      big red switch on the side of your PC...
  613.  
  614.  
  615.  
  616.  
  617.  
  618.  
  619.  
  620.  
  621.  
  622.  
  623.  
  624.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  625.  
  626.  
  627.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 12
  628.      INTRODUCTION
  629.  
  630.      Why might the Emulator abort? Well, there is always the possibility of  
  631.      an Emulator bug that we haven't found. And we're not real confident of
  632.      Lattice C and its flaky subroutine library, which once in a blue moon
  633.      decides to abort for no apparent reason. But the most likely reason is a
  634.      disk error that results in the familiar message:
  635.  
  636.                               Abort, Retry, Ignore?                          
  637.  
  638.      If you select Abort, then you've just aborted the Emulator and left the 
  639.      BREAK interrupt in limbo. So reboot to be safe.
  640.  
  641.  
  642.  
  643.  
  644.  
  645.  
  646.  
  647.  
  648.  
  649.  
  650.  
  651.  
  652.  
  653.  
  654.  
  655.  
  656.  
  657.  
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664.  
  665.  
  666.  
  667.  
  668.  
  669.  
  670.  
  671.  
  672.  
  673.  
  674.  
  675.  
  676.  
  677.  
  678.  
  679.  
  680.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  681.  
  682.  
  683.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 13
  684.      THE PCDOS ENVIRONMENT
  685.  
  686.  
  687.  
  688.  
  689.  
  690.  
  691.  
  692.  
  693.  
  694.  
  695.  
  696.  
  697.  
  698.                              THE PCDOS ENVIRONMENT                           
  699.  
  700.      The Z80 Emulator runs as a normal application program under PCDOS
  701.      (version 2.0 and above). There are a few things that you should keep in
  702.      mind, in order to get the most out of the Emulator. 
  703.  
  704.       
  705.      PCDOS's use of COMMAND.COM      __________________________
  706.  
  707.      Certain Emulator commands ("dir", "!xxxxxx", etc) are handled by calling
  708.      PCDOS to perform the associated operation. The first thing that PCDOS
  709.      does when called in this way is reload its COMMAND.COM file from disk.
  710.      To speed things up, you should make sure that PCDOS's COMMAND.COM file
  711.      is in a RAMdisk, or on a hard disk. You can tell PCDOS where to find
  712.      COMMAND.COM by using the "SET COMSPEC=" command in your AUTOEXEC.BAT
  713.      file, or the "SHELL" command in your CONFIG.SYS file.
  714.       
  715.      Certain versions of PCDOS (2.0 and 2.1, and maybe others) have trouble
  716.      obeying the "COMSPEC=" command. They try to reload COMMAND.COM from the
  717.      boot disk, regardless of the current "COMSPEC=" parameter. If you use
  718.      one of these versions of PCDOS, then you may avoid problems by keeping
  719.      COMMAND.COM always available on the boot drive. Alternatively, you may
  720.      apply one of the public domain COMZAP patches to fix your copy of PCDOS.
  721.  
  722.       
  723.      The "Z80PATH=" Environment String     _________________________________
  724.  
  725.      The Emulator has a facility which is equivalent to the PCDOS "PATH"
  726.      command. It allows you to tell the Emulator where to look for Z80
  727.      command (.COM) files. 
  728.       
  729.      This facility is implemented by a new PCDOS environment string, called
  730.      "Z80PATH". This string is a list of fully-qualified names of directories
  731.      which are to be searched when the Emulator is looking for a .COM file to
  732.      load and run. The various directory names must be separated with
  733.      semicolon (";") characters, as follows: 
  734.       
  735.  
  736.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  737.  
  738.  
  739.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 14
  740.      THE PCDOS ENVIRONMENT
  741.  
  742.  
  743.           SET Z80PATH=c:\cpm;c:\z80\mystuff;c:\ 
  744.  
  745.      This example tells the Emulator to search for Z80 programs first in the
  746.      directory "CPM" on drive C:, and then (if not found there) in the
  747.      directory "Z80\MYSTUFF" on drive C:, and finally (if still not found) in
  748.      the root directory of drive C:. 
  749.       
  750.      A Z80PATH string should be defined in your AUTOEXEC.BAT file, so that
  751.      it is always present when you run the Emulator.
  752.  
  753.      The trailing "\" character of each directory name is optional. If it is
  754.      absent, a "\" character is automatically applied to the directory name
  755.      before the name is used in the search.
  756.       
  757.      The Z80PATH search order is used whenever an "unqualified" program name
  758.      is used as a command to the Emulator. An "unqualified" program name is a
  759.      legal filename (up to 8 characters) which: 
  760.       
  761.           1) has no drive ID on the front of it (no ":" character), and
  762.           2) has no directory names imbedded in it (no "\" characters), and 
  763.           3) is not the name of an Emulator Builtin Command.
  764.  
  765.      For example, let's say that you give the following command to the
  766.      Emulator: 
  767.       
  768.           Z80 A>asm dump.aaz                 asm dump.aaz
  769.  
  770.      The Emulator first checks to see if the command ("ASM") is one that it
  771.      recognizes - a so-called Builtin Command (see the "Builtin Commands"
  772.      section). If it is not, then the Emulator acts just like CP/M and
  773.      attaches a .COM extension to the command, yielding "ASM.COM". It then
  774.      looks in the current PCDOS directory on the current disk (in this case,
  775.      drive A:) for a file by the name of ASM.COM. If it finds such a file,
  776.      then it loads it into the CP/M Segment and runs it. 
  777.       
  778.      If the file is not found on the current drive, then the Emulator
  779.      searches the various Z80PATH directories, looking for a file with the
  780.      right name (ASM.COM). The directories are searched in the order that
  781.      they appear in the Z80PATH string. The first ASM.COM file that is found
  782.      is the one loaded and run. 
  783.       
  784.      If there is no Z80PATH string defined in the PCDOS environment, then the
  785.      search stops with the current disk drive's current PCDOS directory. 
  786.       
  787.      If no matching filename is found after all of this, then the Emulator
  788.      echos the command line
  789.  
  790.           asm? 
  791.  
  792.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  793.  
  794.  
  795.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 15
  796.      THE PCDOS ENVIRONMENT
  797.  
  798.  
  799.  
  800.      indicating that it doesn't know what you mean. 
  801.  
  802.      Note that no search takes place if the command is "qualified". A
  803.      "qualified" command includes a drive ID or a pathname, such as:
  804.  
  805.           Z80 A>b:asm dump.aaz                b:asm dump.aaz
  806.           Z80 A>\bin\asm dump.aaz                \bin\asm dump.aaz
  807.  
  808.      In such a case, the Emulator tries only once to open the Z80 .COM file,
  809.      using the exact name given. If such a file cannot be found, then the
  810.      command fails as mentioned above.
  811.  
  812.  
  813.  
  814.      The AUTOEXEC.Z80 File     _____________________
  815.  
  816.      When the Emulator first starts up, it automatically executes the
  817.      following command:
  818.  
  819.           Z80 A>SUBMIT AUTOEXEC.Z80                SUBMIT AUTOEXEC.Z80
  820.  
  821.      If there is no file by the name of AUTOEXEC.Z80 in the current directory
  822.      when the Emulator is run, then an error message is displayed and the
  823.      Emulator just waits for you to enter commands from the keyboard.
  824.  
  825.      If there is such a file, however, then the Emulator reads its commands 
  826.      from that file, until EOF. See the "submit" builtin command for more   
  827.      details about submit files.
  828.  
  829.      This is an easy way to automate the Emulator. At CCS, we use a different
  830.      AUTOEXEC.Z80 file in each work directory in order to set up the parti-
  831.      cular environment that we want to work with. The AUTOEXEC.Z80 file
  832.      within the Radio Shack Model 100 directory, for example, automatically
  833.      reads in the 64K Model 100 image from disk ("read 0 model100.mem"), and
  834.      the disassembler control file ("control read model100.ctl"). It also   
  835.      sets up the disassembler format that we want ("list include A O"). So  
  836.      when we start up the Emulator while within that directory, the thing
  837.      comes up ready to do real work.
  838.  
  839.  
  840.  
  841.  
  842.  
  843.  
  844.  
  845.  
  846.  
  847.  
  848.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  849.  
  850.  
  851.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 16
  852.      THE PCDOS ENVIRONMENT
  853.  
  854.  
  855.      I/O Redirection With The Emulator      _________________________________
  856.  
  857.  
  858.           NOTE: The "terminal" builtin command has been enhanced to         
  859.           allow internal mapping of the builtin VT52 emulated terminal
  860.           to respond to either CP/M BIOS or CP/M BDOS console I/O
  861.           requests. This may thoroughly confuse the following discus-
  862.           sion. So in the following text we assume the default condi-
  863.           tion, in which the builtin VT52 terminal emulator only
  864.           responds to CP/M BIOS console I/O requests.
  865.  
  866.       
  867.      The Emulator writes its output to the standard output that is defined by
  868.      PCDOS. So regular old PCDOS I/O redirection can be used when you start
  869.      the Emulator. 
  870.       
  871.      For example, the following PCDOS command can be used to run the Emulator
  872.      and capture all Emulator output to file OUTPUT.DOC: 
  873.  
  874.           Z80MU >OUTPUT.DOC           Z80MU >OUTPUT.DOC
  875.  
  876.      You may also append output to an existing file with:
  877.  
  878.           Z80MU >>OUTPUT.DOC           Z80MU >>OUTPUT.DOC
  879.  
  880.      This is perfect for automating the Emulator. Some of the samples
  881.      displayed later in this document were captured by redirecting the
  882.      Emulator's output to a file, and then editing that file into this
  883.      document. 
  884.       
  885.      There are a few things to bear in mind, however. 
  886.       
  887.      First of all, remember that there are several parts of the Emulator:
  888.  
  889.       
  890.           The main program, which reads your commands and in general        
  891.           acts like the CP/M CCP. It does all I/O via PCDOS, so it is
  892.           subject to I/O redirection. 
  893.        
  894.           The actual Z80 emulator, which does no I/O at all.         
  895.        
  896.           The CP/M BIOS emulator. It does I/O at the IBM PC ROM BIOS 
  897.           level, so PCDOS never sees what's going on. CP/M BIOS terminal
  898.           I/O goes through the emulated "terminal" inside the Emulator,
  899.           and then straight to the IBM PC screen. So I/O redirection
  900.           does not apply there. 
  901.       
  902.  
  903.  
  904.     COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  905.  
  906.  
  907.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 17
  908.      THE PCDOS ENVIRONMENT
  909.  
  910.  
  911.           The CP/M BDOS emulator. The BDOS emulator does its I/O via PCDOS,  
  912.           so I/O redirection does apply to it, and to any Z80 programs that
  913.           use BDOS functions for I/O. 
  914.  
  915.  
  916.      Now the question arises: Will my CP/M application obey any I/O redirec-
  917.      tion that I specify when I run the Emulator? 
  918.       
  919.      The answer, of course, depends on your application. 
  920.       
  921.      Most "standard" CP/M applications do their I/O via BDOS functions. So
  922.      these will obey your I/O redirection. 
  923.       
  924.      Full-screen editors, in general, use the BIOS instead of the BDOS, for a
  925.      lot of very good reasons. So these will automatically be exempt from
  926.      your I/O redirection. 
  927.  
  928.       
  929.      Please remember that all Emulator output is redirected at once. If you  
  930.      redirect the output, meaning to enter commands from the keyboard, don't
  931.      be real surprised if you can't see any of the Emulator's prompts. They
  932.      are being written to the redirected output file, and not to the screen. 
  933.  
  934.           NOTE: When you redirect output to a disk file, your input
  935.           keypresses are supposed to be sent to the output file (not to
  936.           the screen). Some versions of PCDOS, however, contain a bug
  937.           that causes your keypresses to appear on the screen instead.
  938.           We have seen public domain patches to fix this bug floating
  939.           around the Bulletin Boards, but can't vouch for any of them. 
  940.  
  941.  
  942.       
  943.      Using The Keyboard      __________________
  944.       
  945.      The Emulator reads its input from the standard input as defined by
  946.      PCDOS. So if you don't use PCDOS input I/O redirection when you start
  947.      the Emulator, then input comes from the keyboard. 
  948.       
  949.      The Emulator could have done its own direct keyboard and screen I/O.
  950.      This would speed things up considerably. PCDOS is notoriously slow when
  951.      it comes to writing to the screen. 
  952.       
  953.      We decided, however, not to circumvent PCDOS when writing to the screen
  954.      and reading from the keyboard. The Emulator is slower as a result. But
  955.      we gain a few conveniences as a result: 
  956.       
  957.           We achieve something closer to true CP/M emulation, 'cause
  958.  
  959.  
  960.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  961.  
  962.  
  963.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 18
  964.      THE PCDOS ENVIRONMENT
  965.  
  966.  
  967.           PCDOS automatically handles ^P and ^S/^Q in a manner close to
  968.           CP/M's handling of them. 
  969.       
  970.           We get automatic I/O redirection. 
  971.       
  972.           We get PCDOS expanding macro keys and interpreting function
  973.           keys. 
  974.       
  975.       
  976.      The F3 key, for instance, can still be used to repeat the last command
  977.      entered to the Emulator. The ESC key cancels the current input line. And
  978.      F1 recreates the last command one character at a time. Other PCDOS
  979.      keyboard conventions (like Ctrl-NumLock, Ctrl-PrtSc, and so on) are also
  980.      handled by PCDOS in a way that we're all used to. 
  981.       
  982.      The addition of keyboard enhancers like CED and Sidekick can confuse
  983.      things, so that the function keys don't act quite right. You'll just
  984.      have to experiment with it.
  985.  
  986.      If you want to copy screen output to the printer, then press ^P or
  987.      Ctrl-PrtSc. A second press will turn printer echo off. Remember that
  988.      such PCDOS redirection applies to Emulator output (like dumps, disassem-
  989.      blies, etc) as well as to the output of any CP/M applications being run
  990.      under the Emulator that use BDOS functions for output.
  991.       
  992.      If text is scrolling off of the screen too fast to read (not real
  993.      likely, with PCDOS being as slow as it is), you can pause and restart it
  994.      with ^S/^Q, or Ctrl-NumLock. 
  995.  
  996.      The actions of ^S/^Q, ^P and Ctrl-PrtSc may vary, depending on the
  997.      particular CP/M application being run. CP/M's BDOS function number 6
  998.      (Direct Console I/O), for example, is handled by CP/M without it
  999.      checking for ^S or ^P. The Emulator mimics this action.
  1000.  
  1001.  
  1002.      Filenames!     __________
  1003.  
  1004.      CP/M filenames may contain certain characters that PCDOS objects to. In
  1005.      general, don't use the "\" or "/" characters in filenames, or the I/O
  1006.      redirection characters ">" and "<", and so on.
  1007.  
  1008.      And watch out for PCDOS device names that are perfectly innocent
  1009.      filenames under CP/M. Things like "CON.ASM" will fool you.
  1010.  
  1011.  
  1012.  
  1013.  
  1014.  
  1015.  
  1016.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  1017.  
  1018.  
  1019.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 19
  1020.      THE CP/M ENVIRONMENT
  1021.  
  1022.  
  1023.  
  1024.  
  1025.  
  1026.  
  1027.  
  1028.  
  1029.  
  1030.  
  1031.  
  1032.  
  1033.  
  1034.  
  1035.                               THE CP/M ENVIRONMENT                           
  1036.  
  1037.  
  1038.      This section describes the environment set up by the Emulator, under
  1039.      which your Z80 programs will run.
  1040.  
  1041.  
  1042.  
  1043.      Emulated Terminal     _________________
  1044.  
  1045.  
  1046.           NOTE: The "terminal" builtin command has been enhanced to          
  1047.           allow internal mapping of the builtin VT52 emulated terminal
  1048.           to respond to either CP/M BIOS or CP/M BDOS console I/O
  1049.           requests. This may thoroughly confuse the following discus-
  1050.           sion. So in the following text we assume the default condi-
  1051.           tion, in which the builtin VT52 terminal emulator only
  1052.           responds to CP/M BIOS console I/O requests.
  1053.  
  1054.       
  1055.      When a Z80 program does character I/O by calling the emulated CP/M BIOS
  1056.      (not using BDOS functions, but BIOS calls), then it is communicating
  1057.      with an imaginary, emulated ASCII terminal which is maintained by the
  1058.      Emulator. The Emulator interprets ASCII codes that are sent to this
  1059.      "terminal", and translates them into appropriate calls to the IBM ROM to
  1060.      control the IBM's display. 
  1061.       
  1062.      Most ASCII characters that are sent to the emulated "terminal" are
  1063.      displayable characters - letters, numbers, and so on. They appear on the
  1064.      screen for the user to read. Other ASCII characters - called "control
  1065.      sequences" - are used not to display anything, but to cause the "ter-
  1066.      minal" to perform special functions like clearing the screen, switching
  1067.      between high- and low-intensity, and so on. 
  1068.  
  1069.  
  1070.  
  1071.  
  1072.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  1073.  
  1074.  
  1075.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 20
  1076.      THE CP/M ENVIRONMENT
  1077.  
  1078.  
  1079.      The builtin "terminal" obeys VT52 control sequences, which are the      
  1080.      same ones used by the Heath/Zenith H19 and H89 machines when in ZDS     
  1081.      mode. They are as follows:
  1082.  
  1083.  
  1084.  
  1085.           ESC H Homes cursor           ESC H
  1086.  
  1087.           ESC C Advances cursor 1 char to right. Stays on same line.         
  1088.       
  1089.           ESC D Backspaces cursor one char to left. Stays on same line.      
  1090.  
  1091.           ESC B Moves cursor down 1 line, staying in same column. Screen     
  1092.                is scrolled if necessary.
  1093.       
  1094.           ESC A Moves cursor up 1 line, staying in same column. No          
  1095.                scrolling occurs. 
  1096.       
  1097.           ESC I (uppercase letter "I", HEX 049h) Moves cursor up 1 line,    
  1098.                staying in same column. Scrolling occurs if cursor was on
  1099.                top line. 
  1100.       
  1101.           ESC n Causes current cursor position to be returned via          
  1102.                emulated "keyboard" as ESC Y line# column#. This control    
  1103.                sequence is ignored (not supported) by the Emulator.        
  1104.       
  1105.           ESC j Saves cursor position for later restore via ESC k.         
  1106.       
  1107.           ESC k Returns cursor to position that was saved via ESC j.       
  1108.  
  1109.           ESC Y line# column# Direct cursor addressing sequence. Screen    
  1110.                lines are numbered 1 to 25. Screen columns are numbered 1
  1111.                to 80. Line# and column# args are obtained by adding 31
  1112.                (01Fh) to the desired line or column number. Alternative-
  1113.                ly, you may think of lines as being numbered from 0 to
  1114.                24, columns from 0 to 79, and the offset to add to each
  1115.                being 32 (020h).
  1116.  
  1117.                To position to line 5, column 10, for example, the
  1118.                following is sent: 
  1119.       
  1120.                ESC Y $ )                ESC Y $ )
  1121.       
  1122.                which is represented in HEX as 01Bh 059h 024h 029H and in   
  1123.                decimal as 27 89 36 41. Note that the line# arg is          
  1124.                obtained by 5 + 31 = 36 (024h), and the column# arg by 10   
  1125.                + 31 = 41 (029h).                  
  1126.       
  1127.  
  1128.     COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  1129.  
  1130.  
  1131.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 21
  1132.      THE CP/M ENVIRONMENT
  1133.  
  1134.  
  1135.                Line# or column# args less than 32 default to 32 (i.e. -
  1136.                to line or column 1). An arg value that is too large
  1137.                defaults to the max legal value (25 for line, 80 for
  1138.                column). 
  1139.  
  1140.           ESC E Erases the entire screen and homes the cursor.          
  1141.       
  1142.           ESC b Erases from the start of the screen to the cursor,      
  1143.                including the cursor position. 
  1144.       
  1145.           ESC J Erases from the cursor to the end of the screen (inclu- 
  1146.                ding the cursor position). 
  1147.       
  1148.           ESC l (lowercase letter "L", HEX 06Ch) Erases the entire line 
  1149.                that the cursor is on, positions the cursor to the left
  1150.                edge of that line. 
  1151.  
  1152.           ESC o (lowercase letter "O", HEX 06Fh) Erases from the        
  1153.                beginning of the line to the cursor (including the cursor
  1154.                position). 
  1155.       
  1156.           ESC K Erases from the cursor to the end of the line (including
  1157.                the cursor position). 
  1158.       
  1159.           ESC L Inserts a blank line before the line that the cursor is 
  1160.                on, shifts following lines (including the cursor line)
  1161.                down to make room. Cursor is moved to start of new blank
  1162.                line. 
  1163.       
  1164.           ESC M Deletes the line that the cursor is on, scrolls follow- 
  1165.                ing lines up to fill its place. Cursor moves to left edge
  1166.                of its line. 
  1167.       
  1168.           ESC N Deletes the character under the cursor, shifts remaining
  1169.                text to left to cover it up. 
  1170.       
  1171.           ESC @ (At-sign character, HEX 040h) Enters Insert Mode.       
  1172.                Displayed characters cause others on the same line to be
  1173.                moved right to make room. This can be pretty pokey,
  1174.                thanks to the IBM ROM BIOS!
  1175.  
  1176.           ESC O (uppercase letter "O", HEX 04Fh) Exits Insert Mode.     
  1177.  
  1178.           ESC p Enters Reverse Video or Highlight mode.          
  1179.  
  1180.           ESC q Exits Reverse Video or Highlight mode.          
  1181.  
  1182.           BEL (decimal 7) Beeps bell.           
  1183.  
  1184.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  1185.  
  1186.  
  1187.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 22
  1188.      THE CP/M ENVIRONMENT
  1189.  
  1190.  
  1191.       
  1192.           BS (decimal 8) Backspaces cursor one character position.
  1193.  
  1194.           HT (decimal 9) Tabs cursor to next mod-8 column boundary
  1195.  
  1196.           LF (decimal 10, HEX 0Ah) Advances cursor to next line, same
  1197.                column. 
  1198.  
  1199.           FF (decimal 12, HEX 0Ch) Clears screen and homes cursor.   
  1200.  
  1201.           CR (decimal 13, HEX 0Dh) Returns cursor to start of current
  1202.                line. 
  1203.  
  1204.  
  1205.       
  1206.      The other standard ASCII control characters (below 032 or 20h) and those
  1207.      from 128 (80h) through 255 (FFh) display various graphic symbols. See
  1208.      the IBM Tech Ref Manual for details. 
  1209.       
  1210.      The emulated VT52 "terminal" also translates input from the IBM key-
  1211.      board. Most keypresses are returned to the Z80 program as single ASCII
  1212.      characters. The "extended" codes that are generated by IBM function
  1213.      keys, arrow keys, ALT keys, and so on, are translated into 2-byte
  1214.      keyboard sequences as follows: 
  1215.  
  1216.           The first byte is an ESCAPE character (Decimal 027, HEX 1Bh).
  1217.  
  1218.           The second byte is the keyboard scan code, as defined in the 
  1219.           IBM Tech Ref Manual. 
  1220.       
  1221.      Additionally, the NUL extended code (CTRL-@) is translated into a 
  1222.      single ASCII character (Decimal 000). 
  1223.       
  1224.      For example, assume that the user presses the PgUp key on the IBM
  1225.      keyboard. The next time that the Z80 program calls the CP/M BIOS to read
  1226.      a keypress from the "terminal", an ESCAPE character will be returned.
  1227.      The time after that, a Decimal 073 (HEX 49h) will be returned. This is
  1228.      the scan code for the PgUp key. 
  1229.       
  1230.       
  1231.      The above information may be used to configure particular Z80 applica-
  1232.      tions for use with the Emulator's "terminal".  Remember that this
  1233.      emulated "terminal" only appears at the CP/M BIOS interface, unless you
  1234.      use the "terminal" command to alter this. Applications that do I/O via
  1235.      BDOS functions (which includes most of the standard CP/M utilities) do
  1236.      not see this behavior. 
  1237.       
  1238.  
  1239.  
  1240.     COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  1241.  
  1242.  
  1243.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 23
  1244.      THE CP/M ENVIRONMENT
  1245.  
  1246.  
  1247.      WORDSTAR, dBase II, Target Plannercalc  and PMATE, for example, do at
  1248.      least some of their terminal I/O via the CP/M BIOS, so they must be
  1249.      configured for the particular terminal being used. Refer to the above
  1250.      information when installing such applications for use under the Emula-
  1251.      tor, using this emulated VT52 "terminal". Please bear in mind, however,
  1252.      that things can get very confusing when one application (like dBase II)
  1253.      does terminal I/O via both the BIOS and the BDOS. Just experiment until
  1254.      you get something useful.
  1255.  
  1256.           NOTE: This emulated terminal facility may be controlled via
  1257.           the "terminal" builtin command, which is described in the 
  1258.           "Builtin Commands" section.
  1259.  
  1260.  
  1261.       
  1262.      ^C and BREAK Handling      _____________________
  1263.       
  1264.      The ^C (Ctrl-C) and BREAK (Ctrl-Scroll Lock) keys are handled in a
  1265.      special way on the IBM PC. Under normal circumstances, these keypresses
  1266.      are trapped by PCDOS and cause the executing PCDOS program (in this
  1267.      case, the Emulator) to be aborted. 
  1268.       
  1269.      This is undesirable. 
  1270.       
  1271.      Additionally, CP/M includes an important assumption, to wit: ^C is a
  1272.      keypress like any other, and must be passed through all the way to the
  1273.      Z80 program for processing. Several standard CP/M programs (PIP.COM,
  1274.      M80.COM, WORDSTAR, etc) use ^C as a command, and must not be aborted
  1275.      when it is typed. 
  1276.  
  1277.      For this reason, the Emulator traps ^C and BREAK keypresses. It decides
  1278.      what to do with them as follows: 
  1279.       
  1280.           When not running a Z80 program (i.e. - when the Emulator is
  1281.                accepting commands), the BREAK key does nothing and the ^C
  1282.                keypress does various things depending on the mood of PCDOS. 
  1283.       
  1284.           When executing a Z80 program, pressing ^C causes a ^C character
  1285.                (Decimal 003) to be queued as keyboard input. Pressing BREAK
  1286.                causes the Z80 to be stopped (with an appropriate message),
  1287.                and a return to the Emulator awaiting your command.
  1288.  
  1289.  
  1290.      When the Emulator stops ("aborts") a Z80 program due to a BREAK key-
  1291.      press, it displays a message to that effect. It suspends the Z80 in
  1292.      perfect order, maintaining all registers, flags, etc. It then accepts
  1293.      Emulator commands. 
  1294.       
  1295.  
  1296.    COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  1297.  
  1298.  
  1299.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 24
  1300.      THE CP/M ENVIRONMENT
  1301.  
  1302.  
  1303.      At this point you may inspect registers, run another Z80 program, or
  1304.      whatever. You may also continue execution of the aborted program with
  1305.      the "go" command.           go
  1306.       
  1307.      This is a very powerful tool for debugging, which is not available with
  1308.      true (hardware) Z80 systems. You may in effect interrupt the Z80 at any
  1309.      point, actually pausing it between Z80 instructions. 
  1310.       
  1311.      This also maintains compatability with existing CP/M programs (like
  1312.      WORDSTAR) that want to read the ^C character.
  1313.       
  1314.  
  1315.           NOTE: When running PCDOS commands like type, dir, and so on       
  1316.           from within the Emulator, the BREAK key may be unavailable to
  1317.           you. If you want to interrupt the output from such programs
  1318.           that are run "underneath" the Emulator, you may have to use
  1319.           the ^C key.
  1320.       
  1321.       
  1322.           
  1323.      Common PCDOS and CP/M File System      _________________________________
  1324.       
  1325.      The Emulator goes to great lengths to allow CP/M programs to read and
  1326.      write PCDOS files. Thus the PCDOS file system serves as a common
  1327.      environment for both PCDOS and CP/M files. This allows you to use your
  1328.      favorite IBM PC editor, for example, to edit source files that are then
  1329.      compiled within CP/M (using the Emulator) with ASM.COM, M80.COM,
  1330.      F80.COM, or whatever. 
  1331.       
  1332.      CP/M's "User Number" concept, however, is primitive compared to the
  1333.      directory structure available with PCDOS. So although the emulated BDOS
  1334.      supports the setting of a user number, the user number is ignored by the
  1335.      Emulator when it comes time to actually access files. 
  1336.       
  1337.      Likewise, the concept of a Read-Only disk drive is not necessary under
  1338.      the Emulator. And the fatal CP/M flaw that crops up when you change
  1339.      disks and forget to type ^C to Warm Boot the system has been virtually
  1340.      eliminated by PCDOS. 
  1341.  
  1342.  
  1343.      CP/M and its CCP (or lack of same)      __________________________________
  1344.       
  1345.      One thing that we did in order to achieve such a large TPA size (65022
  1346.      bytes) and such fast emulation was remove the console command part of
  1347.      CP/M (the Console Command Processor, or CCP) from the CP/M Segment. In
  1348.      fact, we did away with CP/M entirely. 
  1349.       
  1350.  
  1351.  
  1352.     COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  1353.  
  1354.  
  1355.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 25
  1356.      THE CP/M ENVIRONMENT
  1357.  
  1358.  
  1359.      The CCP is the part of a normal CP/M system which accepts commands from
  1360.      the user and processes them. The Digital Research CCP that comes with
  1361.      CP/M 2.2 is fairly limited in its power. 
  1362.       
  1363.      In the Emulator, it is the main Z80MU 'C'-language program which
  1364.      contains all of the functions of CP/M's CCP, and does a whole lot more.
  1365.      In fact, it is this program which emulates all of CP/M (with a lot of
  1366.      help from PCDOS). 
  1367.  
  1368.      For this reason, there are certain CP/M enhancements (like ZCPR) which
  1369.      will have a whole lot of trouble working under the Emulator. The good
  1370.      news is that they are largely irrelevant under the Emulator, as the
  1371.      Emulator itself provides a powerful increase in console power even
  1372.      without ZCPR. 
  1373.       
  1374.      So if you have dreams of running ZCPR (or any CP/M enhancement which
  1375.      counts on patching CP/M), you ought to forget about it. When using the
  1376.      Emulator, there's no CP/M for such programs to patch. It's all fakeware,
  1377.      invisible to Z80 programs. 
  1378.       
  1379.      Stick with CP/M programs which interact with the outside world via the
  1380.      standard, unmodified BIOS and BDOS interfaces. 
  1381.       
  1382.       
  1383.  
  1384.      CP/M 2.2 BIOS and BDOS Emulation      ________________________________
  1385.       
  1386.      The Emulator tries very hard to look to Z80 programs like CP/M version
  1387.      2.2, at least in terms of its BIOS calls and BDOS support functions.
  1388.      Most Z80 programs that are run under the Emulator will have no idea that
  1389.      they aren't being run on a Z80 machine running Digital Research's CP/M.
  1390.       
  1391.      There are some hardware-specific aspects of CP/M, however, that make no
  1392.      sense on a PCDOS system. 
  1393.       
  1394.      Many CP/M BIOS calls, for example, deal with the physical layout and
  1395.      operation of the floppy disk. Some of these are ignored. Others cause a
  1396.      fault of the Z80 program, with the display of a message to the effect
  1397.      that the program invoked an unsupported BIOS call. 
  1398.       
  1399.      There are a few BDOS functions which likewise are irrelevant, and which
  1400.      cause the Z80 program to be aborted. 
  1401.       
  1402.      The following is a list of the various BIOS calls that are supported by
  1403.      CP/M 2.2, and their effects under the Emulator. Calls that are marked
  1404.      "unsupported" cause the Z80 program to be aborted.
  1405.  
  1406.  
  1407.  
  1408.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  1409.  
  1410.  
  1411.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 26
  1412.      THE CP/M ENVIRONMENT
  1413.  
  1414.  
  1415.      The addresses listed are absolute addresses within the CP/M Segment.
  1416.      Note that when the CP/M segment is Cold Booted, CP/M's location zero is
  1417.      set to JMP BIOS+3 (FF03h - the Warm Boot vector). The only safe way for
  1418.      a Z80 program to locate this BIOS jump table in any CP/M system (not
  1419.      just the Emulator) is to look at address 0001 within CP/M's memory.
  1420.  
  1421.           BIOS          BIOS
  1422.           Address          Address   Function                     
  1423.  
  1424.           FF00h     Cold Start CP/M segment
  1425.           FF03h     Warm Start CP/M segment 
  1426.           FF06h     Set A-reg to FFh if Emulated VT52 Terminal has keypress
  1427.                          to be read, 00h if not
  1428.           FF09h     Get keypress from Emulated VT52 Terminal to A-reg, via
  1429.                          IBM's ROM BIOS 
  1430.           FF0Ch     Output C-reg to Emulated VT52 Terminal via IBM's ROM BIOS
  1431.           FF0Fh     Output C-reg to LPT1: via IBM's ROM BIOS
  1432.           FF12h     Output C-reg to COM1: via IBM's ROM BIOS 
  1433.           FF15h     Get char from COM1: to A-reg via IBM's ROM BIOS 
  1434.           FF18h     Home Disk (unsupported) 
  1435.           FF1Bh     Select Disk (unsupported) 
  1436.           FF1Eh     Set Track (unsupported) 
  1437.           FF21h     Set Sector (unsupported) 
  1438.           FF24h     Set DMA address (unsupported) 
  1439.           FF27h     Read Sector (unsupported) 
  1440.           FF2Ah     Write Sector (unsupported) 
  1441.           FF2Dh     Set A-reg to FFh if LPT1: ready for output, 00h if not,
  1442.                          as reported by IBM's ROM BIOS
  1443.           FF30h     Sector Translate (unsupported) 
  1444.        
  1445.       
  1446.      Similarly, here is a table of the various BDOS functions (in Decimal/-
  1447.      HEX), and their actions under the Emulator. Note that a CP/M BDOS
  1448.      function is invoked by loading the function number into C-reg, and
  1449.      doing a CALL 0005h. See standard CP/M documentation for detailed
  1450.      calling conventions.
  1451.  
  1452.           BDOS          BDOS
  1453.           Function          Function  Action                    Action
  1454.       
  1455.           00/00h    Warm Boot. Returns to accept more Emulator commands. Does
  1456.                          not alter memory in the CP/M Segment.    
  1457.           01/01h    Read char from PCDOS standard input to A-reg. 
  1458.           02/02h    Send E-reg to PCDOS standard output. 
  1459.           03/03h    Read char from PCDOS AUX: device into A-reg. 
  1460.           04/04h    Send E-reg to PCDOS AUX: device 
  1461.           05/05h    Send E-reg to PCDOS PRN device 
  1462.  
  1463.  
  1464.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  1465.  
  1466.  
  1467.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 27
  1468.      THE CP/M ENVIRONMENT
  1469.  
  1470.  
  1471.           06/06h    If E-reg on entry = FFh, then return in A-reg next char
  1472.                          from PCDOS standard input, or 00h if none available
  1473.                          at this instant. 
  1474.                     If E-reg on entry <> FFh, then send E-reg to PCDOS
  1475.                          standard output. 
  1476.           07/07h    Get IOBYTE to A-reg. 
  1477.           08/08h    Store E-reg into IOBYTE. 
  1478.           09/09h    Output string at (DE) to PCDOS standard output. 
  1479.           10/0Ah    Input line from PCDOS standard input to (DE). See Note 1
  1480.                          below. 
  1481.           11/0Bh    Set A-reg to FFh if char from PCDOS standard input is
  1482.                          ready to be read, or 00h if not. 
  1483.           12/0Ch    Return CP/M version to HL. Sets reg L to 22h (for CP/M
  1484.                          version 2.2), and reg H to 00h.
  1485.           13/0Dh    Reset disk system. Sets DMA to 80h. Does not change
  1486.                          selected drive to A: (like CP/M does), as this is
  1487.                          not necessary with PCDOS. 
  1488.           14/0Eh    Set default drive to E-reg. 
  1489.           15/0Fh    Open file whose FCB is at (DE). Sets A-reg to 00h if
  1490.                          successful, else to FFh. 
  1491.           16/10h    Close file whose FCB is at (DE).  Sets A-reg to 00h if
  1492.                          successful, else to FFh. 
  1493.           17/11h    Search for first file that matches pattern in FCB at
  1494.                          (DE).  Sets A-reg to 00h if successful, else to FFh.
  1495.           18/12h    Search for next file that matches last pattern used. 
  1496.                          Sets A-reg to 00h if successful, else to FFh. 
  1497.           19/13h    Delete file(s) represented by FCB is at (DE).  Sets A-reg
  1498.                          to 00h if successful, else to FFh. 
  1499.  
  1500.           20/14h    Read next sequential record from file whose FCB is
  1501.                          at (DE). Sets A-reg to status as follows:
  1502.       
  1503.                          0 = successful 
  1504.                          1 = reading unwritten data (EOF) 
  1505.                          FFh = PCDOS returned error # 2: "No room in DTA for
  1506.                               record" 
  1507.  
  1508.                     Note that a short record is filled out by the Emulator
  1509.                          with ^Z (eof) characters. 
  1510.  
  1511.  
  1512.  
  1513.  
  1514.  
  1515.  
  1516.  
  1517.  
  1518.  
  1519.  
  1520.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  1521.  
  1522.  
  1523.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 28
  1524.      THE CP/M ENVIRONMENT
  1525.  
  1526.  
  1527.           21/15h    Write next sequential record to file whose FCB is at
  1528.                          (DE). Returns status in A-reg as follows: 
  1529.       
  1530.                          0 = successful 
  1531.                          5 = diskette full 
  1532.                          6 = PCDOS returned error # 2: "No room in DTA for
  1533.                               record" 
  1534.       
  1535.           22/16h    Create (and open) file whose FCB is at (DE).  Sets A-reg
  1536.                          to 00h if successful, else to FFh. 
  1537.           23/17h    Rename file(s) per special FCB at (DE).  Sets A-reg to
  1538.                          00h if successful, else to FFh. 
  1539.           24/18h    Return login vector (bitmap of known disks) to HL. Calls
  1540.                          PCDOS to discover number of available drives. 
  1541.           25/19h    Return default drive number in A-reg. 
  1542.           26/1Ah    Set DMA to DE. 
  1543.           27/1Bh    Return allocation information (unsupported - aborts Z80
  1544.                          program). See Note 2 below. 
  1545.           28/1Ch    Write-protect drive (ignored). 
  1546.           29/1Dh    Return write-protect vector (bitmap of $R/O drives) to
  1547.                          HL. Sets HL to zero (nobody's write-protected).
  1548.           30/1Eh    Set file attributes (ignored, but returns A-reg of 00h to
  1549.                          indicate success). 
  1550.           31/1Fh    Return physical disk information (unsupported - aborts
  1551.                          Z80 program). See Note 2 below. 
  1552.  
  1553.           32/20h    If E-reg on entry is FFh, then current user number is
  1554.                          returned in A-reg. 
  1555.       
  1556.                     If E-reg on entry <> FFh, then current user number is set
  1557.                          to E-reg MOD 32. 
  1558.       
  1559.                     This only updates the byte at CP/M address 4. The
  1560.                          Emulator ignores this byte when accessing files. 
  1561.       
  1562.           33/21h    Read random record from file whose FCB is at (DE).
  1563.                          Returns A-reg status as follows: 
  1564.  
  1565.                          0 = successful 
  1566.                          1 = reading unwritten data 
  1567.                          3 = (CP/M "Cannot close current extent" error):
  1568.                               PCDOS returned error # 2: "No space in DTA for
  1569.                               record" 
  1570.       
  1571.                     Note that a partial record is filled out by the Emulator
  1572.                          with ^Z (eof) characters. 
  1573.       
  1574.  
  1575.  
  1576.     COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  1577.  
  1578.  
  1579.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 29
  1580.      THE CP/M ENVIRONMENT
  1581.  
  1582.  
  1583.           34/22h    Write random record to file whose FCB is at (DE). Returns
  1584.                          A-reg status as follows: 
  1585.       
  1586.                          0 = successful 
  1587.                          3 = (CP/M "Cannot close current extent" error):
  1588.                               PCDOS returned error # 2: "No space in DTA for
  1589.                               record" 
  1590.                          5 = (CP/M "Directory Overflow" error): Diskette full
  1591.  
  1592.       
  1593.           35/23h    Compute file size for file whose FCB is at (DE). Result
  1594.                          goes into random record field of FCB. 
  1595.           36/24h    Set random record field per FCB at (DE). 
  1596.           37/25h    Reset drive (accepted but ignored) 
  1597.           38/26h    (unsupported - aborts Z80 program) 
  1598.           39/27h    (unsupported - aborts Z80 program) 
  1599.           40/28h    Write random record with zero fill. In the Emulator, this
  1600.                          is translated to a function 34/22h (above). 
  1601.  
  1602.           NOTE 1: Function 10/0Ah is now done manually by the Z80
  1603.           engine, instead of calling PCDOS. It now works much more like
  1604.           CP/M, except that ^R, ^E, ^U are data characters instead of
  1605.           editing controls.
  1606.  
  1607.           NOTE 2: If someone will kindly provide us with a coherent
  1608.           writeup of the disk parameter block and allocation information
  1609.           as returned by BDOS functions 31/1Fh and 27/1Bh above, then
  1610.           we will gladly emulate these functions in the next release.
  1611.  
  1612.       
  1613.      In CP/M the BDOS routines call the BIOS routines. This is not true in
  1614.      the Emulator. The Emulator's BDOS functions in general invoke the
  1615.      corresponding PCDOS functions, and the Emulator's BIOS routines call the
  1616.      IBM PC ROM BIOS routines. The "terminal" builtin command (q.v.) controls
  1617.      what actually happens, at least as far as CP/M's console character BDOS
  1618.      and BIOS requests are concerned.
  1619.  
  1620.  
  1621.  
  1622.  
  1623.  
  1624.  
  1625.  
  1626.  
  1627.  
  1628.  
  1629.  
  1630.  
  1631.  
  1632.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  1633.  
  1634.  
  1635.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 30
  1636.      EMULATOR BUILTIN COMMANDS
  1637.  
  1638.  
  1639.  
  1640.  
  1641.  
  1642.  
  1643.  
  1644.  
  1645.  
  1646.  
  1647.  
  1648.  
  1649.  
  1650.                                 BUILTIN COMMANDS                             
  1651.  
  1652.      This section describes those commands that are recognized and acted
  1653.      upon by the Emulator itself. Such commands do not involve a search of
  1654.      the disk for a corresponding .COM file, since the Emulator recognizes
  1655.      them as special commands which are to be handled within the Emulator
  1656.      itself. This process is roughly equivalent to the handling of CP/M's CCP
  1657.      commands.
  1658.  
  1659.  
  1660.      Command Name Conflicts     ______________________
  1661.  
  1662.      You may have a .COM (Z80 command) file that has the same name as one of
  1663.      these Builtin Commands. How do you tell the Emulator to run your .COM
  1664.      file, instead of doing its corresponding Builtin Command? All that you
  1665.      have to do is convince the Emulator that your command is indeed a disk
  1666.      file. This can be done by including a drive ID or pathname as part of
  1667.      your command:
  1668.  
  1669.           Z80 A>a:dump foobar.asc                
  1670.           Z80 A>b:\bin\dump foobar.asc           
  1671.           Z80 A>\mystuff\dump foobar.asc         
  1672.  
  1673.      Alternatively, you may want to rename your .COM file so that it no
  1674.      longer conflicts with an Emulator Builtin Command name.
  1675.  
  1676.  
  1677.  
  1678.      Numeric Arguments      _________________
  1679.       
  1680.      Some Builtin Commands accept numeric arguments. These may represent
  1681.      addresses to be dumped, the number of pages to save, or whatever. 
  1682.       
  1683.      A numeric argument may be entered in any of several ways: 
  1684.       
  1685.           As a HEX number. No prefix is required in this case, as this is
  1686.                the default numeric radix. 
  1687.  
  1688.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  1689.  
  1690.  
  1691.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 31
  1692.      EMULATOR BUILTIN COMMANDS
  1693.  
  1694.  
  1695.       
  1696.                Examples: ffff  0  7F  -5  +3FF 
  1697.  
  1698.           As a decimal number, prefixed by a period ("."). 
  1699.  
  1700.                Examples: .10  .0  -.1  +.256  .65022 
  1701.       
  1702.           As a binary number, prefixed with the percent sign ("%"). 
  1703.  
  1704.                Examples: %0  %1010101011110000  -%1 
  1705.       
  1706.           As an ASCII character, prefixed by the apostrophe ("'"). 
  1707.  
  1708.                Examples: 'A  '"  '0  -'Z
  1709.       
  1710.           As an ASCII escape sequence, prefixed by an apostrophe and back-
  1711.                slash ("'\"). 
  1712.  
  1713.                Examples: 
  1714.  
  1715.                     '\\            (single "\" char) 
  1716.                     '\0            (NUL byte) 
  1717.                     '\b or '\B     (Backspace char) 
  1718.                     '\t or '\T     (TAB char) 
  1719.                     '\n or '\N     (LINEFEED char) 
  1720.                     '\r or '\R     (CARRIAGE RETURN char) 
  1721.                     '\'            (single apostrophe ("'") char) 
  1722.                     '\"            (single double-quote char ) 
  1723.                     '\xFF or '\XFF (byte with HEX value of FF) 
  1724.       
  1725.           As a label which has been defined with the "label" builtin command.
  1726.  
  1727.                Examples: fcb1  program_start  BDOS  -reserved 
  1728.       
  1729.           As two or more of the above entries, connected with "+" or "-"
  1730.                operators. 
  1731.  
  1732.                Examples: 
  1733.  
  1734.                     fcb1+5 
  1735.                     program_end-table_length 
  1736.                     'A-40+'a 
  1737.                     table-5+offset 
  1738.       
  1739.       
  1740.  
  1741.  
  1742.  
  1743.  
  1744.     COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  1745.  
  1746.  
  1747.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 32
  1748.      EMULATOR BUILTIN COMMANDS
  1749.  
  1750.  
  1751.  
  1752.      The Builtin Commands are presented by functional grouping:
  1753.  
  1754.           - The PCDOS pass-through command prefix
  1755.           - CP/M Builtins that are emulated
  1756.           - Emulator Builtins that are similar to CP/M's
  1757.           - General Emulator commands
  1758.           - Emulator DEBUG commands
  1759.           - CP/M Environment and file control commands
  1760.           - RESOURCE commands
  1761.  
  1762.  
  1763.  
  1764.  
  1765.  
  1766.  
  1767.  
  1768.  
  1769.  
  1770.  
  1771.  
  1772.  
  1773.  
  1774.  
  1775.  
  1776.  
  1777.  
  1778.  
  1779.  
  1780.  
  1781.  
  1782.  
  1783.  
  1784.  
  1785.  
  1786.  
  1787.  
  1788.  
  1789.  
  1790.  
  1791.  
  1792.  
  1793.  
  1794.  
  1795.  
  1796.  
  1797.  
  1798.  
  1799.  
  1800.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  1801.  
  1802.  
  1803.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 33
  1804.      BUILTIN COMMANDS: PCDOS PASS-THROUGH
  1805.  
  1806.  
  1807.       
  1808.      Builtin:     ________  !xxxxxx               !xxxxxx
  1809.       
  1810.      Passes command xxxxxx to PCDOS. This gives you a way to use the usual
  1811.      PCDOS utilities from within the emulator, without having them interpret-
  1812.      ed as CP/M commands. Everything after the "!" character is passed as a
  1813.      command to PCDOS. 
  1814.       
  1815.      This command requires the reloading (by PCDOS) of the PCDOS COMMAND.COM
  1816.      file from disk. See the section on "The PCDOS Environment" for more
  1817.      detail on this subject. 
  1818.       
  1819.      Since PCDOS handles the command (and any command arguments that may be
  1820.      present), the standard PCDOS "PATH" environment string may apply. So may
  1821.      all other PCDOS conventions, like I/O redirection, wildcards, PCDOS
  1822.      device names, etc. 
  1823.       
  1824.      The given command is executed above the Emulator's memory. This implies
  1825.      that there had better be enough memory available above the Emulator to
  1826.      run the given command. 
  1827.       
  1828.      You may use this facility to "drop into" PCDOS for a while (perhaps to
  1829.      use a PCDOS screen editor on a CP/M source file), and then return to the
  1830.      Emulator. Use "!command" to drop into DOS, and "exit" to leave PCDOS and
  1831.      return to the Emulator. Make sure that COMMAND.COM is in your PCDOS PATH
  1832.      search list if you want to try this.
  1833.       
  1834.      This is also the primary way to take advantage of PCDOS's directory
  1835.      structure while within CP/M. You may issue "CHDIR", "MKDIR", and other
  1836.      directory-related commands directly to PCDOS. The effect of such
  1837.      commands carries over to the Emulator. 
  1838.  
  1839.  
  1840.  
  1841.  
  1842.  
  1843.  
  1844.  
  1845.  
  1846.  
  1847.  
  1848.  
  1849.  
  1850.  
  1851.  
  1852.  
  1853.  
  1854.  
  1855.  
  1856.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  1857.  
  1858.  
  1859.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 34
  1860.      BUILTIN COMMANDS: PCDOS PASS-THROUGH
  1861.  
  1862.  
  1863.  
  1864.      Example (from an actual session):
  1865.       
  1866.           Z80 A>!cd \foo                 !cd \foo
  1867.           Z80 A>!cd \                 !cd \
  1868.           Z80 A>!rd \foo                !rd \foo
  1869.           Z80 A>!chkdsk b:                 !chkdsk b:
  1870.       
  1871.       
  1872.              362496 bytes total disk space 
  1873.                1024 bytes in 1 directories 
  1874.              272384 bytes in 10 user files 
  1875.               89088 bytes available on disk 
  1876.       
  1877.              423936 bytes total memory 
  1878.              152384 bytes free 
  1879.       
  1880.           Z80 A>!md foo                 
  1881.           Z80 A>!cd foo                 
  1882.           Z80 A>stat *.*                
  1883.       
  1884.       
  1885.                Volume in drive A has no label 
  1886.                Directory of  A:\foo 
  1887.       
  1888.                .         <DIR>     11-19-85   1:15a 
  1889.                ..        <DIR>     11-19-85   1:15a 
  1890.                2 File(s)    144384 bytes free 
  1891.       
  1892.           Z80 A>!command                
  1893.        
  1894.       
  1895.           The IBM Personal Computer DOS 
  1896.           Version 2.00 (C)Copyright IBM Corp 1981, 1982, 1983 
  1897.       
  1898.           Tue 11-19-1985 1:16:00.18 
  1899.           A:>chkdsk              
  1900.       
  1901.       
  1902.              362496 bytes total disk space 
  1903.                1024 bytes in 1 directories 
  1904.              217088 bytes in 17 user files 
  1905.              144384 bytes available on disk 
  1906.       
  1907.              423936 bytes total memory 
  1908.              149264 bytes free 
  1909.       
  1910.       
  1911.  
  1912.     COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  1913.  
  1914.  
  1915.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 35
  1916.      BUILTIN COMMANDS: PCDOS PASS-THROUGH
  1917.  
  1918.  
  1919.           Tue 11-19-1985 1:16:16.17 
  1920.           A:>exit  
  1921.  
  1922.           Z80 A>!format a:
  1923.  
  1924.  
  1925.  
  1926.  
  1927.  
  1928.  
  1929.  
  1930.  
  1931.  
  1932.  
  1933.  
  1934.  
  1935.  
  1936.  
  1937.  
  1938.  
  1939.  
  1940.  
  1941.  
  1942.  
  1943.  
  1944.  
  1945.  
  1946.  
  1947.  
  1948.  
  1949.  
  1950.  
  1951.  
  1952.  
  1953.  
  1954.  
  1955.  
  1956.  
  1957.  
  1958.  
  1959.  
  1960.  
  1961.  
  1962.  
  1963.  
  1964.  
  1965.  
  1966.  
  1967.  
  1968.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  1969.  
  1970.  
  1971.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 36
  1972.      BUILTIN COMMANDS: EMULATED CP/M BUILTIN'S
  1973.  
  1974.  
  1975.       
  1976.      Builtin:     ________  d:   
  1977.  
  1978.           Changes the default disk drive to the drive whose letter name is
  1979.      represented by the "d" character. The command prompt will change to
  1980.  
  1981.           Z80 d>
  1982.  
  1983.      to reflect the new default. Drive d's current PCDOS directory will
  1984.      then be the first directory searched for Z80 command (.COM) files,
  1985.      unless explicitly overridden by a drive prefix or pathname. Data files
  1986.      that are created will default to that drive and its current directory.
  1987.      Data files that are read will be searched for only in that drive and
  1988.      directory, unless explicitly overridden by the Z80 program. 
  1989.       
  1990.      Example (from an actual session): 
  1991.  
  1992.           Z80 A>stat b:*.*       
  1993.       
  1994.       
  1995.                 Volume in drive B has no label 
  1996.                 Directory of  B:\ 
  1997.       
  1998.                WORDSTAR     <DIR>     11-02-85   4:19a 
  1999.                     1 File(s)     89088 bytes free 
  2000.       
  2001.           Z80 A>dir b:\wordstar\ws*.* 
  2002.       
  2003.       
  2004.                 Volume in drive B has no label 
  2005.                 Directory of  B:\wordstar 
  2006.       
  2007.                WSMSGS   OVR   27904  11-06-85   6:27p 
  2008.                WSOVLY1  OVR   34048  11-06-85   6:30p 
  2009.                WSU      COM   15872  11-06-85   6:32p 
  2010.                WS       COM   15872  11-06-85   6:37p 
  2011.                     4 File(s)     89088 bytes free 
  2012.       
  2013.           Z80 A>b:                
  2014.       
  2015.           Z80 B>dir               
  2016.       
  2017.       
  2018.                 Volume in drive B has no label 
  2019.                 Directory of  B:\ 
  2020.       
  2021.                WORDSTAR     <DIR>     11-02-85   4:19a 
  2022.                     1 File(s)     89088 bytes free 
  2023.  
  2024.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  2025.  
  2026.  
  2027.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 37
  2028.      BUILTIN COMMANDS: EMULATED CP/M BUILTIN'S
  2029.  
  2030.  
  2031.       
  2032.           Z80 B>stat a:\*.exe     
  2033.       
  2034.       
  2035.                 Volume in drive A has no label 
  2036.                 Directory of  A:\ 
  2037.       
  2038.                Z80MU    EXE   94976  11-18-85   3:31p 
  2039.                     1 File(s)    142336 bytes free 
  2040.       
  2041.  
  2042.  
  2043.  
  2044.  
  2045.  
  2046.  
  2047.  
  2048.  
  2049.  
  2050.  
  2051.  
  2052.  
  2053.  
  2054.  
  2055.  
  2056.  
  2057.  
  2058.  
  2059.  
  2060.  
  2061.  
  2062.  
  2063.  
  2064.  
  2065.  
  2066.  
  2067.  
  2068.  
  2069.  
  2070.  
  2071.  
  2072.  
  2073.  
  2074.  
  2075.  
  2076.  
  2077.  
  2078.  
  2079.  
  2080.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  2081.  
  2082.  
  2083.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 38
  2084.      BUILTIN COMMANDS: EMULATED CP/M BUILTIN'S
  2085.  
  2086.  
  2087.       
  2088.      Builtin:  del <pattern>      
  2089.                era <pattern>      
  2090.                delete <pattern>   
  2091.                erase <pattern>    
  2092.  
  2093.      These are identical commands. All cause the invocation of the PCDOS
  2094.      "DEL" command to delete files that match <pattern>. 
  2095.  
  2096.      See the PCDOS manual for details of <pattern>. 
  2097.  
  2098.      We have created several synonyms for the same command in order to make
  2099.      life easier for CP/M folks who are used to saying "ERA", and PCDOS
  2100.      folks who are used to saying "DEL" or whatever. 
  2101.  
  2102.      These commands cause PCDOS to reload COMMAND.COM, so see "The PCDOS
  2103.      Environment" section for further detail on that subject. 
  2104.  
  2105.      Example:
  2106.       
  2107.           Z80 A>erase b:*.asm     
  2108.           Z80 A>del *.*           
  2109.                Are you sure? y    
  2110.           Z80 A>delete c:\backup\foo.* 
  2111.           Z80 A>era foo.asm            
  2112.  
  2113.  
  2114.  
  2115.  
  2116.  
  2117.  
  2118.  
  2119.  
  2120.  
  2121.  
  2122.  
  2123.  
  2124.  
  2125.  
  2126.  
  2127.  
  2128.  
  2129.  
  2130.  
  2131.  
  2132.  
  2133.  
  2134.  
  2135.  
  2136.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  2137.  
  2138.  
  2139.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 39
  2140.      BUILTIN COMMANDS: EMULATED CP/M BUILTIN'S
  2141.  
  2142.  
  2143.       
  2144.      Builtin:  dir <pattern>           
  2145.                stat <pattern>          
  2146.       
  2147.      Shows a directory of files matching <pattern>. This invokes the PCDOS
  2148.      "DIR" command, so remember about COMMAND.COM (see "The PCDOS Environ-
  2149.      ment" section). 
  2150.  
  2151.      <pattern> is passed directly to PCDOS. So see the PCDOS manual if you
  2152.      want to know what's legal.
  2153.       
  2154.      The CP/M STAT command (STAT.COM) cannot be emulated, because the
  2155.      first thing that Digital Research's STAT.COM does is invoke a hardware-
  2156.      specific CP/M function that means nothing on the IBM PC, and is there-
  2157.      fore illegal within the Emulator. But the most common function of
  2158.      STAT.COM - displaying filenames and file sizes with "STAT *.*" or
  2159.      whatever - can be done with PCDOS's "DIR" command. So STAT and DIR have
  2160.      been made to do the same thing. If you're used to typing "STAT *.*" in
  2161.      CP/M, then you'll be able to do the same thing under the Emulator. 
  2162.  
  2163.      Example (from an actual session):
  2164.  
  2165.           Z80 A>stat b:*.*             
  2166.       
  2167.       
  2168.                 Volume in drive B has no label 
  2169.                 Directory of  B:\ 
  2170.       
  2171.                WORDSTAR     <DIR>     11-02-85   4:19a 
  2172.                     1 File(s)     89088 bytes free 
  2173.       
  2174.           Z80 A>dir b:\wordstar\ws*.*  
  2175.       
  2176.       
  2177.                 Volume in drive B has no label 
  2178.                 Directory of  B:\wordstar 
  2179.       
  2180.                WSMSGS   OVR   27904  11-06-85   6:27p 
  2181.                WSOVLY1  OVR   34048  11-06-85   6:30p 
  2182.                WSU      COM   15872  11-06-85   6:32p 
  2183.                WS       COM   15872  11-06-85   6:37p 
  2184.                     4 File(s)     89088 bytes free 
  2185.       
  2186.           Z80 A>b:                
  2187.       
  2188.           Z80 B>dir               
  2189.       
  2190.       
  2191.  
  2192.     COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  2193.  
  2194.  
  2195.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 40
  2196.      BUILTIN COMMANDS: EMULATED CP/M BUILTIN'S
  2197.  
  2198.  
  2199.                 Volume in drive B has no label 
  2200.                 Directory of  B:\ 
  2201.       
  2202.                WORDSTAR     <DIR>     11-02-85   4:19a 
  2203.                     1 File(s)     89088 bytes free 
  2204.       
  2205.           Z80 B>stat a:\*.exe   
  2206.       
  2207.       
  2208.                 Volume in drive A has no label 
  2209.                 Directory of  A:\ 
  2210.       
  2211.                Z80MU    EXE   94976  11-18-85   3:31p 
  2212.                     1 File(s)    142336 bytes free 
  2213.  
  2214.  
  2215.  
  2216.  
  2217.  
  2218.  
  2219.  
  2220.  
  2221.  
  2222.  
  2223.  
  2224.  
  2225.  
  2226.  
  2227.  
  2228.  
  2229.  
  2230.  
  2231.  
  2232.  
  2233.  
  2234.  
  2235.  
  2236.  
  2237.  
  2238.  
  2239.  
  2240.  
  2241.  
  2242.  
  2243.  
  2244.  
  2245.  
  2246.  
  2247.  
  2248.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  2249.  
  2250.  
  2251.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 41
  2252.      BUILTIN COMMANDS: EMULATED CP/M BUILTIN'S
  2253.  
  2254.  
  2255.  
  2256.      Builtin:  type <filename.typ>
  2257.                ty <filename.typ>  
  2258.       
  2259.      This command is the equivalent of the CP/M "TYPE" command. The specified
  2260.      file is displayed on the standard output (normally the screen). 
  2261.       
  2262.      The display may be paused with either the CP/M convention of ^S/^Q or
  2263.      the PCDOS convention of CTRL-NUMLOCK. It may be aborted with ^C or
  2264.      CTRL-BREAK. 
  2265.  
  2266.      This command causes PCDOS to reload COMMAND.COM, so see "The PCDOS
  2267.      Environment" section for further detail on that subject. 
  2268.       
  2269.      Example: 
  2270.  
  2271.           Z80 A>ty b:foo.asm      
  2272.           Z80 A>type \source\backup\foo.doc
  2273.           Z80 A>ty ctest.err 
  2274.  
  2275.  
  2276.  
  2277.  
  2278.  
  2279.  
  2280.  
  2281.  
  2282.  
  2283.  
  2284.  
  2285.  
  2286.  
  2287.  
  2288.  
  2289.  
  2290.  
  2291.  
  2292.  
  2293.  
  2294.  
  2295.  
  2296.  
  2297.  
  2298.  
  2299.  
  2300.  
  2301.  
  2302.  
  2303.  
  2304.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  2305.  
  2306.  
  2307.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 42
  2308.      BUILTIN COMMANDS: SIMILAR TO CP/M'S
  2309.  
  2310.  
  2311.  
  2312.      Builtin:  rename <oldpath> <newpath>  
  2313.                ren <oldpath> <newpath>     
  2314.       
  2315.      Renames the file specified by <oldpath> to the name given by <newpath>.
  2316.  
  2317.           NOTE: This is not the same syntax used by the CP/M equivalent,
  2318.           which is "REN <newname>=<oldname>". 
  2319.       
  2320.      This command causes PCDOS to reload COMMAND.COM, so see "The PCDOS
  2321.      Environment" section for further detail on that subject. 
  2322.       
  2323.      This command invokes the PCDOS "RENAME" command. See the PCDOS manual
  2324.      for details.
  2325.  
  2326.      Example: 
  2327.  
  2328.           Z80 A>rename dbase.exe dbase.xxx              
  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.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  2361.  
  2362.  
  2363.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 43
  2364.      BUILTIN COMMANDS: SIMILAR TO CP/M'S
  2365.  
  2366.  
  2367.  
  2368.      Builtin:  save n <filename.typ>  
  2369.                sa n <filename.typ>    
  2370.       
  2371.      Saves n 256-byte pages of CP/M memory (starting at address 0100h) to the
  2372.      specified file. The data written to the file is a simple memory image.
  2373.      No translation is done, even if a .HEX extension is given in the
  2374.      filename. If you want to write a true Intel HEX file, use the write
  2375.      Builtin. 
  2376.       
  2377.           NOTE: This is close to the CP/M equivalent, except that the
  2378.           default radix for n is HEX, not decimal as with CP/M. 
  2379.       
  2380.      Example (from an actual session):
  2381.  
  2382.           Z80 A>save 3 820init2.com 
  2383.       
  2384.                Writing 3 pages (768 bytes) to file '820INIT2.COM' 
  2385.       
  2386.           Z80 A>save 0 continue.com 
  2387.       
  2388.                Writing 0 pages (0 bytes) to file 'CONTINUE.COM' 
  2389.  
  2390.  
  2391.  
  2392.  
  2393.  
  2394.  
  2395.  
  2396.  
  2397.  
  2398.  
  2399.  
  2400.  
  2401.  
  2402.  
  2403.  
  2404.  
  2405.  
  2406.  
  2407.  
  2408.  
  2409.  
  2410.  
  2411.  
  2412.  
  2413.  
  2414.  
  2415.  
  2416.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  2417.  
  2418.  
  2419.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 44
  2420.      BUILTIN COMMANDS: SIMILAR TO CP/M'S
  2421.  
  2422.  
  2423.  
  2424.      Builtin:  copy <from_pattern> <to_path> 
  2425.                co <from_pattern> <to_path>   
  2426.       
  2427.      Copies the file(s) specified by <from_pattern> to the file or directory
  2428.      specified by <to_path>. 
  2429.       
  2430.      This command invokes the PCDOS "COPY" command, so see the PCDOS manual
  2431.      for details as to what's legal. 
  2432.       
  2433.      It also causes PCDOS to reload COMMAND.COM, so see "The PCDOS Environ-
  2434.      ment" section for further detail on that subject. 
  2435.       
  2436.      This command is roughly equivalent to CP/M's "PIP <outfile>=<infile>".
  2437.      You have the additional power of PCDOS's directory and device name
  2438.      support, however. 
  2439.       
  2440.      Example:
  2441.  
  2442.           Z80 A>copy *.* B:             
  2443.           Z80 A>co b:*.asm              
  2444.           Z80 A>copy \bin\*.* c:\backup 
  2445.           Z80 A>copy *.asm combined.bak 
  2446.           Z80 A>co *.asm *.bak          
  2447.           Z80 A>co foo.asm lpt1:        
  2448.           Z80 A>co con autoexec.bat     
  2449.  
  2450.  
  2451.  
  2452.  
  2453.  
  2454.  
  2455.  
  2456.  
  2457.  
  2458.  
  2459.  
  2460.  
  2461.  
  2462.  
  2463.  
  2464.  
  2465.  
  2466.  
  2467.  
  2468.  
  2469.  
  2470.  
  2471.  
  2472.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  2473.  
  2474.  
  2475.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 45
  2476.      BUILTIN COMMANDS: GENERAL
  2477.  
  2478.  
  2479.  
  2480.      Builtin:  help [command]           
  2481.                ? [command]              
  2482.       
  2483.      Displays a brief description of the requested Builtin Command. 
  2484.       
  2485.      If no command name follows the "help" command, then a rather lengthy
  2486.      explanation of all commands is displayed. If you press the SPACE bar,
  2487.      this long listing will be interrupted at the next logical break.
  2488.  
  2489.      The listing can be paused with ^S/^Q, or CTRL-NumLock. You can turn
  2490.      printer copying on before the listing starts (which is recommended) with
  2491.      ^P or CTRL-PrtSc.
  2492.       
  2493.      Example:
  2494.       
  2495.           Z80 A>help xreg     
  2496.           Z80 A>? list        
  2497.           Z80 A>?             
  2498.           Z80 A>help ?        
  2499.           Z80 A>help b:       
  2500.           Z80 A>help !        
  2501.  
  2502.  
  2503.  
  2504.  
  2505.  
  2506.  
  2507.  
  2508.  
  2509.  
  2510.  
  2511.  
  2512.  
  2513.  
  2514.  
  2515.  
  2516.  
  2517.  
  2518.  
  2519.  
  2520.  
  2521.  
  2522.  
  2523.  
  2524.  
  2525.  
  2526.  
  2527.  
  2528.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  2529.  
  2530.  
  2531.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 46
  2532.      BUILTIN COMMANDS: GENERAL
  2533.  
  2534.  
  2535.       
  2536.      Builtin:  illop [fault | nop]
  2537.                i [fault | nop]    
  2538.       
  2539.      Specifies how the Emulator is to handle illegal Z80 opcodes. 
  2540.       
  2541.      If "illop fault" is entered, then an illegal Z80 opcode will cause a Z80
  2542.      fault, meaning that the Emulator will stop executing the Z80 program and
  2543.      will display an error message to the effect that an illegal opcode was
  2544.      encountered at such-and-such and address. 
  2545.  
  2546.      If "illop nop" is entered, then an illegal Z80 opcode will simply be    
  2547.      ignored. This is closer to true Z80 operation. Execution will continue
  2548.      with the next Z80 instruction after the illegal opcode. 
  2549.       
  2550.      If only "illop" is entered, then the Emulator simply reports how it is  
  2551.      currently handling illegal opcodes. 
  2552.  
  2553.      Example (from an actual session):
  2554.       
  2555.           Z80 A>i       
  2556.       
  2557.                Illegal opcodes will act as NOP's 
  2558.  
  2559.           Z80 A>illop fault 
  2560.       
  2561.                Illegal opcodes will FAULT 
  2562.  
  2563.           Z80 A>illop nop   
  2564.       
  2565.                Illegal opcodes will act as NOP's 
  2566.  
  2567.  
  2568.  
  2569.  
  2570.  
  2571.  
  2572.  
  2573.  
  2574.  
  2575.  
  2576.  
  2577.  
  2578.  
  2579.  
  2580.  
  2581.  
  2582.  
  2583.  
  2584.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  2585.  
  2586.  
  2587.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 47
  2588.      BUILTIN COMMANDS: GENERAL
  2589.  
  2590.  
  2591.  
  2592.      Builtin:  exit         
  2593.                e            
  2594.       
  2595.      Exits the Emulator, and returns to PCDOS. 
  2596.       
  2597.      Due to certain limitations within PCDOS, you should not remove any
  2598.      floppy disks that are being used until you have exited the Emulator via
  2599.      this command, unless you know that the Z80 programs which you have run 
  2600.      have truly closed any files that have been written to. 
  2601.  
  2602.      We have used the Emulator extensively, and have frequently changed
  2603.      floppies while within the Emulator. We have never experienced corrupted
  2604.      floppy data. But then, we use only "safe" CP/M software like ASM.COM,
  2605.      M80.COM, L80.COM, and so on. Such programs are very good about closing
  2606.      files when they exit. 
  2607.       
  2608.      This warning is included not because it has ever happened to us, but
  2609.      because we wrote the code, and we know about certain "windows" within
  2610.      which a faulting CP/M program could conceivably confuse PCDOS into
  2611.      writing one floppy's data to another floppy, destroying the second
  2612.      floppy's file data and perhaps even its FAT (File Allocation Table). 
  2613.       
  2614.      Example: 
  2615.           Z80 A>exit                
  2616.  
  2617.  
  2618.  
  2619.  
  2620.  
  2621.  
  2622.  
  2623.  
  2624.  
  2625.  
  2626.  
  2627.  
  2628.  
  2629.  
  2630.  
  2631.  
  2632.  
  2633.  
  2634.  
  2635.  
  2636.  
  2637.  
  2638.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  2639.  
  2640.  
  2641.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 48
  2642.      BUILTIN COMMANDS: GENERAL
  2643.  
  2644.  
  2645.  
  2646.      Builtin:  speed?                speed?      ________
  2647.                howfast?                howfast?
  2648.       
  2649.      Calculates the effective speed of the imaginary Z80 that exists within
  2650.      the Emulator. 
  2651.  
  2652.      In response to this command, a sample Z80 program is loaded into the
  2653.      CP/M segment. It is run, and its execution is timed. This program takes
  2654.      up to half a minute to run on a simple IBM PC with an 8088, and corres-
  2655.      pondingly less time on faster machines (i.e. - a PC with a NEC V20 chip,
  2656.      an IBM PC/AT, etc). 
  2657.       
  2658.      The effective clock speed is displayed at the end of the test. 
  2659.       
  2660.      The reported speed should be taken with a grain of salt. What it means
  2661.      is that if you had a real Z80 running the exact instruction mix found in
  2662.      the test program, then that real Z80 would have to run at the reported
  2663.      clock speed in order to perform as fast (or slow) as the Emulator's
  2664.      imaginary Z80. 
  2665.  
  2666.      For example, assume that the reported effective clock is 250,000 Hz.
  2667.      This means that the imaginary Z80 in the Emulator is running the test
  2668.      program at one fourth the speed of a 1 MegaHertz Z80 (as found on a
  2669.      Microsoft SoftCard in an Apple, for example), one eighth the speed of a
  2670.      2 MegaHertz Z80, etc. 
  2671.       
  2672.      Does this mean that your CP/M programs run under the Emulator will run
  2673.      at one fourth the speed of an Apple with a SoftCard? Not necessarily.
  2674.      The reported speed is for CPU-bound (no I/O) operation, of the exact mix
  2675.      of instructions found in the test program. Real CP/M programs tend to
  2676.      have a mix of CPU and I/O operations. I/O operations to disk are handled
  2677.      as fast as the IBM PC can do them. They aren't emulated, they are done. 
  2678.      And CP/M programs whose CPU-bound operations involve a lot of register-
  2679.      to-register operations will be emulated faster than those requiring a
  2680.      lot of memory accesses. 
  2681.       
  2682.      It's a complicated relationship. Our experience has been that ASM.COM,
  2683.      for example, runs about 1/5th the speed under the Emulator on a stock,
  2684.      floppy-based IBM PC than it does on an Apple with a SoftCard and 1
  2685.      MegaHertz Z80. Target PlannerCalc (a spreadsheet program) runs about
  2686.      1/2 speed. The addition of a NEC V20 processor to the IBM PC improves
  2687.      the speed of the Emulator. So does using a hard disk instead of flop-
  2688.      pies. And moving the Emulator to a Compaq DeskPro 286 brings emulated
  2689.      performance close to that of a 1 MegaHertz Z80. 
  2690.  
  2691.  
  2692.  
  2693.  
  2694.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  2695.  
  2696.  
  2697.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 49
  2698.      BUILTIN COMMANDS: GENERAL
  2699.  
  2700.  
  2701.           NOTE: This command causes a Cold Boot of the CP/M segment.
  2702.           This destroys any CP/M program that you may have had in
  2703.           memory. 
  2704.       
  2705.      Example (from an actual session):
  2706.       
  2707.           Z80 A>speed?         
  2708.       
  2709.                *** CP/M Segment COLDBOOTED *** 
  2710.       
  2711.                Beginning Z80 timing test. Please wait... 
  2712.       
  2713.                Effective Z80 clock speed is 248101 Hz 
  2714.       
  2715.                *** CP/M Segment COLDBOOTED *** 
  2716.  
  2717.  
  2718.  
  2719.  
  2720.  
  2721.  
  2722.  
  2723.  
  2724.  
  2725.  
  2726.  
  2727.  
  2728.  
  2729.  
  2730.  
  2731.  
  2732.  
  2733.  
  2734.  
  2735.  
  2736.  
  2737.  
  2738.  
  2739.  
  2740.  
  2741.  
  2742.  
  2743.  
  2744.  
  2745.  
  2746.  
  2747.  
  2748.  
  2749.  
  2750.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  2751.  
  2752.  
  2753.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 50
  2754.      BUILTIN COMMANDS: DEBUG SUPPORT
  2755.  
  2756.  
  2757.       
  2758.      Builtin:  btrace [ SOME | ALL ]
  2759.                bt [ SOME | ALL ]    
  2760.       
  2761.      Displays the current BDOS Trace Table (if no arguments are present), or
  2762.      controls the BDOS functions that will be traced. 
  2763.  
  2764.      As a CP/M program is run, the various BDOS calls that it makes are
  2765.      traced. This command displays the trace table as it has been left by the
  2766.      last CP/M program run. 
  2767.       
  2768.      Items reported include: 
  2769.       
  2770.           1) The logical sequence number. 
  2771.           2) The Program Counter of the CALL to the BDOS. 
  2772.           3) The contents of the Z80 DE register at the entry to the BDOS
  2773.                handler. 
  2774.           4) The DMA address in effect at the instant of this BDOS call. 
  2775.           5) The BDOS function # (as passed in the Z80 C-reg) and a text
  2776.                description of the function being performed.
  2777.       
  2778.      The BDOS Trace Table is cleared by a COLD BOOT, by the load of a new
  2779.      CP/M program, and at various other times when it seems logical to clear
  2780.      it out. 
  2781.  
  2782.      If an argument (either "SOME" or "ALL") is present, then the trace     
  2783.      table is not displayed. Instead, the Emulator adjusts (according to the
  2784.      argument) the way that future traces will be made:
  2785.  
  2786.           If "SOME" is specified, then the Console Status, Console          
  2787.           Output, Direct Console I/O, and List Output BDOS functions
  2788.           will not be traced. This can help to keep the BDOS Trace Table
  2789.           from filling up with unimportant entries.
  2790.  
  2791.           If "ALL" is specified, then even these console character BDOS     
  2792.           functions will be traced.
  2793.  
  2794.  
  2795.  
  2796.  
  2797.  
  2798.  
  2799.  
  2800.  
  2801.  
  2802.  
  2803.  
  2804.  
  2805.  
  2806.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  2807.  
  2808.  
  2809.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 51
  2810.      BUILTIN COMMANDS: DEBUG SUPPORT
  2811.  
  2812.  
  2813.      Example (from an actual run of DUMP.COM): 
  2814.  
  2815.           Z80 A>btrace all                 btrace all
  2816.       
  2817.           Future BDOS traces will include console character functions
  2818.  
  2819.           Z80 A>a:dump dump.com                a:dump dump.com
  2820.  
  2821.           0000 21 00 00 39 22 15 02 31 57 02 CD C1 01 FE FF C2 
  2822.           0010 1B 01 11 F3 01 CD 9C 01 C3 51 01 3E 80 32 13 02 
  2823.           0020 21 00 00 E5 CD A2 01 E1 DA 51 01 47 7D E6 0F C2 
  2824.           ...
  2825.           ...  (Much of DUMP.COM output deleted for brevity)
  2826.           ...
  2827.           0150 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
  2828.           0160 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
  2829.           0170 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
  2830.       
  2831.           Z80 A>bt                 bt
  2832.       
  2833.           BDOS TRACE TABLE: 
  2834.           SEQ#  Z80PC  Z80DE Z80DMA FUNCTION 
  2835.           ----- -----  ----- ------ ---------------- 
  2836.             006 016BH  0030H  0080H 02H Console Output from E-reg = 0 
  2837.             007 016BH  0030H  0080H 02H Console Output from E-reg = 0 
  2838.             008 016BH  0020H  0080H 02H Console Output from E-reg = 
  2839.  
  2840.           ...
  2841.           ...  (Many entries deleted for brevity)
  2842.           ...
  2843.  
  2844.            049 016BH  0030H  0080H 02H Console Output from E-reg = 0 
  2845.            050 01D6H  005CH  0080H 14H Read File (Sequential), FCB at (DE)
  2846.            051 016BH  000DH  0080H 02H Console Output from E-reg = ^M
  2847.            052 016BH  000AH  0080H 02H Console Output from E-reg = ^J
  2848.            244 016BH  0020H  0080H 02H Console Output from E-reg = 
  2849.            245 016BH  0030H  0080H 02H Console Output from E-reg = 0 
  2850.            246 016BH  0030H  0080H 02H Console Output from E-reg = 0 
  2851.            247 016BH  0020H  0080H 02H Console Output from E-reg = 
  2852.            248 016BH  0030H  0080H 02H Console Output from E-reg = 0 
  2853.            249 016BH  0030H  0080H 02H Console Output from E-reg = 0 
  2854.            250 016BH  000DH  0080H 02H Console Output from E-reg = ^M
  2855.            251 016BH  000AH  0080H 02H Console Output from E-reg = ^J
  2856.            252 015EH  0070H  0080H 0BH Get Console Status to A-reg 
  2857.            253 016BH  0030H  0080H 02H Console Output from E-reg = 0 
  2858.            254 016BH  0031H  0080H 02H Console Output from E-reg = 1 
  2859.            255 016BH  0037H  0080H 02H Console Output from E-reg = 7 
  2860.            001 016BH  0030H  0080H 02H Console Output from E-reg = 0 
  2861.  
  2862.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  2863.  
  2864.  
  2865.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 52
  2866.      BUILTIN COMMANDS: DEBUG SUPPORT
  2867.  
  2868.  
  2869.            002 016BH  0020H  0080H 02H Console Output from E-reg = 
  2870.            003 016BH  0030H  0080H 02H Console Output from E-reg = 0 
  2871.            004 016BH  0030H  0080H 02H Console Output from E-reg = 0 
  2872.            005 016BH  0020H  0080H 02H Console Output from E-reg = 
  2873.           -- END OF BDOS TRACE TABLE -- 
  2874.  
  2875.  
  2876.  
  2877.  
  2878.  
  2879.  
  2880.  
  2881.  
  2882.  
  2883.  
  2884.  
  2885.  
  2886.  
  2887.  
  2888.  
  2889.  
  2890.  
  2891.  
  2892.  
  2893.  
  2894.  
  2895.  
  2896.  
  2897.  
  2898.  
  2899.  
  2900.  
  2901.  
  2902.  
  2903.  
  2904.  
  2905.  
  2906.  
  2907.  
  2908.  
  2909.  
  2910.  
  2911.  
  2912.  
  2913.  
  2914.  
  2915.  
  2916.  
  2917.  
  2918.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  2919.  
  2920.  
  2921.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 53
  2922.      BUILTIN COMMANDS: DEBUG SUPPORT
  2923.  
  2924.  
  2925.  
  2926.      Builtin:  break            
  2927.                break clear [n [n...]]
  2928.                break set n [n...]    
  2929.                b                b 
  2930.                b clear [n [n...]]   
  2931.                b set n [n...]       
  2932.       
  2933.      Manipulates the Breakpoint Table, which contains up to 50 Z80 addresses
  2934.      at which execution of the Z80 is to be halted, and control returned to
  2935.      the Emulator's command prompt. 
  2936.       
  2937.      Breakpoints are typically used in conjunction with the "read" and "go" 
  2938.      commands, and various other debug commands. 
  2939.       
  2940.      The Breakpoint Table is cleared when a new CP/M program is loaded, when
  2941.      the CP/M Segment is Cold Booted, and at various other times when it
  2942.      seems logical to clear it. 
  2943.       
  2944.      If only "break" is entered, then the current Breakpoint Table addresses
  2945.      are displayed. 
  2946.       
  2947.      If "break set" is entered followed by one or more Z80 addresses, then  
  2948.      the addresses following the command are added to the Table. 
  2949.       
  2950.      If only "break clear" is entered, then all active breakpoint addresses 
  2951.      are removed. No execution breakpoints will occur. 
  2952.       
  2953.      If "break clear" is entered followed by one or more Z80 addresses, then
  2954.      only the specified addresses are removed from the Breakpoint Table. 
  2955.       
  2956.           NOTE: When a breakpoint is encountered during execution of the
  2957.           Z80 code, that breakpoint's address is automatically cleared
  2958.           from the table.
  2959.  
  2960.  
  2961.  
  2962.  
  2963.  
  2964.  
  2965.  
  2966.  
  2967.  
  2968.  
  2969.  
  2970.  
  2971.  
  2972.  
  2973.  
  2974.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  2975.  
  2976.  
  2977.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 54
  2978.      BUILTIN COMMANDS: DEBUG SUPPORT
  2979.  
  2980.  
  2981.      Example:
  2982.  
  2983.           Z80 A>break clear                
  2984.       
  2985.                0 Breakpoints cleared 
  2986.  
  2987.           Z80 A>b set startup startup+3 14f 210 221
  2988.       
  2989.                5 Breakpoints set - 5 now in table 
  2990.  
  2991.           Z80 A>b clear 221                 
  2992.       
  2993.                1 Breakpoints cleared, 4 left 
  2994.  
  2995.           Z80 A>b                 
  2996.       
  2997.                Current Breakpoints: 
  2998.                0100H  0103H  014FH  0210H 
  2999.                4 Breakpoints currently set 
  3000.  
  3001.           Z80 A>b clear 210 startup
  3002.       
  3003.                2 Breakpoints cleared, 2 left 
  3004.  
  3005.           Z80 A>b                 
  3006.       
  3007.                Current Breakpoints: 
  3008.                0103H  014FH 
  3009.                2 Breakpoints currently set 
  3010.  
  3011.           Z80 A>b clear           
  3012.       
  3013.                2 Breakpoints cleared 
  3014.  
  3015.           Z80 A>b                 
  3016.       
  3017.                Current Breakpoints: 
  3018.                0 Breakpoints currently set 
  3019.       
  3020.  
  3021.  
  3022.  
  3023.  
  3024.  
  3025.  
  3026.  
  3027.  
  3028.  
  3029.  
  3030.     COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  3031.  
  3032.  
  3033.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 55
  3034.      BUILTIN COMMANDS: DEBUG SUPPORT
  3035.  
  3036.  
  3037.       
  3038.      Builtin:  dump [n1 [n2]]               
  3039.                d [n1 [n2]]                
  3040.       
  3041.      Dumps Z80 (CP/M) memory in HEX and ASCII.
  3042.       
  3043.      If n1 is given, then the first address dumped is n1. If no arguments are
  3044.      present, then the first address is the one following the last one
  3045.      done by a previous dump command.     
  3046.  
  3047.      If n2 is given, then the dump continues through Z80 (CP/M) address n2.
  3048.      If n2 is not given, then n2 is assumed to be 255 bytes beyond the
  3049.      starting address. 
  3050.       
  3051.      A lengthy dump may be interrupted by pressing the SPACE bar. 
  3052.       
  3053.      Example (from an actual session):
  3054.       
  3055.           Z80 A>dump 100                
  3056.       
  3057.      ADDR  00 01 02 03 04 05 06 07  08 09 0A 0B 0C 0D 0E 0F 01234567 89ABCDEF
  3058.      ----  -- -- -- -- -- -- -- --  -- -- -- -- -- -- -- -- -------- --------
  3059.      0100: 21 00 00 39 22 15 02 31  57 02 CD C1 01 FE FF C2 !..9"..1 W.MA.~.B
  3060.      0110: 1B 01 11 F3 01 CD 9C 01  C3 51 01 3E 80 32 13 02 ...s.M.. CQ.>.2..
  3061.      0120: 21 00 00 E5 CD A2 01 E1  DA 51 01 47 7D E6 0F C2 !..eM".a ZQ.G}f.B
  3062.      0130: 44 01 CD 72 01 CD 59 01  0F DA 51 01 7C CD 8F 01 D.Mr.MY. .ZQ.|M..
  3063.      0140: 7D CD 8F 01 23 3E 20 CD  65 01 78 CD 8F 01 C3 23 }M..#> M e.xM..C#
  3064.      0150: 01 CD 72 01 2A 15 02 F9  C9 E5 D5 C5 0E 0B CD 05 .Mr.*..y IeUE..M.
  3065.      0160: 00 C1 D1 E1 C9 E5 D5 C5  0E 02 5F CD 05 00 C1 D1 .AQaIeUE .._M..AQ
  3066.      0170: E1 C9 3E 0D CD 65 01 3E  0A CD 65 01 C9 E6 0F FE aI>.Me.> .Me.If.~
  3067.      0180: 0A D2 89 01 C6 30 C3 8B  01 C6 37 CD 65 01 C9 F5 .R..F0C. .F7Me.Iu
  3068.      0190: 0F 0F 0F 0F CD 7D 01 F1  CD 7D 01 C9 0E 09 CD 05 ....M}.q M}.I..M.
  3069.      01A0: 00 C9 3A 13 02 FE 80 C2  B3 01 CD CE 01 B7 CA B3 .I:..~.B 3.MN.7J3
  3070.      01B0: 01 37 C9 5F 16 00 3C 32  13 02 21 80 00 19 7E B7 .7I_..<2 ..!...~7
  3071.      01C0: C9 AF 32 7C 00 11 5C 00  0E 0F CD 05 00 C9 E5 D5 I/2|..\. ..M..IeU
  3072.      01D0: C5 11 5C 00 0E 14 CD 05  00 C1 D1 E1 C9 46 49 4C E.\...M. .AQaIFIL
  3073.      01E0: 45 20 44 55 4D 50 20 56  45 52 53 49 4F 4E 20 31 E DUMP V ERSION 1
  3074.      01F0: 2E 34 24 0D 0A 4E 4F 20  49 4E 50 55 54 20 46 49 .4$..NO  INPUT FI
  3075.  
  3076.           Z80 A>d primary_fcb secondary_fcb+.15
  3077.       
  3078.      ADDR  00 01 02 03 04 05 06 07  08 09 0A 0B 0C 0D 0E 0F 01234567 89ABCDEF
  3079.      ----  -- -- -- -- -- -- -- --  -- -- -- -- -- -- -- -- -------- --------
  3080.      0050:                                      01 44 55 4D              .DUM
  3081.      0060: 50 20 20 20 20 43 4F 4D  00 00 80 00 80 01 00 00 P    COM ........
  3082.      0070: 6D 0B 1B BF 40 F3 00 00  00 F3 00 00             m..?@s.. .s.. 
  3083.  
  3084.  
  3085.  
  3086.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  3087.  
  3088.  
  3089.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 56
  3090.      BUILTIN COMMANDS: DEBUG SUPPORT
  3091.  
  3092.  
  3093.  
  3094.      Builtin:  go [n]               
  3095.                g [n]                
  3096.       
  3097.       
  3098.      Begins execution of Z80 code at address n. If n is not specified, then
  3099.      the starting address defaults to the current Z80 Program Counter (PC).
  3100.       
  3101.      This is the usual way to run a program that has been read from disk. It  
  3102.      is also used to continue execution when the Z80 has been stopped via a
  3103.      breakpoint, or by the user pressing the BREAK key. 
  3104.       
  3105.           NOTE: A Z80 command (.COM) file that is invoked by typing
  3106.           its name is automatically run. It does not require this
  3107.           command in order to be executed. 
  3108.       
  3109.      Example: 
  3110.           Z80 A>go           
  3111.           Z80 A>g 100        
  3112.           Z80 A>g -.768      
  3113.           Z80 A>go fixit5-3  
  3114.  
  3115.  
  3116.  
  3117.  
  3118.  
  3119.  
  3120.  
  3121.  
  3122.  
  3123.  
  3124.  
  3125.  
  3126.  
  3127.  
  3128.  
  3129.  
  3130.  
  3131.  
  3132.  
  3133.  
  3134.  
  3135.  
  3136.  
  3137.  
  3138.  
  3139.  
  3140.  
  3141.  
  3142.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  3143.  
  3144.  
  3145.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 57
  3146.      BUILTIN COMMANDS: DEBUG SUPPORT
  3147.  
  3148.  
  3149.  
  3150.      Builtin:  find n "text" 
  3151.                f n "text"    
  3152.       
  3153.       
  3154.      Searches the CP/M Segment for the binary pattern represented by string
  3155.      "text". The search begins at Z80 address n, which is a numeric value as
  3156.      described at the start of this section. 
  3157.  
  3158.      The "text" string may (and usually does) include imbedded escape       
  3159.      sequences, as follows:
  3160.  
  3161.  
  3162.                \\             (single "\" char) 
  3163.                \0             (NUL byte) 
  3164.                \b or \B       (Backspace char) 
  3165.                \t or \T       (TAB char) 
  3166.                \n or \N       (LINEFEED char) 
  3167.                \r or \R       (CARRIAGE RETURN char) 
  3168.                \'             (single apostrophe ("'") char) 
  3169.                \"             (single double-quote char ) 
  3170.                \xFF or \XFF   (byte with HEX value of FF) 
  3171.       
  3172.  
  3173.      The CP/M Segment address of each match is displayed as a four-digit HEX
  3174.      value. The search ends with CP/M Segment address 0FFFFh.
  3175.  
  3176.      Example (from an actual session): 
  3177.  
  3178.           Z80 A>patch 8000 "Joan Riff"           
  3179.       
  3180.           Z80 A>find 100 "Joan"                
  3181.                8000H 
  3182.  
  3183.           Z80 A>f .256 "\xcd\x05\x00"          
  3184.                015EH 016BH 019EH 01CAH 01D6H 
  3185.  
  3186.  
  3187.  
  3188.  
  3189.  
  3190.  
  3191.  
  3192.  
  3193.  
  3194.  
  3195.  
  3196.  
  3197.  
  3198.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  3199.  
  3200.  
  3201.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 58
  3202.      BUILTIN COMMANDS: DEBUG SUPPORT
  3203.  
  3204.  
  3205.       
  3206.      Builtin:  patch [n]              
  3207.                patch n "xxxx"         
  3208.                p [n]  
  3209.                p n "xxxx"
  3210.       
  3211.      Either enters an interactive patch dialog which allows you to change
  3212.      CP/M memory a byte at a time, or else applies string patch "xxxx" to the
  3213.      CP/M Segment and does not enter interactive patch mode. 
  3214.       
  3215.      If n (which is a numeric value as defined at the start of this section)
  3216.      is specified, then patching starts at address n. If n is not specified,
  3217.      then patching begins with next patch location (the one above the last
  3218.      location patched). Note that in the patch n "xxxx" format, numeric      
  3219.      value n is required. 
  3220.       
  3221.      The interactive patch dialog consists of: 
  3222.       
  3223.           1) a prompt which shows the next address to be patched and its
  3224.           current contents.
  3225.  
  3226.           2) user responses. 
  3227.       
  3228.      User responses to the interactive patch prompt are as follows: 
  3229.       
  3230.           ?<return>  A question mark (followed by RETURN) to request a short 
  3231.                help message showing available responses. 
  3232.       
  3233.           n<return> A standard numeric argument as described at the start    
  3234.                of this section. This is the byte value to be patched into the
  3235.                specified CP/M address. 
  3236.       
  3237.                NOTE: This may also be a 16-bit value. If the high-order
  3238.                byte of the resultant n is non-zero, then this is taken
  3239.                to be a 16-bit value, and fills 2 bytes.
  3240.  
  3241.           "xxx" A string of ASCII text, delimited by double-quote characters.
  3242.                The bytes of the string are patched into successive CP/M
  3243.                memory locations. The string may include ASCII escape se-
  3244.                quences as follows: 
  3245.       
  3246.                \\             (single "\" char) 
  3247.                \0             (NUL byte) 
  3248.                \b or \B       (Backspace char) 
  3249.                \t or \T       (TAB char) 
  3250.                \n or \N       (LINEFEED char) 
  3251.                \r or \R       (CARRIAGE RETURN char) 
  3252.                \'             (single apostrophe ("'") char) 
  3253.  
  3254.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  3255.  
  3256.  
  3257.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 59
  3258.      BUILTIN COMMANDS: DEBUG SUPPORT
  3259.  
  3260.  
  3261.                \"             (single double-quote char ) 
  3262.                \xFF or \XFF   (byte with HEX value of FF) 
  3263.       
  3264.       
  3265.           <space><return> to leave the addressed byte unchanged, and move to 
  3266.                next one. 
  3267.       
  3268.           <return> to exit the interactive patch mode.           <return>
  3269.       
  3270.           ;xxx A comment (everything following the semicolon is ignored).    
  3271.  
  3272.       
  3273.       
  3274.      Example (from an actual session):
  3275.  
  3276.           Z80 A>patch 400            
  3277.       
  3278.       
  3279.           Enter '?' for help with PATCH entries 
  3280.       
  3281.       
  3282.           0400H (00H) = 'R           
  3283.           0401H (00H) = 'I+20        
  3284.           0402H (00H) = "ff\0"       
  3285.           0405H (00H) = 
  3286.       
  3287.           Z80 A>d 400 40f            
  3288.       
  3289.      ADDR  00 01 02 03 04 05 06 07  08 09 0A 0B 0C 0D 0E 0F 01234567 89ABCDEF
  3290.      ----  -- -- -- -- -- -- -- --  -- -- -- -- -- -- -- -- -------- --------
  3291.      0400: 52 69 66 66 00 00 00 00  00 00 00 00 00 00 00 00 Riff.... ........
  3292.  
  3293.           Z80 A>p primary_fcb "JoanRiff   "
  3294.       
  3295.           Z80 A>d primary_fcb secondary_fcb+.15 
  3296.       
  3297.      ADDR  00 01 02 03 04 05 06 07  08 09 0A 0B 0C 0D 0E 0F 01234567 89ABCDEF
  3298.      ----  -- -- -- -- -- -- -- --  -- -- -- -- -- -- -- -- -------- --------
  3299.      0050:                                      4A 6F 61 6E              Joan
  3300.      0060: 52 69 66 66 20 20 20 4D  00 00 80 00 80 01 00 00 Riff   M ........
  3301.      0070: 6D 0B 1B BF 40 F3 00 00  00 F3 00 00             m..?@s.. .s..  
  3302.  
  3303.  
  3304.  
  3305.  
  3306.  
  3307.  
  3308.  
  3309.  
  3310.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  3311.  
  3312.  
  3313.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 60
  3314.      BUILTIN COMMANDS: DEBUG SUPPORT
  3315.  
  3316.  
  3317.  
  3318.      Builtin:  xreg [rr n]               
  3319.                x [rr n]                
  3320.       
  3321.      Sets Z80 register or flag rr to value n. 
  3322.       
  3323.      If no args are present, then the current Z80 register values and flags
  3324.      are displayed. 
  3325.       
  3326.      If args are present, then the register or flag represented by rr is set
  3327.      to the numeric value n (whose format is described at the beginning of
  3328.      this section). 
  3329.       
  3330.           NOTE: The Z80 has a primary and an alternate set of registers
  3331.           and flags. The alternate set is indicated by appending an
  3332.           apostrophe ("'") to the register or flag name. 
  3333.       
  3334.      The register or flag to be set (the rr argument) must be one of the
  3335.      following (in either upper or lowercase): 
  3336.       
  3337.           regs:     A    F    B    C    D    E    H    L 
  3338.                     A'   F'   B'   C'   D'   E'   H'   L' 
  3339.                     AF   BC   DE   HL 
  3340.                     AF'  BC'  DE'  HL' 
  3341.                     IX   IY   SP   PC 
  3342.                     IFF1 IFF2 IMF  I    R 
  3343.       
  3344.           flags:    SF   ZF   HF   P/V  NF   CF 
  3345.                     SF'  ZF'  HF'  P/V' NF'  CF' 
  3346.       
  3347.      Example (from an actual session):
  3348.  
  3349.           Z80 A>xreg pc 0              
  3350.       
  3351.           Z80 A>x                
  3352.       
  3353.           A F  B C  D E  H L  IX   IY   I  R  SP   PC   IFF1 IFF2 IMF
  3354.           0A01 000F 007F FEFC 0000 0000 00 00 FEFE 0000   0    0   0
  3355.           0000'0000'0000'0000'SF=0 ZF=0 HF=0 P/V=0 NF=0 CF=1 
  3356.           L0000:    C3 03 FF       JP   LFF03 
  3357.       
  3358.           Z80 A>xreg bc ffff     
  3359.       
  3360.  
  3361.  
  3362.  
  3363.  
  3364.  
  3365.  
  3366.     COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  3367.  
  3368.  
  3369.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 61
  3370.      BUILTIN COMMANDS: DEBUG SUPPORT
  3371.  
  3372.  
  3373.           Z80 A>x       
  3374.       
  3375.           A F  B C  D E  H L  IX   IY   I  R  SP   PC   IFF1 IFF2 IMF
  3376.           0A01 FFFF 007F FEFC 0000 0000 00 00 FEFE 0000   0    0   0
  3377.           0000'0000'0000'0000'SF=0 ZF=0 HF=0 P/V=0 NF=0 CF=1 
  3378.           L0000:    C3 03 FF       JP   LFF03
  3379.       
  3380.           Z80 A>x c' 'A 
  3381.       
  3382.           Z80 A>xreg de .256
  3383.       
  3384.           Z80 A>xreg AF' 55 
  3385.       
  3386.           Z80 A>xreg        
  3387.       
  3388.           A F  B C  D E  H L  IX   IY   I  R  SP   PC   IFF1 IFF2 IMF
  3389.           0A01 FFFF 0100 FEFC 0000 0000 00 00 FEFE 0000   0    0   0 
  3390.           0055'0041'0000'0000'SF=0 ZF=0 HF=0 P/V=0 NF=0 CF=1 
  3391.           L0000:    C3 03 FF       JP   LFF03 
  3392.       
  3393.  
  3394.  
  3395.  
  3396.  
  3397.  
  3398.  
  3399.  
  3400.  
  3401.  
  3402.  
  3403.  
  3404.  
  3405.  
  3406.  
  3407.  
  3408.  
  3409.  
  3410.  
  3411.  
  3412.  
  3413.  
  3414.  
  3415.  
  3416.  
  3417.  
  3418.  
  3419.  
  3420.  
  3421.  
  3422.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  3423.  
  3424.  
  3425.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 62
  3426.      BUILTIN COMMANDS: DEBUG SUPPORT
  3427.  
  3428.  
  3429.  
  3430.      Builtin:  trace [n]    
  3431.                t [n]        
  3432.       
  3433.      Traces a certain number (specified by the n argument) of Z80 instruction
  3434.      executions, displaying Z80 regs and flags after each instruction's
  3435.      execution. 
  3436.       
  3437.      Execution begins at the current Z80 Program Counter (PC). 
  3438.       
  3439.      If no argument is given, then n defaults to 1. 
  3440.       
  3441.      The n argument is a numeric value as described at the beginning of this
  3442.      section. 
  3443.  
  3444.           NOTE: The PC of each executed instruction is saved in a
  3445.           circular buffer for later interpretation by the "pc?" builtin
  3446.           command(q.v.).
  3447.  
  3448.      Example (from an actual trace of DDT.COM's opening lines): 
  3449.  
  3450.           Z80 A>read ddt.com            
  3451.       
  3452.           *** Low = 0100H  Next = 1400H 
  3453.           *** Z80 DMA, PC and Stack automatically set for .COM file 
  3454.  
  3455.           Z80 A>t 4                 
  3456.       
  3457.           A F  B C  D E  H L  IX   IY   I  R  SP   PC   IFF1 IFF2 IMF
  3458.           0A01 0FBC 0100 FEFC 0000 0000 00 00 FEFC 0103   0    0   0 
  3459.           0055'0041'0000'0000'SF=0 ZF=0 HF=0 P/V=0 NF=0 CF=1 
  3460.           L0103:    C3 3D 01       JP   L013D 
  3461.       
  3462.           A F  B C  D E  H L  IX   IY   I  R  SP   PC   IFF1 IFF2 IMF
  3463.           0A01 0FBC 0100 FEFC 0000 0000 00 00 FEFC 013D   0    0   0 
  3464.           0055'0041'0000'0000'SF=0 ZF=0 HF=0 P/V=0 NF=0 CF=1 
  3465.           L013D:    31 00 02       LD   SP,L0200 
  3466.       
  3467.           A F  B C  D E  H L  IX   IY   I  R  SP   PC   IFF1 IFF2 IMF
  3468.           0A01 0FBC 0100 FEFC 0000 0000 00 00 0200 0140   0    0   0 
  3469.           0055'0041'0000'0000'SF=0 ZF=0 HF=0 P/V=0 NF=0 CF=1 
  3470.           L0140:    C5             PUSH BC 
  3471.       
  3472.           A F  B C  D E  H L  IX   IY   I  R  SP   PC   IFF1 IFF2 IMF
  3473.           0A01 0FBC 0100 FEFC 0000 0000 00 00 01FE 0141   0    0   0 
  3474.           0055'0041'0000'0000'SF=0 ZF=0 HF=0 P/V=0 NF=0 CF=1 
  3475.           L0141:    C5             PUSH BC 
  3476.  
  3477.  
  3478.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  3479.  
  3480.  
  3481.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 63
  3482.      BUILTIN COMMANDS: DEBUG SUPPORT
  3483.  
  3484.  
  3485.       
  3486.      Builtin:  notrace [n]          
  3487.                n [n]                
  3488.       
  3489.      Executes a certain number (specified by the n argument) of Z80 instruc-
  3490.      tions, beginning at the current Z80 Program Counter (PC). The Z80
  3491.      registers are not displayed after every instruction, but are displayed
  3492.      after the last instruction. 
  3493.  
  3494.      If no argument is given, then n defaults to 1. 
  3495.       
  3496.      The n argument is a numeric value as described at the beginning of this
  3497.      section. 
  3498.  
  3499.           NOTE: The PC of each executed instruction is saved in a
  3500.           circular buffer for later interpretation by the "pc?" builtin    
  3501.           command(q.v.).
  3502.       
  3503.      Example: 
  3504.  
  3505.           Z80 A>n 3     
  3506.       
  3507.           A F  B C  D E  H L  IX   IY   I  R  SP   PC   IFF1 IFF2 IMF
  3508.           0A01 0F09 0130 FEFC 0000 0000 00 00 01FA FEFE   0    0   0 
  3509.           0055'0041'0000'0000'SF=0 ZF=0 HF=0 P/V=0 NF=0 CF=1 
  3510.           LFEFE:    76             HALT 
  3511.       
  3512.  
  3513.  
  3514.  
  3515.  
  3516.  
  3517.  
  3518.  
  3519.  
  3520.  
  3521.  
  3522.  
  3523.  
  3524.  
  3525.  
  3526.  
  3527.  
  3528.  
  3529.  
  3530.  
  3531.  
  3532.  
  3533.  
  3534.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  3535.  
  3536.  
  3537.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 64
  3538.      BUILTIN COMMANDS: DEBUG SUPPORT
  3539.  
  3540.  
  3541.       
  3542.      Builtin:  pctrace? [FIRST/LAST n [FULL/BRIEF] ]    
  3543.                pc? [FIRST/LAST n [FULL/BRIEF] ]         
  3544.       
  3545.  
  3546.      Displays the Z80 PC's which were saved during the last "trace" or   
  3547.      "notrace" execution. This is very useful for finding out how the Z80
  3548.      wound up at a particular address, or where it went from there.
  3549.  
  3550.      The display may proceed from the oldest PC toward the newest (FIRST n),
  3551.      or in the reverse direction (LAST n).                                 
  3552.  
  3553.      The display may include only the PC itself (BRIEF) or the complete    
  3554.      disassembled instruction at each PC (FULL).                           
  3555.  
  3556.      Note that a FULL display assumes that instructions haven't been modified
  3557.      since they executed. All that is saved in the circular PC queue is the
  3558.      PC itself. For a FULL display, the current contents of whatever is at 
  3559.      that address is disassembled.
  3560.       
  3561.      The n argument is a numeric value as described at the beginning of this
  3562.      section. 
  3563.  
  3564.      The default is LAST .512 FULL.  
  3565.  
  3566.      Example: 
  3567.  
  3568.           Z80 A>pc?                 
  3569.           Z80 A>pctrace? first .20 full
  3570.           Z80 A>pc? last .20 brief     
  3571.  
  3572.  
  3573.  
  3574.  
  3575.  
  3576.  
  3577.  
  3578.  
  3579.  
  3580.  
  3581.  
  3582.  
  3583.  
  3584.  
  3585.  
  3586.  
  3587.  
  3588.  
  3589.  
  3590.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  3591.  
  3592.  
  3593.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 65
  3594.      BUILTIN COMMANDS: DEBUG SUPPORT
  3595.  
  3596.  
  3597.       
  3598.      Builtin:  move nlow nhigh ndest   
  3599.                m nlow nhigh ndest      
  3600.       
  3601.      Moves CP/M memory from one location within the CP/M Segment to another
  3602.      location within the CP/M Segment. 
  3603.       
  3604.      The block of memory to be moved is defined by nlow through nhigh.
  3605.  
  3606.      The new location for the block is defined by ndest. 
  3607.       
  3608.      All three arguments are numeric values as described at the start of this
  3609.      section. 
  3610.       
  3611.           NOTE: The move is done either left-to-right or right-to-left,
  3612.           as needed. So no smearing is possible. 
  3613.       
  3614.      Example (from an actual session): 
  3615.  
  3616.           Z80 A>p primary_fcb "JoanRiff   " 
  3617.       
  3618.           Z80 A>d primary_fcb secondary_fcb+.15
  3619.       
  3620.      ADDR  00 01 02 03 04 05 06 07  08 09 0A 0B 0C 0D 0E 0F 01234567 89ABCDEF
  3621.      ----  -- -- -- -- -- -- -- --  -- -- -- -- -- -- -- -- -------- --------
  3622.      0050:                                      4A 6F 61 6E              Joan
  3623.      0060: 52 69 66 66 20 20 20 4D  00 00 80 00 80 01 00 00 Riff   M ........
  3624.      0070: 6D 0B 1B BF 40 F3 00 00  00 F3 00 00             m..?@s.. .s.. 
  3625.  
  3626.           Z80 A>move primary_fcb secondary_fcb secondary_fcb    
  3627.       
  3628.           Z80 A>d primary_fcb secondary_fcb+.15                 
  3629.       
  3630.      ADDR  00 01 02 03 04 05 06 07  08 09 0A 0B 0C 0D 0E 0F 01234567 89ABCDEF
  3631.      ----  -- -- -- -- -- -- -- --  -- -- -- -- -- -- -- -- -------- --------
  3632.      0050:                                      4A 6F 61 6E              Joan
  3633.      0060: 52 69 66 66 20 20 20 4D  00 00 80 00 4A 6F 61 6E Riff   M ....Joan
  3634.      0070: 52 69 66 66 20 20 20 4D  00 00 80 00             Riff   M .... 
  3635.  
  3636.  
  3637.  
  3638.  
  3639.  
  3640.  
  3641.  
  3642.  
  3643.  
  3644.  
  3645.  
  3646.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  3647.  
  3648.  
  3649.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 66
  3650.      BUILTIN COMMANDS: DEBUG SUPPORT
  3651.  
  3652.  
  3653.       
  3654.      Builtin:  math <expression>             
  3655.                ma <expression>               
  3656.       
  3657.      Prints 16-bit evaluated result of expression, which is composed of
  3658.      numeric values (as described at the start of this section) connected
  3659.      with '+' or '-' operators. 
  3660.       
  3661.      The evaluated result is printed in HEX and decimal, as both positive
  3662.      and negative numbers.
  3663.  
  3664.      Example (from an actual session): 
  3665.  
  3666.           Z80 A>math 0-7ff      
  3667.       
  3668.                HEX: F801H  -07FFH     Dec: 63489  -02047 
  3669.  
  3670.           Z80 A>ma secondary_fcb-primary_fcb
  3671.       
  3672.                HEX: 0010H  -FFF0H     Dec: 00016  -65520 
  3673.  
  3674.           Z80 A>ma 'A-40+'a                 
  3675.       
  3676.                HEX: 0062H  -FF9EH     Dec: 00098  -65438 
  3677.  
  3678.  
  3679.  
  3680.  
  3681.  
  3682.  
  3683.  
  3684.  
  3685.  
  3686.  
  3687.  
  3688.  
  3689.  
  3690.  
  3691.  
  3692.  
  3693.  
  3694.  
  3695.  
  3696.  
  3697.  
  3698.  
  3699.  
  3700.  
  3701.  
  3702.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  3703.  
  3704.  
  3705.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 67
  3706.      BUILTIN COMMANDS: CP/M ENVIRONMENT CONTROL
  3707.  
  3708.  
  3709.  
  3710.      Builtin:  args <tail>               
  3711.                ar <tail>               
  3712.       
  3713.      Formats default FCB's at 5Ch and 6Ch as well as default DMA at 80h per
  3714.      command tail, exactly as if <tail> had followed a Z80 command (.COM)
  3715.      filename. 
  3716.       
  3717.      This command is most useful for "filling in" a command tail for Z80 code
  3718.      that has been "read" into CP/M memory and which will look for command-  
  3719.      line arguments. 
  3720.       
  3721.      For instance, you may want to debug Digital Research's DDT.COM program,
  3722.      while telling DDT to load file FOO.COM. You would first load DDT via
  3723.       
  3724.           read 100 ddt.com      
  3725.       
  3726.      You would then fill in DDT's command-line arguments with 
  3727.       
  3728.           args foo.com          
  3729.       
  3730.      When executed, DDT would then see "FOO.COM" in both the first FCB at 5Ch
  3731.      and as a raw command tail at 80h. 
  3732.       
  3733.      Example (from an actual session): 
  3734.  
  3735.           Z80 A>args testfile001 file0002
  3736.       
  3737.           Z80 A>d primary_fcb secondary_fcb+.15
  3738.       
  3739.      ADDR  00 01 02 03 04 05 06 07  08 09 0A 0B 0C 0D 0E 0F 01234567 89ABCDEF
  3740.      ----  -- -- -- -- -- -- -- --  -- -- -- -- -- -- -- -- -------- --------
  3741.      0050:                                      00 54 45 53              .TES
  3742.      0060: 54 46 49 4C 45 30 30 31  00 00 00 00 00 46 49 4C TFILE001 .....FIL
  3743.      0070: 45 30 30 30 32 20 20 20  00 00 00 00             E0002    ....
  3744.  
  3745.           Z80 A>d 80 9f                
  3746.       
  3747.      ADDR  00 01 02 03 04 05 06 07  08 09 0A 0B 0C 0D 0E 0F 01234567 89ABCDEF
  3748.      ----  -- -- -- -- -- -- -- --  -- -- -- -- -- -- -- -- -------- --------
  3749.      0080: 15 20 54 45 53 54 46 49  4C 45 30 30 31 20 46 49 . TESTFI LE001 FI
  3750.      0090: 4C 45 30 30 30 32 0D 00  00 00 00 00 00 00 00 00 LE0002.. ........
  3751.  
  3752.           Z80 A>args foo.c -n -b -v    
  3753.       
  3754.  
  3755.  
  3756.  
  3757.  
  3758.     COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  3759.  
  3760.  
  3761.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 68
  3762.      BUILTIN COMMANDS: CP/M ENVIRONMENT CONTROL
  3763.  
  3764.  
  3765.           Z80 A>d primary_fcb secondary_fcb+.15 
  3766.       
  3767.      ADDR  00 01 02 03 04 05 06 07  08 09 0A 0B 0C 0D 0E 0F 01234567 89ABCDEF
  3768.      ----  -- -- -- -- -- -- -- --  -- -- -- -- -- -- -- -- -------- --------
  3769.      0050:                                      00 46 4F 4F              .FOO
  3770.      0060: 20 20 20 20 20 43 20 20  00 00 00 00 00 2D 4E 20      C   .....-N 
  3771.      0070: 20 20 20 20 20 20 20 20  00 00 00 00                      .... 
  3772.  
  3773.           Z80 A>d 80 9f                 d 80 9f
  3774.       
  3775.      ADDR  00 01 02 03 04 05 06 07  08 09 0A 0B 0C 0D 0E 0F 01234567 89ABCDEF
  3776.      ----  -- -- -- -- -- -- -- --  -- -- -- -- -- -- -- -- -------- --------
  3777.      0080: 0F 20 46 4F 4F 2E 43 20  2D 4E 20 2D 42 20 2D 56 . FOO.C  -N -B -V
  3778.      0090: 0D 45 30 30 30 32 0D 00  00 00 00 00 00 00 00 00 .E0002.. ........
  3779.  
  3780.  
  3781.  
  3782.  
  3783.  
  3784.  
  3785.  
  3786.  
  3787.  
  3788.  
  3789.  
  3790.  
  3791.  
  3792.  
  3793.  
  3794.  
  3795.  
  3796.  
  3797.  
  3798.  
  3799.  
  3800.  
  3801.  
  3802.  
  3803.  
  3804.  
  3805.  
  3806.  
  3807.  
  3808.  
  3809.  
  3810.  
  3811.  
  3812.  
  3813.  
  3814.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  3815.  
  3816.  
  3817.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 69
  3818.      BUILTIN COMMANDS: CP/M ENVIRONMENT CONTROL
  3819.  
  3820.  
  3821.  
  3822.      Builtin:  coldboot!           
  3823.                cold!               
  3824.       
  3825.      Cold Boots CP/M memory by zeroing the 64K CP/M Segment, installing the
  3826.      BIOS and BDOS hooks, formatting the first page of memory just as CP/M
  3827.      would, etc. 
  3828.       
  3829.      When you first start up the Emulator, the CP/M Segment has already been
  3830.      Cold Booted. 
  3831.       
  3832.      You may use this command to clean things up when you suspect that Z80
  3833.      software may have corrupted the BIOS or BDOS hooks, garbaged page zero,
  3834.      or whatever. 
  3835.       
  3836.      If a Z80 program exits with an Emulator message to the effect that the
  3837.      program requests termination via Cold Boot, then you should use this
  3838.      command to do it. The Z80 program probably had a good reason for asking
  3839.      for a Cold Boot.
  3840.       
  3841.      Example: 
  3842.  
  3843.           Z80 A>coldboot!          
  3844.       
  3845.                *** CP/M Segment COLDBOOTED *** 
  3846.  
  3847.  
  3848.  
  3849.  
  3850.  
  3851.  
  3852.  
  3853.  
  3854.  
  3855.  
  3856.  
  3857.  
  3858.  
  3859.  
  3860.  
  3861.  
  3862.  
  3863.  
  3864.  
  3865.  
  3866.  
  3867.  
  3868.  
  3869.  
  3870.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  3871.  
  3872.  
  3873.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 70
  3874.      BUILTIN COMMANDS: CP/M ENVIRONMENT CONTROL
  3875.  
  3876.  
  3877.  
  3878.      Builtin:  terminal [ BIOS | NONE | BOTH | BDOS ]  
  3879.                term [ BIOS | NONE | BOTH | BDOS ]      
  3880.  
  3881.      Controls the builtin VT52 "emulated terminal" (described previously),
  3882.      whose I/O goes straight to the IBM PC screen via the IBM PC ROM BIOS
  3883.      routines and is therefore never seen by PCDOS.
  3884.  
  3885.      If BIOS is specified, then CP/M BIOS calls that deal with console input
  3886.      or output will be routed to the builtin VT52 terminal emulator. Cor-
  3887.      responding CP/M BDOS functions will go to PCDOS for handling.
  3888.  
  3889.      If NONE is specified, then neither CP/M BIOS calls nor CP/M BDOS       
  3890.      functions will be routed to the builtin VT52 terminal emulator. All
  3891.      will go to PCDOS for handling.
  3892.  
  3893.      If BOTH is specified, then console character CP/M BIOS calls and       
  3894.      corresponding CP/M BDOS functions will be routed to the builtin VT52
  3895.      terminal emulator. None will go to PCDOS for handling.
  3896.  
  3897.      If BDOS is specified, then CP/M BDOS calls that deal with console input
  3898.      or output will be routed to the builtin VT52 terminal emulator. Cor-
  3899.      responding CP/M BIOS functions will go to PCDOS for handling.
  3900.  
  3901.           NOTE: This command allows additional flexibility in configu-
  3902.           ring your CP/M programs to run under the Emulator. Some
  3903.           packages do console I/O via BIOS, others via BDOS. Now you
  3904.           can route either one to the builtin VT52 terminal emulator.
  3905.  
  3906.  
  3907.      Example: 
  3908.  
  3909.           Z80 A>term BOTH               
  3910.           Z80 A>terminal none           
  3911.  
  3912.  
  3913.  
  3914.  
  3915.  
  3916.  
  3917.  
  3918.  
  3919.  
  3920.  
  3921.  
  3922.  
  3923.  
  3924.  
  3925.  
  3926.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  3927.  
  3928.  
  3929.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 71
  3930.      BUILTIN COMMANDS: CP/M ENVIRONMENT CONTROL
  3931.  
  3932.  
  3933.       
  3934.      Builtin:  read [n] <filename.typ>  
  3935.                r [n] <filename.typ>     
  3936.       
  3937.      Reads data from specified file into the CP/M Segment, at address n.
  3938.       
  3939.      If n is absent, then it defaults to 0100. 
  3940.       
  3941.      This is the primary method used to load Z80 software for debugging. It
  3942.      is normally used to read Z80 command (.COM) files into memory, but this
  3943.      command will also read raw data files with no problem. 
  3944.       
  3945.      If <filename.typ> has a filetype of .HEX, then the file is assumed to be
  3946.      in standard Intel HEX format, and is loaded into memory at addresses
  3947.      specified by the HEX records. In such a case, the n argument may have no
  3948.      meaning.
  3949.       
  3950.      The n argument is a numeric value of the sort described at the beginning
  3951.      of this section. 
  3952.  
  3953.           NOTE: If a read of a file causes data to be read below 0100h
  3954.           or above FD00h, then the CP/M environment will be clobbered.
  3955.           If you're developing non-CP/M Z80 code, then who cares? If
  3956.           you're reading in a file that expects to call CP/M, however,
  3957.           then running the thing with a clobbered CP/M environment just
  3958.           might scramble the brains of the imaginary Z80.
  3959.       
  3960.      This command is used by us at CCS to load test versions of our Z80
  3961.      software, which we leave in .HEX format when we run L80. 
  3962.       
  3963.      Example: 
  3964.  
  3965.           Z80 A>read 100 820init.com           
  3966.       
  3967.                *** Low = 0100H  Next = 0380H 
  3968.                *** Z80 DMA, PC and Stack automatically set for .COM file 
  3969.  
  3970.           Z80 A>write 100 360 820init.hex      
  3971.       
  3972.                Writing HEX records for 0100H thru 0360H (609 bytes) to file
  3973.                '820INIT.HEX' 
  3974.  
  3975.           Z80 A>read 820init.hex               
  3976.       
  3977.                *** .HEX file Starting Address = 0100H 
  3978.                *** Low = 0100H  Next = 0360H 
  3979.  
  3980.  
  3981.  
  3982.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  3983.  
  3984.  
  3985.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 72
  3986.      BUILTIN COMMANDS: CP/M ENVIRONMENT CONTROL
  3987.  
  3988.  
  3989.       
  3990.      Builtin:  write nlow nhigh <filename.typ> 
  3991.                w nlow nhigh <filename.typ>     
  3992.       
  3993.      Write a block of CP/M memory to a disk file. 
  3994.       
  3995.      The bounds of the block to be written are specified by nlow and nhigh,
  3996.      which are numeric values as described at the start of this section.
  3997.       
  3998.      The specified block of memory is written from the CP/M Segment to the
  3999.      specified file. It is written as a pure memory image, unless a .HEX
  4000.      extension is supplied.
  4001.       
  4002.      Specifying a filename of type .HEX will cause an Intel HEX file to be
  4003.      written. The final record of the generated HEX file is the special
  4004.      HEX record which specifies the starting execution address of the
  4005.      program. This address is assumed to be nlow.
  4006.  
  4007.      Example: 
  4008.  
  4009.           Z80 A>read 100 820init.com           
  4010.       
  4011.                *** Low = 0100H  Next = 0380H 
  4012.                *** Z80 DMA, PC and Stack automatically set for .COM file 
  4013.  
  4014.           Z80 A>write 100 360 820init.hex      
  4015.       
  4016.                Writing HEX records for 0100H thru 0360H (609 bytes) to file
  4017.                '820INIT.HEX' 
  4018.  
  4019.           Z80 A>read 820init.hex               
  4020.       
  4021.                *** .HEX file Starting Address = 0100H 
  4022.                *** Low = 0100H  Next = 0360H 
  4023.  
  4024.  
  4025.  
  4026.  
  4027.  
  4028.  
  4029.  
  4030.  
  4031.  
  4032.  
  4033.  
  4034.  
  4035.  
  4036.  
  4037.  
  4038.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  4039.  
  4040.  
  4041.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 73
  4042.      BUILTIN COMMANDS: CP/M ENVIRONMENT CONTROL
  4043.  
  4044.  
  4045.       
  4046.      Builtin:  submit <filename.typ>           
  4047.                sub <filename.typ>              
  4048.       
  4049.      Switches input (for Emulator commands only) to the specified file.
  4050.  
  4051.      This is roughly equivalent to the CP/M SUBMIT.COM program, except that
  4052.      it is built into the Emulator. 
  4053.       
  4054.      Z80 application input via BDOS and BIOS does not get switched. Only
  4055.      Emulator input is switched. Submit files cannot be nested. 
  4056.       
  4057.      Input reverts to the standard input (as defined by PCDOS) when EOF is
  4058.      detected on the specified file. 
  4059.  
  4060.           NOTE: If a keypress is detected during submit file processing
  4061.           but outside of Z80 operation (i.e. - when the Emulator is
  4062.           expecting a command), then the submit file is aborted. This  
  4063.           is how you cancel a submit file - just press SPACE while it
  4064.           is running.
  4065.       
  4066.      Example: 
  4067.           Z80 A>submit script              
  4068.           Z80 A>sub c:\cpm\autoexec.z80    
  4069.  
  4070.  
  4071.  
  4072.  
  4073.  
  4074.  
  4075.  
  4076.  
  4077.  
  4078.  
  4079.  
  4080.  
  4081.  
  4082.  
  4083.  
  4084.  
  4085.  
  4086.  
  4087.  
  4088.  
  4089.  
  4090.  
  4091.  
  4092.  
  4093.  
  4094.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  4095.  
  4096.  
  4097.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 74
  4098.      BUILTIN COMMANDS: RESOURCE FACILITY COMMANDS
  4099.  
  4100.  
  4101.       
  4102.      Builtin:  list [n1 [n2]] [>outfile | >>outfile]  
  4103.                list prologue n1 n2 [>outfile | >>outfile] 
  4104.                list include [A][O][F]               
  4105.                l [n1 [n2]] [>outfile | >>outfile]   
  4106.                l prologue n1 n2 [>outfile | >>outfile]
  4107.                l include [A][O][F]  
  4108.       
  4109.      This is a multi-purpose disassembly command, which does one of three
  4110.      things (depending upon the arguments that are present):
  4111.       
  4112.           Lists disassembled Z80 object code (first form). 
  4113.       
  4114.           Generates an assembler prologue for the given range of Z80
  4115.           object code (second form). 
  4116.       
  4117.           Specifies fields to be included in disassembly lines (third
  4118.           form). 
  4119.       
  4120.  
  4121.  
  4122.      Format:  list [n1 [n2]] [>outfile | >>outfile]
  4123.               l [n1 [n2]] [>outfile | >>outfile]   
  4124.       
  4125.      This form causes the disassembly of Z80 object code from CP/M address n1
  4126.      through CP/M address n2 (both of which are numeric values as defined at
  4127.      the start of this section). If n2 is absent, then n2 is assumed to be
  4128.      n1+22. If n1 is absent, then it defaults to the next address to be
  4129.      disassembled (as left by last list command).  
  4130.       
  4131.      The generated disassembly is sent to (">outfile") or appended to
  4132.      (">>outfile") the specified output file. If an output file is not
  4133.      specified (no ">" character present), then the generated disassembly
  4134.      goes to the standard output as defined by PCDOS (normally the screen). 
  4135.  
  4136.           NOTE: Disassembly speed decreases as the size of the control
  4137.           table increases. It may also be slowed by PCDOS being so
  4138.           lethargic with screen output. When disassembling the Radio
  4139.           Shack Model 100's memory (which required a control table of
  4140.           about 42K), for instance, we were only getting about 2 lines
  4141.           of disassembled code per second. 
  4142.  
  4143.      Generated source code is suitable for input to M80.COM in .Z80 mode.
  4144.      Note, however, that any RST instructions use as their argument the
  4145.      final address being jumped to, not the RST number (as is customary).
  4146.      Also, there is no END statement supplied.
  4147.  
  4148.  
  4149.  
  4150.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  4151.  
  4152.  
  4153.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 75
  4154.      BUILTIN COMMANDS: RESOURCE FACILITY COMMANDS
  4155.  
  4156.  
  4157.       
  4158.      Format:  list prologue n1 n2 [>outfile | >>outfile]              
  4159.               l prologue n1 n2 [>outfile | >>outfile]               
  4160.       
  4161.      This form generates assembler source code suitable for inclusion at the
  4162.      front of a Z80 source file. The generated source code is the prologue
  4163.      for a given block of Z80 object code, defined by CP/M addresses n1 and
  4164.      n2. Both n1 and n2 are numeric values as defined at the start of this
  4165.      section. 
  4166.       
  4167.      The generated prologue contains equates for the various ASCII control
  4168.      characters. Additionally, it contains equated labels for any CP/M
  4169.      addresses that are referenced by the specified block of Z80 code (from
  4170.      n1 to n2), but not contained within it. 
  4171.       
  4172.      Such a prologue is generally needed at the front of any sizeable Z80
  4173.      disassembly. 
  4174.       
  4175.      The generated prologue is sent to (">outfile") or appended to (">>out- 
  4176.      file") the specified output file. If an output file is not specified,  
  4177.      (no ">" character present), then the generated prologue goes to the
  4178.      standard output as defined by PCDOS (normally the screen). 
  4179.  
  4180.  
  4181.       
  4182.      Format:  list include [A][O][F]               list include [A][O][F] 
  4183.               l include [A][O][F]               l include [A][O][F] 
  4184.       
  4185.      Specifies the fields to be included in disassembled Z80 instructions.
  4186.       
  4187.      If the "A" arg is present, then CP/M addresses will be included at the 
  4188.      left of disassembled instructions. 
  4189.       
  4190.      If the "O" argument is present, then raw opcodes will be included after
  4191.      the address (if present) but before the Z80 mnemonic. 
  4192.       
  4193.      If the "F" argument is present, then the disassembled Z80 instruction  
  4194.      will include a comment explaining the instruction's possible effect(s)
  4195.      on the Z80 flags.          
  4196.       
  4197.      Arguments after "include" may be whole words. Only the first character
  4198.      is checked. 
  4199.       
  4200.      If no arguments appear after "include", then the disassembled Z80     
  4201.      instruction will consist only of the mnemonic field. 
  4202.  
  4203.  
  4204.  
  4205.  
  4206.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  4207.  
  4208.  
  4209.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 76
  4210.      BUILTIN COMMANDS: RESOURCE FACILITY COMMANDS
  4211.  
  4212.  
  4213.       
  4214.      Example: 
  4215.           Z80 A>list include addresses             
  4216.           Z80 A>list include             
  4217.           Z80 A>l prologue 100 7ff       
  4218.           Z80 A>list prologue 0 ffff >model100.rom 
  4219.           Z80 A>list 0 ffff >>model100.rom         
  4220.           Z80 A>list              
  4221.  
  4222.  
  4223.           NOTE: The next section contains a sample Emulator session
  4224.           which generates source code from object code. Refer to it for
  4225.           more detail about this and related Resource commands.
  4226.  
  4227.  
  4228.  
  4229.  
  4230.  
  4231.  
  4232.  
  4233.  
  4234.  
  4235.  
  4236.  
  4237.  
  4238.  
  4239.  
  4240.  
  4241.  
  4242.  
  4243.  
  4244.  
  4245.  
  4246.  
  4247.  
  4248.  
  4249.  
  4250.  
  4251.  
  4252.  
  4253.  
  4254.  
  4255.  
  4256.  
  4257.  
  4258.  
  4259.  
  4260.  
  4261.  
  4262.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  4263.  
  4264.  
  4265.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 77
  4266.      BUILTIN COMMANDS: RESOURCE FACILITY COMMANDS
  4267.  
  4268.  
  4269.  
  4270.      Builtin:  control list [n]   
  4271.                control clear      
  4272.                control read <filepath>
  4273.                control write <filepath>
  4274.                control n     i | b | w | t | s | c
  4275.                c list [n]               
  4276.                c clear               
  4277.                c read <filepath>     
  4278.                c write <filepath>    
  4279.                c n     i | b | w | t | s | c 
  4280.       
  4281.      This is a multi-purpose command which manipulates the disassembly
  4282.      control table. 
  4283.       
  4284.      The disassembly control table holds CP/M addresses and any or all of the
  4285.      following which are associated with each address: 
  4286.       
  4287.           The data type of the Z80 object code at this address. This is
  4288.                called a "control break". 
  4289.       
  4290.           A symbolic label to be associated with the address. 
  4291.       
  4292.           A comment to be associated with the address. 
  4293.       
  4294.       
  4295.      This control table is used by the disassembler (the list command), and
  4296.      tells it how to format the source code while disassembling. 
  4297.       
  4298.      The various data type control breaks that may be associated with a CP/M
  4299.      address are as follows: 
  4300.       
  4301.           Instructions (executable Z80 code, disassembled as mnemonics)
  4302.       
  4303.           Bytes (disassembled as DB pseudo-ops) 
  4304.       
  4305.           Words (disassembled as DW pseudo-ops, multiple entries per
  4306.                line) 
  4307.       
  4308.           Table of Words (disassembled as DW pseudo-ops, one per line)
  4309.       
  4310.           Storage (disassembled as DS with argument large enough to
  4311.                bring it up to next control entry) 
  4312.       
  4313.       
  4314.      This is how the disassembler knows which parts of your Z80 object code
  4315.      are instructions, which are data, and which are irrelevant buffers etc. 
  4316.  
  4317.  
  4318.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  4319.  
  4320.  
  4321.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 78
  4322.      BUILTIN COMMANDS: RESOURCE FACILITY COMMANDS
  4323.  
  4324.  
  4325.      The specific formats are described below.
  4326.  
  4327.  
  4328.      Format:  control list [n]  
  4329.               c list [n]        
  4330.       
  4331.      This format of the command causes the Emulator to display all control
  4332.      table information that is currently known to it. If numeric value n (see
  4333.      definition of legal numeric values at start of this section) is present,
  4334.      then only control information associated with CP/M addresses greater
  4335.      than or equal to n are listed. 
  4336.       
  4337.      The list includes any control breaks, labels, and comments associated
  4338.      with the various CP/M addresses. 
  4339.       
  4340.  
  4341.  
  4342.      Format:  control clear     
  4343.               c clear           
  4344.       
  4345.      This format of the command clears out the control table, so that nothing
  4346.      is known about the Z80 object code. No CP/M addresses, control breaks,
  4347.      labels or comments are defined after this command is given. 
  4348.       
  4349.       
  4350.  
  4351.      Format:  control read <filepath>
  4352.               c read <filepath>      
  4353.       
  4354.      This format of the command causes the Emulator to read a control table
  4355.      from the specified filename. The file must have been created by a     
  4356.      "control write <filepath>" command. 
  4357.       
  4358.      A currently-defined control table is cleared before the new one is read
  4359.      from disk. It is not possible to merge control tables using this
  4360.      command. 
  4361.       
  4362.       
  4363.  
  4364.  
  4365.  
  4366.  
  4367.  
  4368.  
  4369.  
  4370.  
  4371.  
  4372.  
  4373.  
  4374.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  4375.  
  4376.  
  4377.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 79
  4378.      BUILTIN COMMANDS: RESOURCE FACILITY COMMANDS
  4379.  
  4380.  
  4381.      Format:  control write <filepath>   
  4382.               c write <filepath>         
  4383.       
  4384.      This command writes the current control table to the specified file, for
  4385.      later input via the "control read <filepath>" command. All known data is
  4386.      written - CP/M addresses, control breaks, labels and comments. 
  4387.       
  4388.       
  4389.  
  4390.      Format:  control n     i | b | w | t | s | c        
  4391.               c n     i | b | w | t | s | c              
  4392.       
  4393.      This format of the command is the real workhorse of control table
  4394.      maintenance. It associates a Z80 data type with CP/M address n, which is
  4395.      a numeric value as defined at the start of this section. 
  4396.       
  4397.      The argument following CP/M address n is a directive to the disassembler
  4398.      (the list command), and may be any one of the following (note that only 
  4399.      the first character is required): 
  4400.       
  4401.           Instructions: switch to Z80 mnemonics when you get to this         
  4402.                address. 
  4403.       
  4404.           Bytes: switch to DB pseudo-ops when you get to this address.       
  4405.       
  4406.           Words: switch to DW pseudo-ops (multiple per line) when you        
  4407.                get to this address. 
  4408.       
  4409.           Table of words: switch to DW pseudo-ops (one per line) when        
  4410.                you get to this address. This is useful for jump tables,
  4411.                etc, where you want the source code to be neatly ar-
  4412.                ranged. 
  4413.       
  4414.           Storage: do a single DS (define storage) pseudo-op when you
  4415.                get to this address, and make the size field big enough
  4416.                to take you up to the next control break address (or the
  4417.                end of the disassembly, whichever is lower). 
  4418.  
  4419.       
  4420.      You may also specify a special argument, which is handled immediately
  4421.      and never gets to the disassembler: 
  4422.       
  4423.           Clear: Clear this address's control break data type. This does
  4424.                not remove an associated label or comment. It just undoes
  4425.                any control break (of one of the above types) associated
  4426.                with this CP/M address. 
  4427.       
  4428.       
  4429.  
  4430.     COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  4431.  
  4432.  
  4433.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 80
  4434.      BUILTIN COMMANDS: RESOURCE FACILITY COMMANDS
  4435.  
  4436.  
  4437.  
  4438.      Example: 
  4439.           Z80 A>control list     
  4440.           Z80 A>c clear          
  4441.           Z80 A>c read b:\model100\model100.ctl
  4442.           Z80 A>control write foo.ctl          
  4443.           Z80 A>c read xyz                
  4444.           Z80 A>control 100 Instructions  
  4445.           Z80 A>c 103 b               
  4446.           Z80 A>c table_start+1 S     
  4447.           Z80 A>CONTROL bios_address W
  4448.           Z80 A>c FF00 Table          
  4449.           Z80 A>c 103 clear           
  4450.  
  4451.  
  4452.  
  4453.  
  4454.           NOTE: The next section contains a sample Emulator session
  4455.           which generates source code from object code. Refer to it for
  4456.           more detail about this and related Resource commands.
  4457.       
  4458.  
  4459.  
  4460.  
  4461.  
  4462.  
  4463.  
  4464.  
  4465.  
  4466.  
  4467.  
  4468.  
  4469.  
  4470.  
  4471.  
  4472.  
  4473.  
  4474.  
  4475.  
  4476.  
  4477.  
  4478.  
  4479.  
  4480.  
  4481.  
  4482.  
  4483.  
  4484.  
  4485.  
  4486.    COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  4487.  
  4488.  
  4489.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 81
  4490.      BUILTIN COMMANDS: RESOURCE FACILITY COMMANDS
  4491.  
  4492.  
  4493.       
  4494.      Builtin:  label n [label_name]  
  4495.                label autogen n1 n2   
  4496.                = n [label_name]      
  4497.                = autogen n1 n2       
  4498.       
  4499.      This command controls the assignment of symbolic label names to various
  4500.      CP/M addresses. Symbolic labels may be used as numeric values in many
  4501.      Emulator commands. They are also used by the disassembler when creating
  4502.      source code from Z80 object code. 
  4503.  
  4504.  
  4505.       
  4506.       
  4507.      Format:  label n [label_name]   
  4508.               = n [label_name]       
  4509.       
  4510.      This format associates label_name with CP/M address n, which is a
  4511.      numeric value as described at the start of this section. 
  4512.       
  4513.      Label names may be up to 32 characters in length. They must contain only
  4514.      alphanumeric characters and the underscore character "_". 
  4515.       
  4516.      If label_name is absent in this command, then any existing label name
  4517.      associated with the specified CP/M address is simply deleted. 
  4518.       
  4519.       
  4520.       
  4521.       
  4522.      Format:  label autogen n1 n2    
  4523.               = autogen n1 n2        
  4524.       
  4525.      This format causes the Emulator to automatically generate labels (of
  4526.      format AUTOxxxx) for all unlabeled CP/M addresses that are referenced by
  4527.      the block of Z80 code that starts at n1 and ends at n2 (both of which
  4528.      are numeric values as defined at the start of this section). 
  4529.       
  4530.      Labels that are generated are automatically entered into the current
  4531.      control table. Existing labels will not be altered. 
  4532.       
  4533.      This is a quick way to create labels. It can be useful for rapid
  4534.      generation of readable source code from Z80 object code. You should,
  4535.      however, define any recognizable labels before using this command. You
  4536.      should also make sure that you have pretty accurately defined all
  4537.      control breaks that apply to the specified block of Z80 code. There's
  4538.      nothing worse than getting a block of data confused with instructions,
  4539.      and having this command generate a few hundred bogus labels by misinter-
  4540.      preting the Z80 code. 
  4541.  
  4542.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  4543.  
  4544.  
  4545.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 82
  4546.      BUILTIN COMMANDS: RESOURCE FACILITY COMMANDS
  4547.  
  4548.  
  4549.       
  4550.      So this is generally the last thing that you do before deciding that
  4551.      you have finished disassembling a complete Z80 program. 
  4552.       
  4553.  
  4554.  
  4555.           NOTE: 16-bit literals will be ignored. There's no way - short
  4556.           of human inspection - to tell if the 16-bit value is meant to
  4557.           be a Z80 address or just a binary value (like a loop counter).
  4558.           In previous versions of the Emulator, there were too many
  4559.           bogus labels being autogen'd from 16-bit literals. Now it is  
  4560.           up to you to decide whether a particular 16-bit literal
  4561.           should have a label associated with it. Specifically, the
  4562.           following instructions' 16-bit literals are ignored:
  4563.  
  4564.                     LD   IX,nn
  4565.                     LD   IY,nn
  4566.                     LD   BC,nn
  4567.                     LD   DE,nn
  4568.                     LD   HL,nn
  4569.                     LD   SP,nn
  4570.  
  4571.  
  4572.      Example: 
  4573.           Z80 A>= 100 program_entry          
  4574.           Z80 A>label 7ff program_end        
  4575.           Z80 A>= 0 warm_boot_jump           
  4576.           Z80 A>= 5C FCB1              
  4577.           Z80 A>= 5 BDOS               
  4578.           Z80 A>label autogen 100 7ff  
  4579.  
  4580.  
  4581.  
  4582.  
  4583.           NOTE: The next section contains a sample Emulator session
  4584.           which generates source code from object code. Refer to it for
  4585.           more detail about this and related Resource commands.
  4586.  
  4587.  
  4588.  
  4589.  
  4590.  
  4591.  
  4592.  
  4593.  
  4594.  
  4595.  
  4596.  
  4597.  
  4598.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  4599.  
  4600.  
  4601.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 83
  4602.      BUILTIN COMMANDS: RESOURCE FACILITY COMMANDS
  4603.  
  4604.  
  4605.  
  4606.      Builtin:  comment n ["text"]      
  4607.                ; n ["text"]            
  4608.       
  4609.      Associates source-code comment "text" with CP/M address n, which is a 
  4610.      numeric value as defined at the start of this section. "text" may be up
  4611.      to 254 characters long. 
  4612.       
  4613.      If "text" is absent, then any existing comment associated with address n
  4614.      is simply deleted. 
  4615.       
  4616.      Note that "text" must be enclosed in double quotes. It may include      
  4617.      escape sequences as follows: 
  4618.       
  4619.           \\             Single "\" char 
  4620.           \0             NUL byte 
  4621.           \b or \B       Backspace char 
  4622.           \t or \T       Tab char 
  4623.           \n or \N       Linefeed char 
  4624.           \r or \R       Return char 
  4625.           \'             Single quote char 
  4626.           \"             Double quote char 
  4627.           \xFF or \XFF   Byte with HEX value FF 
  4628.       
  4629.      These escape codes made be used to make the comment more readable.
  4630.  
  4631.       
  4632.      When a comment is detected by the disassembler, it will be printed in
  4633.      one of two places: 
  4634.       
  4635.           As a single-line comment, after the mnemonic. Such a comment
  4636.                replaces the flags comment field (if present). If "text"      
  4637.                starts with other than a "\n" escape, then the comment is
  4638.                printed in this manner. 
  4639.       
  4640.           As a multi-line comment, on lines before the instruction. If
  4641.                "text" starts with a "\n" escape, then the comment will       
  4642.                be printed in this manner. Blank comment lines (starting
  4643.                with ";") are automatically provided before and after the
  4644.                comment, and ";" characters are inserted after every "\n"
  4645.                or "\r" found in the "text" string.                           
  4646.       
  4647.       
  4648.      If you want to create a nice-looking multi-line comment, then imbed "\n"
  4649.      escapes as line delimiters, and "\t" escapes to line things up on
  4650.      succeeding lines. 
  4651.       
  4652.  
  4653.  
  4654.     COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  4655.  
  4656.  
  4657.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 84
  4658.      BUILTIN COMMANDS: RESOURCE FACILITY COMMANDS
  4659.  
  4660.  
  4661.      If your comment is intended to be a single-line comment appended to the
  4662.      disassembled instruction's mnemonic, then avoid imbedded "\n" and "\r"
  4663.      escapes. 
  4664.  
  4665.       
  4666.      Example: 
  4667.           Z80 A>comment 100 "\nStart of main program"   
  4668.           Z80 A>; 0 "Jump to BIOS Warm, Start"          
  4669.           Z80 A>; 100                 ; 100
  4670.           Z80 A>comment ff00 "\nBIOS Jump Table\n\n\t3 bytes per JMP"
  4671.  
  4672.  
  4673.  
  4674.  
  4675.  
  4676.           NOTE: The next section contains a sample Emulator session
  4677.           which generates source code from object code. Refer to it for
  4678.           more detail about this and related Resource commands.
  4679.  
  4680.  
  4681.  
  4682.  
  4683.  
  4684.  
  4685.  
  4686.  
  4687.  
  4688.  
  4689.  
  4690.  
  4691.  
  4692.  
  4693.  
  4694.  
  4695.  
  4696.  
  4697.  
  4698.  
  4699.  
  4700.  
  4701.  
  4702.  
  4703.  
  4704.  
  4705.  
  4706.  
  4707.  
  4708.  
  4709.  
  4710.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  4711.  
  4712.                                                                      
  4713.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 85
  4714.      USING THE RESOURCE BUILTIN COMMANDS
  4715.  
  4716.  
  4717.       
  4718.  
  4719.  
  4720.  
  4721.  
  4722.  
  4723.  
  4724.  
  4725.  
  4726.  
  4727.                       USING THE RESOURCE BUILTIN COMMANDS            
  4728.  
  4729.  
  4730.      This section presents an example of re-sourcing a piece of Z80 object
  4731.      code. It demonstrates the use of the various Emulator builtin commands
  4732.      that deal with regenerating source code from object code.
  4733.  
  4734.      We were recently presented with a piece of software which (wouldn't you
  4735.      know it?) existed only in object form on a Xerox 820 CP/M system. The
  4736.      owner of this little utility really wanted to move it to a 16-bit
  4737.      Hyperion system, cause the utility sets up a Z80 SIO and that's what the
  4738.      Hyperion has - an SIO.
  4739.  
  4740.      So he was wondering - could we regenerate the source code for this
  4741.      little beauty? What follows is an annotated record of the ensuing
  4742.      session:
  4743.  
  4744.  
  4745.  
  4746.           NOTE: The first step is to read the thing into Z80 memory
  4747.           with the Emulator, and clear any previous resource control
  4748.           breaks.
  4749.       
  4750.      Z80 C>read 100 820init.com       
  4751.       
  4752.      *** Low = 0100H  Next = 0380H 
  4753.      *** Z80 DMA, PC and Stack automatically set for .COM file 
  4754.      Z80 C>control clear            
  4755.       
  4756.      Z80 C>list include addresses opcodes 
  4757.  
  4758.  
  4759.  
  4760.  
  4761.  
  4762.  
  4763.  
  4764.  
  4765.  
  4766.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  4767.  
  4768.  
  4769.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 86
  4770.      USING THE RESOURCE BUILTIN COMMANDS
  4771.  
  4772.  
  4773.           NOTE: The next thing to do is take a quick look at the
  4774.           program, and get a general feel for what it does.
  4775.       
  4776.      Z80 C>list            list
  4777.       
  4778.      L0100:     11 45 02              LD     DE,L0245 
  4779.      L0103:     CD 40 02              CALL   L0240 
  4780.      L0106:     11 C8 02              LD     DE,L02C8 
  4781.      L0109:     CD 40 02              CALL   L0240 
  4782.      L010C:     CD 35 02              CALL   L0235 
  4783.      L010F:     FE 0D                 CP     CR 
  4784.      L0111:     C2 16 01              JP     NZ,L0116 
  4785.      L0114:     3E 36                 LD     A,'6' 
  4786.      L0116:     D6 30                 SUB    '0' 
  4787.  
  4788.  
  4789.  
  4790.           NOTE: This isn't real promising. Let's dump the thing and
  4791.           look for obvious ASCII strings.
  4792.  
  4793.      Z80 C>d 100 37f            d 100 37f
  4794.       
  4795.      ADDR  00 01 02 03 04 05 06 07  08 09 0A 0B 0C 0D 0E 0F 01234567 89ABCDEF
  4796.      ----  -- -- -- -- -- -- -- --  -- -- -- -- -- -- -- -- -------- --------
  4797.      0100: 11 45 02 CD 40 02 11 C8  02 CD 40 02 CD 35 02 FE .E.M@..H .M@.M5.~
  4798.      0110: 0D C2 16 01 3E 36 D6 30  FE 00 DA 06 01 FE 0A D2 .B..>6V0 ~.Z..~.R
  4799.      0120: 06 01 32 58 03 11 EF 02  CD 40 02 CD 35 02 FE 0D ..2X..o. M@.M5.~.
  4800.      0130: C2 35 01 3E 4E FE 45 CA  47 01 FE 4F CA 47 01 FE B5.>N~EJ G.~OJG.~
  4801.      0140: 4E CA 47 01 C3 25 01 32  5A 03 11 16 03 CD 40 02 NJG.C%.2 Z....M@.
  4802.      0150: CD 35 02 FE 0D C2 5A 01  3E 38 D6 30 FE 07 CA 69 M5.~.BZ. >8V0~.Ji
  4803.      0160: 01 FE 08 CA 69 01 C3 4A  01 32 59 03 3A 58 03 FE .~.Ji.CJ .2Y.:X.~
  4804.      0170: 00 C2 79 01 3E 0F C3 B7  01 FE 01 C2 83 01 3E 0E .By.>.C7 .~.B..>.
  4805.      0180: C3 B7 01 FE 02 C2 8D 01  3E 0C C3 B7 01 FE 03 C2 C7.~.B.. >.C7.~.B
  4806.      0190: 97 01 3E 0A C3 B7 01 FE  04 C2 A1 01 3E 07 C3 B7 ..>.C7.~ .B!.>.C7
  4807.      01A0: 01 FE 05 C2 AB 01 3E 06  C3 B7 01 FE 06 C2 B5 01 .~.B+.>. C7.~.B5.
  4808.      01B0: 3E 05 C3 B7 01 3E 02 32  58 03 3A 5A 03 FE 45 C2 >.C7.>.2 X.:Z.~EB
  4809.      01C0: C7 01 3E 03 C3 D3 01 FE  4F C2 D1 01 3E 01 C3 D3 G.>.CS.~ OBQ.>.CS
  4810.      01D0: 01 3E 00 32 5A 03 3A 59  03 FE 07 CA EB 01 3E 60 .>.2Z.:Y .~.Jk.>`
  4811.      01E0: 32 5B 03 3E C0 32 5C 03  C3 F5 01 3E 20 32 5B 03 2[.>@2\.  Cu.>2[.
  4812.      01F0: 3E 40 32 5C 03 F3 3E 18  D3 06 D3 06 3E 01 D3 06 >@2\.s>. S.S.>.S.
  4813.      0200: AF D3 06 3E 04 D3 06 3A  5A 03 C6 44 D3 06 3E 03 /S.>.S.: Z.FDS.>.
  4814.      0210: D3 06 3A 5C 03 C6 01 D3  06 3E 05 D3 06 3A 5B 03 S.:\.F.S .>.S.:[.
  4815.      0220: C6 8A D3 06 3E 47 D3 00  3A 58 03 D3 00 FB 11 3D F.S.>GS. :X.S.{.=
  4816.      0230: 03 CD 40 02 C9 0E 01 CD  05 00 FE 60 D8 D6 20 C9 .M@.I..M  ..~`XVI
  4817.      0240: 0E 09 C3 05 00 1A 49 4E  49 54 20 31 2E 30 20 66 ..C...IN  IT 1.0f
  4818.      0250: 6F 72 20 58 65 72 6F 78  20 38 32 30 0D 0A 0A 0A or Xerox  820....
  4819.      0260: 0D 0A 42 61 75 64 20 52  61 74 65 73 3A 0D 0A 31 ..Baud R ates:..1
  4820.      0270: 39 32 30 30 20 3D 20 30  0D 0A 39 36 30 30 20 20 9200 = 0 ..9600 
  4821.  
  4822.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  4823.  
  4824.  
  4825.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 87
  4826.      USING THE RESOURCE BUILTIN COMMANDS
  4827.  
  4828.  
  4829.      0280: 3D 20 31 0D 0A 34 38 30  30 20 20 3D 20 32 0D 0A = 1..480 0  = 2..
  4830.      0290: 32 34 30 30 20 20 3D 20  33 0D 0A 31 32 30 30 20 2400  =  3..1200
  4831.      02A0: 20 3D 20 34 0D 0A 20 36  30 30 20 20 3D 20 35 0D  = 4.. 6 00  = 5.
  4832.      02B0: 0A 20 33 30 30 20 20 3D  20 36 0D 0A 20 31 31 30 . 300  =  6.. 110
  4833.      02C0: 20 20 3D 20 37 0D 0A 24  0D 0A 53 65 6C 65 63 74   = 7..$ ..Select
  4834.      02D0: 20 62 61 75 64 20 72 61  74 65 20 20 20 20 20 20  baud ra te     
  4835.      02E0: 20 20 20 20 20 28 31 2D  39 29 3A 20 36 08 24 0D      (1- 9): 6.$.
  4836.      02F0: 0A 53 65 6C 65 63 74 20  70 61 72 69 74 79 20 20 .Select  parity 
  4837.      0300: 28 4F 64 64 2C 20 45 76  65 6E 2C 20 4E 6F 6E 65 (Odd, Ev en, None
  4838.      0310: 29 3A 20 4E 08 24 0D 0A  53 65 6C 65 63 74 20 77 ): N.$.. Select w
  4839.      0320: 6F 72 64 20 6C 65 6E 67  74 68 20 20 20 20 20 20 ord leng th     
  4840.      0330: 28 37 20 6F 72 20 38 29  3A 20 38 08 24 0D 0A 43 (7 or 8) : 8.$..C
  4841.      0340: 6F 6D 6D 75 6E 69 63 61  74 69 6F 6E 73 20 70 6F ommunica tions po
  4842.      0350: 72 74 20 73 65 74 2E 24  00 00 00 00 00 00 00 00 rt set.$ ........
  4843.      0360: 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 ........ ........
  4844.      0370: 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 ........ ........
  4845.  
  4846.  
  4847.  
  4848.  
  4849.  
  4850.           NOTE: Well, there are some strings that are terminated with
  4851.           dollar signs. This is a heavy hint that these strings are to
  4852.           be displayed by BDOS function 9. Let's start our control
  4853.           table by filling in what we know so far...
  4854.  
  4855.  
  4856.      Z80 C>c 100 instructions          
  4857.       
  4858.      Z80 C>= 100 startup           
  4859.       
  4860.      Z80 C>c 245 b           
  4861.       
  4862.      Z80 C>= 245 init_msg          (Give them sensible names) 
  4863.       
  4864.      Z80 C>= 2c8 baud_prompt 
  4865.       
  4866.      Z80 C>= 2ef parity_prompt
  4867.       
  4868.      Z80 C>= 316 databits_prompt
  4869.       
  4870.      Z80 C>= 33d wrapup_msg     
  4871.       
  4872.  
  4873.  
  4874.  
  4875.  
  4876.  
  4877.  
  4878.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  4879.  
  4880.  
  4881.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 88
  4882.      USING THE RESOURCE BUILTIN COMMANDS
  4883.  
  4884.  
  4885.  
  4886.           NOTE: Now let's look at the first code bytes again, and see
  4887.           if they make any more sense.
  4888.  
  4889.      Z80 C>l 100            
  4890.       
  4891.       
  4892.                     STARTUP: 
  4893.      L0100:     11 45 02              LD     DE,INIT_MSG 
  4894.      L0103:     CD 40 02              CALL   L0240 
  4895.      L0106:     11 C8 02              LD     DE,BAUD_PROMPT 
  4896.      L0109:     CD 40 02              CALL   L0240 
  4897.      L010C:     CD 35 02              CALL   L0235 
  4898.      L010F:     FE 0D                 CP     CR 
  4899.      L0111:     C2 16 01              JP     NZ,L0116 
  4900.      L0114:     3E 36                 LD     A,'6' 
  4901.      L0116:     D6 30                 SUB    '0' 
  4902.  
  4903.  
  4904.  
  4905.  
  4906.           NOTE: So the routine at 0240h does something with a "$"-
  4907.           terminated string. Need we guess?
  4908.  
  4909.      Z80 C>l 240            
  4910.       
  4911.      L0240:     0E 09                 LD     C,TAB 
  4912.      L0242:     C3 05 00              JP     L0005 
  4913.       
  4914.                     INIT_MSG: 
  4915.                          DB     SUB,"INIT 1.0 for Xero" 
  4916.      L0245:     1A 49 4E 49  
  4917.      L0249:     54 20 31 2E  
  4918.      L024D:     30 20 66 6F  
  4919.      L0251:     72 20 58 65  
  4920.      L0255:     72 6F             
  4921.  
  4922.  
  4923.           NOTE: First of all, note how the above disassembly changed
  4924.           from instructions to data, just as we told it to. Note also
  4925.           that this routine at 0240h is simple enough to document...
  4926.  
  4927.      Z80 C>= 5 bdos         
  4928.       
  4929.      Z80 C>; 240 "\nPrint $-terminated string at (DE)" 
  4930.       
  4931.      Z80 C>c 240 i         
  4932.       
  4933.  
  4934.     COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  4935.  
  4936.  
  4937.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 89
  4938.      USING THE RESOURCE BUILTIN COMMANDS
  4939.  
  4940.  
  4941.      Z80 C>= 240 print_string            = 240 print_string
  4942.       
  4943.      Z80 C>l 240 
  4944.       
  4945.       
  4946.                     PRINT_STRING: 
  4947.       
  4948.                     ;  
  4949.                     ; Print $-terminated string at (DE) 
  4950.                     ;  
  4951.      L0240:     0E 09                 LD     C,TAB 
  4952.      L0242:     C3 05 00              JP     BDOS 
  4953.       
  4954.                     INIT_MSG: 
  4955.                          DB     SUB,"INIT 1.0 for Xero" 
  4956.      L0245:     1A 49 4E 49  
  4957.      L0249:     54 20 31 2E  
  4958.      L024D:     30 20 66 6F  
  4959.      L0251:     72 20 58 65  
  4960.      L0255:     72 6F             
  4961.  
  4962.  
  4963.  
  4964.  
  4965.           NOTE: OK, one routine down. Referring back to our disassembly
  4966.           of the startup code, let's see what else we can figure out.
  4967.  
  4968.      Z80 C>= 106 get_baud_rate 
  4969.       
  4970.      Z80 C>l startup           
  4971.       
  4972.       
  4973.                     STARTUP: 
  4974.      L0100:     11 45 02              LD     DE,INIT_MSG 
  4975.      L0103:     CD 40 02              CALL   PRINT_STRING 
  4976.       
  4977.                     GET_BAUD_RATE: 
  4978.      L0106:     11 C8 02              LD     DE,BAUD_PROMPT 
  4979.      L0109:     CD 40 02              CALL   PRINT_STRING 
  4980.      L010C:     CD 35 02              CALL   L0235 
  4981.      L010F:     FE 0D                 CP     CR 
  4982.      L0111:     C2 16 01              JP     NZ,L0116 
  4983.      L0114:     3E 36                 LD     A,'6' 
  4984.      L0116:     D6 30                 SUB    '0' 
  4985.  
  4986.  
  4987.  
  4988.  
  4989.  
  4990.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  4991.  
  4992.  
  4993.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 90
  4994.      USING THE RESOURCE BUILTIN COMMANDS
  4995.  
  4996.  
  4997.           NOTE: We have another routine to decipher - at 0235h.
  4998.  
  4999.      Z80 C>l 235            
  5000.       
  5001.      L0235:     0E 01                 LD     C,SOH 
  5002.      L0237:     CD 05 00              CALL   BDOS 
  5003.      L023A:     FE 60                 CP     '`' 
  5004.      L023C:     D8                    RET    C 
  5005.      L023D:     D6 20                 SUB    ' ' 
  5006.      L023F:     C9                    RET 
  5007.       
  5008.                     PRINT_STRING: 
  5009.       
  5010.                     ;  
  5011.                     ; Print $-terminated string at (DE) 
  5012.                     ;  
  5013.      L0240:     0E 09                 LD     C,TAB 
  5014.      L0242:     C3 05 00              JP     BDOS 
  5015.       
  5016.                     INIT_MSG: 
  5017.                          DB     SUB,"INIT 1" 
  5018.      L0245:     1A 49 4E 49  
  5019.      L0249:     54 20 31          
  5020.  
  5021.  
  5022.  
  5023.  
  5024.           NOTE: Notice how the disassembly continued way past the end
  5025.           of our routine. That's because we didn't give an ending
  5026.           address. At any rate, the routine at 0235h appears to call
  5027.           BDOS to get a keypress, then force it to uppercase. It
  5028.           contains a slight bug, but our job right now is to re-source
  5029.           it, not fix it.
  5030.  
  5031.      Z80 C>= 235 get_bdos_keypress
  5032.       
  5033.      Z80 C>c 235 i            
  5034.       
  5035.      Z80 C>; 235 "\nReturn next keypress as Uppercase char in A-reg"    
  5036.       
  5037.      Z80 C>; 237 "Use BDOS to get next keypress" 
  5038.       
  5039.      Z80 C>; 23a "Is it lowercase char?"         
  5040.       
  5041.      Z80 C>; 23c "No, return it as-is"           
  5042.       
  5043.      Z80 C>; 23d "Yes, convert to uppercase"     
  5044.       
  5045.  
  5046.     COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  5047.  
  5048.  
  5049.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 91
  5050.      USING THE RESOURCE BUILTIN COMMANDS
  5051.  
  5052.  
  5053.      Z80 C>l 235 
  5054.       
  5055.       
  5056.                     GET_BDOS_KEYPRESS: 
  5057.       
  5058.                     ;  
  5059.                     ; Return next keypress as Uppercase char in A-reg
  5060.                     ;  
  5061.      L0235:    0E 01                LD    C,SOH 
  5062.      L0237:    CD 05 00             CALL  BDOS    ;Use BDOS to get next
  5063.                                                             keypress
  5064.      L023A:    FE 60                CP    '`'     ;Is it lowercase char?
  5065.      L023C:    D8                   RET   C       ;No, return it as-is
  5066.      L023D:    D6 20                SUB   ' '     ;Yes, convert to uppercase
  5067.      L023F:    C9                   RET 
  5068.       
  5069.                     PRINT_STRING: 
  5070.       
  5071.                     ;  
  5072.                     ; Print $-terminated string at (DE) 
  5073.                     ;  
  5074.      L0240:     0E 09                 LD     C,TAB 
  5075.      L0242:     C3 05 00              JP     BDOS 
  5076.       
  5077.                     INIT_MSG: 
  5078.                          DB     SUB,"INIT 1" 
  5079.      L0245:     1A 49 4E 49  
  5080.      L0249:     54 20 31          
  5081.                    
  5082.  
  5083.  
  5084.  
  5085.  
  5086.           NOTE: OK, our little routines are understood and documented.
  5087.           Back to the main code, and add comments that clarify things.
  5088.  
  5089.      Z80 C>; 100 "Give intro screen"
  5090.       
  5091.      Z80 C>; 106 "Ask for baudrate value"
  5092.       
  5093.      Z80 C>; 10f "RETURN only?"          
  5094.       
  5095.      Z80 C>; 111 "No, look at keypress"  
  5096.       
  5097.      Z80 C>; 114 "Yes, use default value"
  5098.       
  5099.      Z80 C>= 116 edit_baud_rate          
  5100.       
  5101.  
  5102.     COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  5103.  
  5104.  
  5105.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 92
  5106.      USING THE RESOURCE BUILTIN COMMANDS
  5107.  
  5108.  
  5109.      Z80 C>l get_baud_rate 12b 
  5110.       
  5111.       
  5112.                     GET_BAUD_RATE: 
  5113.      L0106:   11 C8 02           LD     DE,BAUD_PROMPT ;Ask for baudrate
  5114.                                                                  value 
  5115.      L0109:   CD 40 02           CALL   PRINT_STRING 
  5116.      L010C:   CD 35 02           CALL   GET_BDOS_KEYPRESS 
  5117.      L010F:   FE 0D              CP     CR          ;RETURN only? 
  5118.      L0111:   C2 16 01           JP     NZ,EDIT_BAUD_RATE ;No, look at
  5119.                                                                  keypress 
  5120.      L0114:   3E 36              LD     A,'6'       ;Yes, use default
  5121.                                                                  value 
  5122.       
  5123.                     EDIT_BAUD_RATE: 
  5124.      L0116:   D6 30              SUB    '0' 
  5125.      L0118:   FE 00              CP     NUL 
  5126.      L011A:   DA 06 01           JP     C,GET_BAUD_RATE 
  5127.      L011D:   FE 0A              CP     LF 
  5128.      L011F:   D2 06 01           JP     NC,GET_BAUD_RATE 
  5129.      L0122:   32 58 03           LD     (L0358),A 
  5130.      L0125:   11 EF 02           LD     DE,PARITY_PROMPT 
  5131.      L0128:   CD 40 02           CALL   PRINT_STRING 
  5132.      L012B:   CD 35 02           CALL   GET_BDOS_KEYPRESS 
  5133.  
  5134.  
  5135.  
  5136.  
  5137.           NOTE: And so on, and so on, and so on....
  5138.  
  5139.  
  5140.  
  5141.      We'll not present all of the output here. Although the session actually
  5142.      lasted less than half an hour, the output is huge. Instead, let us skip
  5143.      ahead to the point where we've finished defining our control table.
  5144.  
  5145.  
  5146.  
  5147.  
  5148.           NOTE: At this point - having done all of this work to con-
  5149.           struct documentation of the object code - we should save the
  5150.           control table to disk!          ______________________
  5151.  
  5152.      Z80 C>control write 820init.ctl          
  5153.  
  5154.  
  5155.  
  5156.  
  5157.  
  5158.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  5159.  
  5160.  
  5161.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 93
  5162.      USING THE RESOURCE BUILTIN COMMANDS
  5163.  
  5164.  
  5165.           NOTE: Having done that, we must prepare things for the actual
  5166.           generation of the .ASM file. Specifically, we should exclude
  5167.           addresses, opcodes, and flags from disassembly source lines.
  5168.       
  5169.      Z80 C>list include         
  5170.  
  5171.  
  5172.  
  5173.           NOTE: Now we can disassemble the object code to disk as source
  5174.           code. First we write the prologue, and then the program
  5175.           itself:
  5176.       
  5177.      Z80 C>list prologue 100 360 >820init.asm    
  5178.       
  5179.      Z80 C>list 100 360 >>820init.asm            
  5180.  
  5181.  
  5182.           NOTE: Having done that, let's test things by running the .ASM
  5183.           file through M80.COM...
  5184.       
  5185.      Z80 C>m80 820init.rel,820init.prn=820init.asm
  5186.      %No END statement 
  5187.      %No END statement 
  5188.       
  5189.      No Fatal error(s) 
  5190.       
  5191.  
  5192.  
  5193.  
  5194.  
  5195.      That's it. We're done. The assembler version of 820INIT.COM has been
  5196.      written and verified.
  5197.  
  5198.      For your enjoyment, we have included with Z80MU the various 820INIT
  5199.      files that were used or created by the above session. Feel free to
  5200.      examine all of these files, especially 820INIT.ASM and 820INIT.PRN. They
  5201.      give you a good idea of the quality of source code that can be recreated
  5202.      from a given object program.
  5203.  
  5204.  
  5205.  
  5206.  
  5207.  
  5208.  
  5209.  
  5210.  
  5211.  
  5212.  
  5213.  
  5214.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  5215.  
  5216.  
  5217.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 94
  5218.      Appendix A: Layout of CP/M Segment
  5219.  
  5220.  
  5221.       
  5222.      Appendix A: Layout of Simulated CP/M Segment (as set by Cold Boot)  
  5223.       
  5224.      0000:     JMP  0FF03H         ;to our fake BIOS 
  5225.      0003:     DB   ?              ;IOBYTE 
  5226.      0004:     DB   ?              ;Login Byte (drive, User Number) 
  5227.      0005:     JMP  0FEFEH         ;to our fake BDOS 
  5228.      005C:     DB   ?              ;Default FCB 
  5229.      0080:     DB   ?              ;Default DMA and Command Tail 
  5230.      0100:     DB   ?              ;start of TPA 
  5231.      FEFD:     DB   ?              ;last byte of TPA 
  5232.      FEFE:     HALT                ;our BDOS hook 
  5233.      FEFF:     RET                 ;return from BDOS 
  5234.      FF00:     JMP  0FF80H         ;BIOS COLD BOOT vector 
  5235.      FF03:     JMP  0FF82H         ;BIOS WARM BOOT vector 
  5236.      FF06:     JMP  0FF84H         ;BIOS console status 
  5237.      FF09:     JMP  0FF86H         ;BIOS console input 
  5238.      FF0C:     JMP  0FF88H         ;BIOS console output 
  5239.      FF0F:     JMP  0FF8AH         ;BIOS list output 
  5240.      FF12:     JMP  0FF8CH         ;BIOS punch output 
  5241.      FF15:     JMP  0FF8EH         ;BIOS reader input 
  5242.      FF18:     JMP  0FF90H         ;BIOS home disk 
  5243.      FF1B:     JMP  0FF92H         ;BIOS select disk 
  5244.      FF1E:     JMP  0FF94H         ;BIOS set track 
  5245.      FF21:     JMP  0FF96H         ;BIOS set sector 
  5246.      FF24:     JMP  0FF98H         ;BIOS set DMA address 
  5247.      FF27:     JMP  0FF9AH         ;BIOS read sector 
  5248.      FF2A:     JMP  0FF9CH         ;BIOS write sector 
  5249.      FF2D:     JMP  0FF9EH         ;BIOS list status 
  5250.      FF30:     JMP  0FFA0H         ;BIOS (unimplemented) 
  5251.      FF33:     JMP  0FFA2H         ;BIOS (unimplemented) 
  5252.      FF36:     JMP  0FFA4H         ;BIOS (unimplemented) 
  5253.      FF39:     JMP  0FFA6H         ;BIOS (unimplemented) 
  5254.      FF3C:     JMP  0FFA8H         ;BIOS (unimplemented) 
  5255.      FF3F:     JMP  0FFAAH         ;BIOS (unimplemented) 
  5256.      FF42:     JMP  0FFACH         ;BIOS (unimplemented) 
  5257.      FF45:     JMP  0FFAEH         ;BIOS (unimplemented) 
  5258.      FF48:     JMP  0FFB0H         ;BIOS (unimplemented) 
  5259.      FF4B:     JMP  0FFB2H         ;BIOS (unimplemented) 
  5260.      FF4E:     JMP  0FFB4H         ;BIOS (unimplemented) 
  5261.      FF51:     JMP  0FFB6H         ;BIOS (unimplemented) 
  5262.      FF54:     JMP  0FFB8H         ;BIOS (unimplemented) 
  5263.      FF57:     JMP  0FFBAH         ;BIOS (unimplemented) 
  5264.      FF5A:     JMP  0FFBCH         ;BIOS (unimplemented) 
  5265.      FF5D:     JMP  0FFBEH         ;BIOS (unimplemented) 
  5266.      FF60:     JMP  0FFC0H         ;BIOS (unimplemented) 
  5267.      FF63:     JMP  0FFC2H         ;BIOS (unimplemented) 
  5268.      FF66:     JMP  0FFC4H         ;BIOS (unimplemented) 
  5269.  
  5270.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  5271.  
  5272.  
  5273.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 95
  5274.      Appendix A: Layout of CP/M Segment
  5275.  
  5276.  
  5277.      FF69:     JMP  0FFC6H         ;BIOS (unimplemented) 
  5278.      FF6C:     JMP  0FFC8H         ;BIOS (unimplemented) 
  5279.      FF6F:     JMP  0FFCAH         ;BIOS (unimplemented) 
  5280.      FF72:     JMP  0FFCCH         ;BIOS (unimplemented) 
  5281.      FF75:     JMP  0FFCEH         ;BIOS (unimplemented) 
  5282.      FF78:     JMP  0FFD0H         ;BIOS (unimplemented) 
  5283.      FF7B:     JMP  0FFD2H         ;BIOS (unimplemented) 
  5284.       
  5285.      FF80:     HALT                ;BIOS COLD BOOT hook 
  5286.      FF81:     RET 
  5287.      FF82:     HALT                ;BIOS WARM BOOT hook 
  5288.      FF83:     RET 
  5289.      FF84:     HALT                ;BIOS console status 
  5290.      FF85:     RET 
  5291.      FF86:     HALT                ;BIOS console input 
  5292.      FF87:     RET 
  5293.      FF88:     HALT                ;BIOS console output 
  5294.      FF89:     RET 
  5295.      FF8A:     HALT                ;BIOS list output 
  5296.      FF8B:     RET 
  5297.      FF8C:     HALT                ;BIOS punch output 
  5298.      FF8D:     RET 
  5299.      FF8E:     HALT                ;BIOS reader input 
  5300.      FF8F:     RET 
  5301.      FF90:     HALT                ;BIOS home disk 
  5302.      FF91:     RET 
  5303.      FF92:     HALT                ;BIOS select disk 
  5304.      FF93:     RET 
  5305.      FF94:     HALT                ;BIOS set track 
  5306.      FF95:     RET 
  5307.      FF96:     HALT                ;BIOS set sector 
  5308.      FF97:     RET 
  5309.      FF98:     HALT                ;BIOS set DMA address 
  5310.      FF99:     RET 
  5311.      FF9A:     HALT                ;BIOS read sector 
  5312.      FF9B:     RET 
  5313.      FF9C:     HALT                ;BIOS write sector 
  5314.      FF9D:     RET 
  5315.      FF9E:     HALT                ;BIOS list status 
  5316.      FF9F:     RET 
  5317.      FFA0:     HALT                ;BIOS (unimplemented) 
  5318.      FFA1:     RET 
  5319.      FFA2:     HALT                ;BIOS (unimplemented) 
  5320.      FFA3:     RET 
  5321.      FFA4:     HALT                ;BIOS (unimplemented) 
  5322.      FFA5:     RET 
  5323.      FFA6:     HALT                ;BIOS (unimplemented) 
  5324.      FFA7:     RET 
  5325.  
  5326.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  5327.  
  5328.  
  5329.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 96
  5330.      Appendix A: Layout of CP/M Segment
  5331.  
  5332.  
  5333.      FFA8:     HALT                ;BIOS (unimplemented) 
  5334.      FFA9:     RET 
  5335.      FFAA:     HALT                ;BIOS (unimplemented) 
  5336.      FFAB:     RET 
  5337.      FFAC:     HALT                ;BIOS (unimplemented) 
  5338.      FFAD:     RET 
  5339.      FFAE:     HALT                ;BIOS (unimplemented) 
  5340.      FFAF:     RET 
  5341.      FFB0:     HALT                ;BIOS (unimplemented) 
  5342.      FFB1:     RET 
  5343.      FFB2:     HALT                ;BIOS (unimplemented) 
  5344.      FFB3:     RET 
  5345.      FFB4:     HALT                ;BIOS (unimplemented) 
  5346.      FFB5:     RET 
  5347.      FFB6:     HALT                ;BIOS (unimplemented) 
  5348.      FFB7:     RET 
  5349.      FFB8:     HALT                ;BIOS (unimplemented) 
  5350.      FFB9:     RET 
  5351.      FFBA:     HALT                ;BIOS (unimplemented) 
  5352.      FFBB:     RET 
  5353.      FFBC:     HALT                ;BIOS (unimplemented) 
  5354.      FFBD:     RET 
  5355.      FFBE:     HALT                ;BIOS (unimplemented) 
  5356.      FFBF:     RET 
  5357.      FFC0:     HALT                ;BIOS (unimplemented) 
  5358.      FFC1:     RET 
  5359.      FFC2:     HALT                ;BIOS (unimplemented) 
  5360.      FFC3:     RET 
  5361.      FFC4:     HALT                ;BIOS (unimplemented) 
  5362.      FFC5:     RET 
  5363.      FFC6:     HALT                ;BIOS (unimplemented) 
  5364.      FFC7:     RET 
  5365.      FFC8:     HALT                ;BIOS (unimplemented) 
  5366.      FFC9:     RET 
  5367.      FFCA:     HALT                ;BIOS (unimplemented) 
  5368.      FFCB:     RET 
  5369.      FFCC:     HALT                ;BIOS (unimplemented) 
  5370.      FFCD:     RET 
  5371.      FFCE:     HALT                ;BIOS (unimplemented) 
  5372.      FFCF:     RET 
  5373.      FFD0:     HALT                ;BIOS (unimplemented) 
  5374.      FFD1:     RET 
  5375.      FFD2:     HALT                ;BIOS (unimplemented) 
  5376.      FFD3:     RET 
  5377.      FFD4:                         ;rest reserved for scratch use
  5378.  
  5379.  
  5380.  
  5381.  
  5382.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  5383.  
  5384.  
  5385.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 97
  5386.      Appendix B: Bugs and Future Plans
  5387.  
  5388.  
  5389.  
  5390.       
  5391.                         Appendix B: Bugs and Future Plans                
  5392.  
  5393.       
  5394.      This section describes known bugs and otherwise strange Emulator
  5395.      activity. Please help us to improve the product by sending us your own
  5396.      bug reports, with as much detail as possible (including programs
  5397.      which demonstrate the bug). 
  5398.       
  5399.      These bugs will be fixed as time allows and user interest demands.
  5400.  
  5401.       
  5402.           Issue: The disassembly (list) command can become quite pokey.  
  5403.                As the control table grows, disassembly speed decreases.
  5404.                When disassembling the Model 100's ROM, for instance, the
  5405.                poor disassembler is faced with a control table that is
  5406.                something bigger than 42K in size. It may have to
  5407.                search most of the table for each memory reference. This
  5408.                yields a disassembly speed of a line or two a second.
  5409.                Boo! The control table search routines should be changed
  5410.                from a sequential to an indexed method.
  5411.  
  5412.           Author's Response: Agreed. Will rewrite these for a future     
  5413.                release. 
  5414.       
  5415.  
  5416.           Issue: Some commands (notably those that accept a range of    
  5417.                CP/M addresses) get confused if they are asked to wrap
  5418.                around the high end of the 64K CP/M segment.
  5419.  
  5420.           Author's Response: Have applied fixes for most glaring 
  5421.                problems. Would appreciate specifics (i.e. - which
  5422.                commands fail, and how) to help track down the rest. 
  5423.       
  5424.  
  5425.           Issue: Internal I/O redirection (effected by the Emulator, not
  5426.                PCDOS) should be available for any Emulator command, not
  5427.                just the list command. 
  5428.                          
  5429.           Author's Response: Agreed. Will look into it.
  5430.  
  5431.  
  5432.  
  5433.  
  5434.  
  5435.  
  5436.  
  5437.  
  5438.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  5439.  
  5440.  
  5441.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 98
  5442.      Appendix B: Bugs and Future Plans
  5443.  
  5444.  
  5445.  
  5446.           Issue: The patch command ought to allow multiple entries per
  5447.                line, and ought to accept arguments on the patch command
  5448.                line without dropping into interactive patch mode. 
  5449.       
  5450.           Author's Response: Have provided left-handed solution by     
  5451.                allowing a patch string on same line as patch command.  
  5452.                True fix (with multiple byte values as independent args
  5453.                on command line) will take a while to implement.
  5454.  
  5455.  
  5456.           Issue: The Emulator lacks a mini assembler. It needs one.    
  5457.       
  5458.           Author's Response: Agreed. We just don't have the memory left 
  5459.                in the 64K Lattice code segment to do it right. Maybe
  5460.                after some major rework...
  5461.  
  5462.  
  5463.           Issue: The Emulator's main program ought to be rewritten in   
  5464.                Microsoft C version 3.0. This will speed it up consider-
  5465.                ably, and will make it a lot smaller. 
  5466.       
  5467.           Author's Response: Agreed. The major effort is in reworking   
  5468.                the assembler subroutines. There are a lot of places     
  5469.                where Lattice's calling conventions, register usage, and
  5470.                segments are assumed.
  5471.  
  5472.  
  5473.           Issue: It would be nice to somehow state to the Emulator that 
  5474.                what is in CP/M memory is actually an 8080 or 8085
  5475.                program. This would allow the 8085's RIM and SIM instruc-
  5476.                tions, for example, to be properly disassembled (instead
  5477.                of being misinterpreted as Z80 relative jumps). 
  5478.       
  5479.           Author's Response: Agreed. The biggest obstacle to doing this 
  5480.                is the same old bugaboo - no memory left in 64K code
  5481.                segment. Will put this off until we free up a couple of
  5482.                K in the code segment.
  5483.  
  5484.  
  5485.  
  5486.  
  5487.  
  5488.  
  5489.  
  5490.  
  5491.  
  5492.  
  5493.  
  5494.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  5495.  
  5496.  
  5497.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 99
  5498.      Appendix B: Bugs and Future Plans
  5499.  
  5500.  
  5501.  
  5502.  
  5503.           Issue: The loading of Z80 .COM files to be executed - in fact,
  5504.                any file load that is done directly or indirectly by the
  5505.                "read" command - is just too slow.                
  5506.  
  5507.           Author's Response: Agreed! This should be redone to bypass 
  5508.                Lattice C's slow I/O routines. This problem may go away
  5509.                if and when the Emulator is rewritten in Microsoft 'C'
  5510.                version 3.0.
  5511.       
  5512.  
  5513.           Issue: The disassembler can get confused when a multi-byte 
  5514.                opcode crosses a control break. In general, it reverts
  5515.                to DB pseudo ops up to the control break when this
  5516.                happens. Also, it's not too smart when disassembling
  5517.                code with addresses up around the 64K segment boundary.
  5518.       
  5519.           Author's Response: I have tried to locate and eliminate    
  5520.                peephole problems. The nature of the problem, however,
  5521.                goes to the very core of the disassembler as designed.
  5522.                This is not quickly (or cheaply) fixable.
  5523.  
  5524.  
  5525.           Issue: There are too many CP/M applications which abort    
  5526.                because they use BDOS functions 27/1Bh and 31/1Fh. These
  5527.                BDOS functions should be supported, even if they mean
  5528.                little on a PCDOS system.
  5529.  
  5530.           Author's Response: Agreed. The only reason that they haven't
  5531.                been emulated is that I have yet to find a sensible
  5532.                writeup of just exactly what the various data formats
  5533.                are. DRI's writeup stinks. If someone can provide a
  5534.                clear explanation of just what they truly mean, then
  5535.                I'll emulate them.
  5536.  
  5537.  
  5538.           Issue: There are more than 600 distinct instructions in the 
  5539.                Z80. Have they all been validated as to the accuracy of
  5540.                the emulation?
  5541.  
  5542.           Author's Response: So far, all we've done is run Z80 stuff and 
  5543.                try to guess that it has run fine. All opcodes have been
  5544.                desk-checked. Not all opcodes have been tested. Most, in
  5545.                fact, have not even been executed. Would somebody please  
  5546.                create a definitive test program? The diagnostics that
  5547.                we've tried (like Supersoft's) have proven to be inac-
  5548.                curate.
  5549.  
  5550.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  5551.  
  5552.  
  5553.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 100
  5554.      Appendix B: Bugs and Future Plans
  5555.  
  5556.  
  5557.  
  5558.  
  5559.           Issue: There should be an option to allow pagination of        
  5560.                disassembled object code.
  5561.  
  5562.           Author's Response: Agreed. Will look into another list include 
  5563.                option to specify pagination.
  5564.  
  5565.  
  5566.           Issue: Expressions are currently limited to "+" and "-"        
  5567.                operators. They should allow "*" and "/" also, and maybe
  5568.                even AND, OR, XOR, shifts, etc.
  5569.  
  5570.           Author's Response: I disagree. The amount of work involved     
  5571.                isn't justified by the benefit.
  5572.  
  5573.  
  5574.           Issue: The Z80 IN and OUT instructions should have access to   
  5575.                real 8088 I/O ports on the IBM PC.
  5576.  
  5577.           Author's Response: Over my dead body.      
  5578.  
  5579.  
  5580.           Issue: FCB+14 and FCB+15 aren't emulated properly. This keeps
  5581.                certain Microsoft-written subroutines from running.
  5582.  
  5583.           Author's Response: This has been fixed in release 2.1b, by   
  5584.                censoring PCDOS's use of these bytes.
  5585.  
  5586.  
  5587.           Issue: LU version 3.00 fails.          ______
  5588.  
  5589.           Author's Response: LU expects BDOS results to come back in   
  5590.                HL, not A. This is an undocumented facet of CP/M, but
  5591.                every version of CP/M that I tested does indeed return  
  5592.                results in HL as well as A. Fixed in Emulator release
  5593.                3.00 to return results in HL and A. Tested with LU, and
  5594.                it works fine.
  5595.  
  5596.  
  5597.           Issue: Some packages do full-screen I/O via BDOS, thus       
  5598.                missing the built-in VT52 emulator (which only responds
  5599.                to BIOS calls).
  5600.  
  5601.           Author's Response: Fixed. See the new "terminal" command,    
  5602.                which allows you to control who (BIOS or BDOS) goes
  5603.                through the VT52 emulator.
  5604.  
  5605.  
  5606.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  5607.  
  5608.  
  5609.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 101
  5610.      Appendix B: Bugs and Future Plans
  5611.  
  5612.  
  5613.  
  5614.           Issue: Clearing a single breakpoint causes the wrong one to  
  5615.                be removed.
  5616.  
  5617.           Author's Response: In improving the "break" command, I broke 
  5618.                this part of it. It is now fixed.
  5619.  
  5620.  
  5621.           Issue: Disassembler unreliable in version 3.00.          ______
  5622.  
  5623.           Author's Response: Due to a mistake made when compiling      
  5624.                version 3.00, we broke parts of the disassembler. It is
  5625.                fixed in version 3.10.
  5626.  
  5627.  
  5628.           Issue: Serial I/O via PCDOS is too slow! How about a full-   
  5629.                screen version of the Emulator?
  5630.  
  5631.           Author's Response: This is being developed, along with the   
  5632.                port to Microsoft C version 3.0.
  5633.  
  5634.  
  5635.           Issue: The Label AUTOGEN commands hangs if the ending address
  5636.                is 0FFFFh.
  5637.  
  5638.           Author's Response: Will be corrected in first Microsoft C    
  5639.                version 3.0 copy of the Emulator, as this is due to a bug
  5640.                in Lattice C and I've fixed enough Lattice bugs for one
  5641.                lifetime. 
  5642.  
  5643.  
  5644.           Issue: BDOS Function 10/0Ah (read buffered console input)    
  5645.                doesn't work like it does in CP/M. You must press RETURN
  5646.                before input is terminated.
  5647.  
  5648.           Author's Response: This has been fixed in release 3.10. This 
  5649.                BDOS function is now entirely emulated by the Z80 engine.
  5650.                Formerly, we just called PCDOS to do it.
  5651.  
  5652.  
  5653.           Issue: The stack does not contain a word of zeroes when a    
  5654.                .COM program is entered.
  5655.  
  5656.  
  5657.  
  5658.  
  5659.  
  5660.  
  5661.  
  5662.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  5663.  
  5664.  
  5665.      "Z80MU" Z80 and CP/M 2.2 Emulator User's Guide            Page 102
  5666.      Appendix B: Bugs and Future Plans
  5667.  
  5668.  
  5669.           Author's Response: The stack pointer is set to FEFC. A word  
  5670.                of zeroes is then stored there via:
  5671.  
  5672.                     cpm[0xfefc] = 0;    /* Put word of zeroes */
  5673.                     cpm[0xfefd] = 0;
  5674.  
  5675.                Lattice C, however, takes the hex literals as signed
  5676.                ints, and stores our zeroes into who knows where. This
  5677.                is all the more reason to dump this bad C compiler and
  5678.                move to Microsoft v3.0 C. Anyway, the zero word is now
  5679.                on the stack in version 3.10.
  5680.  
  5681.  
  5682.           Issue: The Emulator's VT52 terminal uses ESC F to clear the  
  5683.                screen. This isn't what a real VT52 uses.
  5684.  
  5685.           Author's Response: Fixed in release 3.10 to use ESC E. The Ze-
  5686.                nith Z-89 manual used as the VT52 reference contained a
  5687.                typo, and I coded from it.
  5688.  
  5689.  
  5690.  
  5691.  
  5692.  
  5693.  
  5694.  
  5695.  
  5696.  
  5697.  
  5698.  
  5699.  
  5700.  
  5701.  
  5702.  
  5703.  
  5704.  
  5705.  
  5706.  
  5707.  
  5708.  
  5709.  
  5710.  
  5711.  
  5712.  
  5713.  
  5714.  
  5715.  
  5716.  
  5717.  
  5718.      COMPUTERWISE CONSULTING SERVICES, P.O. BOX 813, MCLEAN, VA 22101
  5719.  
  5720.