Browse Source

Add VGA3 Support

patch
Wayne Warthen 9 years ago
parent
commit
fb6b1fd54a
  1. 107
      Binary/ReadMe.txt
  2. 303
      Binary/RomList.txt
  3. 350
      Doc/Build.txt
  4. BIN
      Doc/CPM 22 Manual.pdf
  5. BIN
      Doc/CPM Manual.pdf
  6. 2
      Doc/Contrib/ZSystem.txt
  7. BIN
      Doc/FDisk Manual.pdf
  8. 42
      Doc/ReadMe.txt
  9. BIN
      Doc/RomWBW System Guide.pdf
  10. BIN
      Doc/RomWBW User Guide.pdf
  11. BIN
      Doc/ZCPR Manual.pdf
  12. 674
      GPL-3.0.txt
  13. 409
      ReadMe.txt
  14. BIN
      Source/BPBIOS/@WBW BPBIOS Errata.rtf
  15. 23
      Source/BPBIOS/Build.cmd
  16. 5
      Source/BPBIOS/Clean.cmd
  17. 22
      Source/BPBIOS/bpbldzx.cmd
  18. BIN
      Source/BPBIOS/zcpr33.rel
  19. 2
      Source/BuildROM.cmd
  20. 26
      Source/CBIOS/cbios.asm
  21. 1
      Source/Doc/Build.cmd
  22. 23
      Source/Doc/CPM 22 Manual - Testing/Build.cmd
  23. 8
      Source/Doc/CPM 22 Manual - Testing/Clean.cmd
  24. 243
      Source/Doc/CPM 22 Manual - Testing/Main.log
  25. 42
      Source/Doc/CPM 22 Manual - Testing/Main.ltx
  26. BIN
      Source/Doc/CPM 22 Manual - Testing/Main.pdf
  27. 19
      Source/Doc/CPM 22 Manual - Testing/Strip.ps1
  28. 716
      Source/Doc/CPM 22 Manual - Testing/appa.tex
  29. 371
      Source/Doc/CPM 22 Manual - Testing/appb.tex
  30. 143
      Source/Doc/CPM 22 Manual - Testing/appc.tex
  31. 175
      Source/Doc/CPM 22 Manual - Testing/appd.tex
  32. 109
      Source/Doc/CPM 22 Manual - Testing/appe.tex
  33. 263
      Source/Doc/CPM 22 Manual - Testing/appf.tex
  34. 475
      Source/Doc/CPM 22 Manual - Testing/appg.tex
  35. 904
      Source/Doc/CPM 22 Manual - Testing/apph.tex
  36. 912
      Source/Doc/CPM 22 Manual - Testing/apph2.tex
  37. 939
      Source/Doc/CPM 22 Manual - Testing/appi.tex
  38. BIN
      Source/Doc/CPM 22 Manual - Testing/cpm22tex.zip
  39. 670
      Source/Doc/CPM 22 Manual - Testing/fivea.tex
  40. 806
      Source/Doc/CPM 22 Manual - Testing/fiveb.tex
  41. 444
      Source/Doc/CPM 22 Manual - Testing/fivec.tex
  42. 497
      Source/Doc/CPM 22 Manual - Testing/fived.tex
  43. 693
      Source/Doc/CPM 22 Manual - Testing/foura.tex
  44. 583
      Source/Doc/CPM 22 Manual - Testing/fourb.tex
  45. 453
      Source/Doc/CPM 22 Manual - Testing/front.tex
  46. 468
      Source/Doc/CPM 22 Manual - Testing/index.tex
  47. 993
      Source/Doc/CPM 22 Manual - Testing/onea.tex
  48. 915
      Source/Doc/CPM 22 Manual - Testing/oneb.tex
  49. 683
      Source/Doc/CPM 22 Manual - Testing/onec.tex
  50. BIN
      Source/Doc/CPM 22 Manual - Testing/part1.ix
  51. 13267
      Source/Doc/CPM 22 Manual - Testing/part1.prn
  52. 2
      Source/Doc/CPM 22 Manual - Testing/part1.tex
  53. 13350
      Source/Doc/CPM 22 Manual - Testing/part1.txt
  54. 3010
      Source/Doc/CPM 22 Manual - Testing/part2.prn
  55. 2
      Source/Doc/CPM 22 Manual - Testing/part2.tex
  56. 3009
      Source/Doc/CPM 22 Manual - Testing/part2.txt
  57. BIN
      Source/Doc/CPM 22 Manual - Testing/part3.ix
  58. BIN
      Source/Doc/CPM 22 Manual - Testing/part3.prn
  59. 2
      Source/Doc/CPM 22 Manual - Testing/part3.tex
  60. 2511
      Source/Doc/CPM 22 Manual - Testing/part3.txt
  61. 807
      Source/Doc/CPM 22 Manual - Testing/sixa.tex
  62. 1311
      Source/Doc/CPM 22 Manual - Testing/sixb.tex
  63. 447
      Source/Doc/CPM 22 Manual - Testing/test.tex
  64. 938
      Source/Doc/CPM 22 Manual - Testing/threea.tex
  65. 954
      Source/Doc/CPM 22 Manual - Testing/threeb.tex
  66. 1124
      Source/Doc/CPM 22 Manual - Testing/two.tex
  67. 27
      Source/Doc/CPM 22 Manual/Build.cmd
  68. 9
      Source/Doc/CPM 22 Manual/Clean.cmd
  69. 40
      Source/Doc/CPM 22 Manual/Main.ltx
  70. 35
      Source/Doc/CPM 22 Manual/Main.ltx.bak
  71. 14
      Source/Doc/CPM 22 Manual/Strip.ps1
  72. 716
      Source/Doc/CPM 22 Manual/appa.tex
  73. 371
      Source/Doc/CPM 22 Manual/appb.tex
  74. 143
      Source/Doc/CPM 22 Manual/appc.tex
  75. 175
      Source/Doc/CPM 22 Manual/appd.tex
  76. 109
      Source/Doc/CPM 22 Manual/appe.tex
  77. 263
      Source/Doc/CPM 22 Manual/appf.tex
  78. 475
      Source/Doc/CPM 22 Manual/appg.tex
  79. 904
      Source/Doc/CPM 22 Manual/apph.tex
  80. 912
      Source/Doc/CPM 22 Manual/apph2.tex
  81. 939
      Source/Doc/CPM 22 Manual/appi.tex
  82. BIN
      Source/Doc/CPM 22 Manual/cpm22tex.zip
  83. 671
      Source/Doc/CPM 22 Manual/fivea.tex
  84. 806
      Source/Doc/CPM 22 Manual/fiveb.tex
  85. 444
      Source/Doc/CPM 22 Manual/fivec.tex
  86. 497
      Source/Doc/CPM 22 Manual/fived.tex
  87. 693
      Source/Doc/CPM 22 Manual/foura.tex
  88. 583
      Source/Doc/CPM 22 Manual/fourb.tex
  89. 447
      Source/Doc/CPM 22 Manual/front.tex
  90. 468
      Source/Doc/CPM 22 Manual/index.tex
  91. 990
      Source/Doc/CPM 22 Manual/onea.tex
  92. 915
      Source/Doc/CPM 22 Manual/oneb.tex
  93. 683
      Source/Doc/CPM 22 Manual/onec.tex
  94. 2
      Source/Doc/CPM 22 Manual/part1.tex
  95. 2
      Source/Doc/CPM 22 Manual/part2.tex
  96. 2
      Source/Doc/CPM 22 Manual/part3.tex
  97. 807
      Source/Doc/CPM 22 Manual/sixa.tex
  98. 1311
      Source/Doc/CPM 22 Manual/sixb.tex
  99. 447
      Source/Doc/CPM 22 Manual/test.tex
  100. 938
      Source/Doc/CPM 22 Manual/threea.tex

107
Binary/ReadMe.txt

@ -0,0 +1,107 @@
***********************************************************************
*** ***
*** R o m W B W ***
*** ***
*** Z80/Z180 System Software ***
*** ***
***********************************************************************
This directory ("Binary") is part of the RomWBW System Software
distribution archive. It contains the completed binary outputs of
the build process. As described below, these files are used to
assemble a working RetroBrew Computers system.
The files in this directory are created by the build process that is
documented in the ReadMe.txt file in the Source directory. When
released the directory is populated with the default output files.
However, the output of custom builds will be placed in this directory
as well.
ROM Firmware Images (<plt>_<cfg>.rom)
-------------------------------------
The files with a ".rom" extension are binary images ready to program
into an appropriate PROM. These files are named with the format
<plt>_<cfg>.rom. <plt> refers to the primary platform such as Zeta,
N8, Mark IV, etc. <cfg> refers to the specific configuration. When
released, there will be a standard configuration ("std") for each
platform. So, for example, the file called MK4_std.rom is a ROM
image for the Mark IV with the standard configuration. If a custom
configuration called "custom" is created and built, a new file called
MK4_custom.rom will be added to this directory.
Documentation of the pre-built ROM Images is contained in the
RomList.txt file.
ROM Executable Images (<plt>_<cfg>.com)
---------------------------------------
When a ROM image (".rom") is created, an executable version of the
ROM is also created. These files have the same naming convention as
the ROM Image files, but have the extension ".com". These files can
be copied to a working system and run like a normal application.
When run on the target system, they install in RAM just like they had
been programmed into the ROM. This allows a new ROM build to be
tested without reprogramming the actual ROM.
ROM Binary Images (<plt>_<cfg>.img)
-----------------------------------
Also when a ROM image is created, a third variation of the ROM is
created again with the same naming convention, but with the extension
of .img. These files are similar to the .com files in that they can
be used to test a ROM build without actually programming a new ROM.
The .img files are specifically for loading via UNA from a FAT file
system. The functionality of the UNA FAT file system loader is
beyond the scope of this document.
VDU ROM Image (vdu.rom)
-----------------------
The VDU video board requires a dedicated onboard ROM containing the
font data. The "vdu.rom" file contains the binary data to program
onto that chip.
Disk Images (fd*.img, hd*.img)
------------------------------
RomWBW includes a mechanism for generating floppy disk and hard disk
binary images that are ready to copy directly to a floppy, hard disk,
CF Card, or SD Card which will then be ready for use in any
RomWBW-based system.
Essentially, these files contain prepared floppy and hard disk images
with a large set of programs and related files. By copying the
contents of these files to appropriate media as described below, you
can quickly create ready-to-use media.
The fd*.img files are floppy disk images. They are sized for 1.44MB
floppy media and can be copied to actual floppy disks using
RawWriteWin (as long as you have access to a floppy drive on your
Windows computer). The resulting floppy disks will be usable on any
RomWBW-based system with floppy drive(s).
Likewise, the hd*.img files are hard disk images. Each file is
intended to be copied to the start of any type of hard disk media
(typically a CF Card or SD Card). The resulting media will be usable
on any RomWBW-based system that accepts the corresponding media type.
Note that the contents of the floppy/hard disk images are created by
the BuildImages.cmd script in the Source directory. Additional
information on how to generate custom disk images is found in the
Source\Images directory.
Propeller ROM Images (*.eeprom)
-------------------------------
The files with and extension of ".eeprom" contain the binary images
to be programmed into the Propeller-based boards. The list below
indicates which file targets each of the Propeller board variants:
ParPortProp ParPortProp.eeprom
PropIO V1 PropIO.eeprom
PropIO V2 PropIO2.eeprom
Refer to the board documentation of the boards for more information
on how to program the EEPROMs on these boards.

303
Binary/RomList.txt

@ -1,196 +1,111 @@
You should find the following ROM
images in the Output driectory.
Refer to the descriptions below to select
one that matches your hardware
configuration, burn it, and use it.
All builds have the following:
***********************************************************************
*** ***
*** R o m W B W ***
*** ***
*** Z80/Z180 System Software ***
*** ***
***********************************************************************
This directory ("Binary") is part of the RomWBW System Software
distribution archive. Refer to the ReadMe.txt file in this
directory for more information on the overall contents of the
directory.
When distributed, RomWBW contains a set of pre-built ROM images that
are ready to program onto the EEPROM of any of the Z80/Z180 based
RetroBrew Computers CPU boards. Additionally, any custom built ROM
images will be placed in this directory.
All of the pre-built ROM images are 512KB. This size is compatible
with all of the Z80/Z180 systems. Some systems can accept different
size ROM images. Creating alternative sizes requires a custom ROM
build (see ReadMe.txt in the Source directory).
It is critical that the right ROM Imgae be selected for the target
platform being used. The table below indicates the correct ROM
image to use for each platform:
SBC V1/V2 SBC_std.rom
Zeta V1 ZETA_std.rom
Zeta V2 ZETA2_std.rom
N8 N8_std.rom
Mark IV MK4_std.rom
You will find there is one additional ROM image called
"UNA_std.rom". This ROM image is an UNA-based RomWBW ROM image. As
such, this ROM image can be used on any Z80/Z180 platform supported
by John Coffman's UNA BIOS. Refer to RetroBrew Computers Wiki for
more information on UNA hardware support.
For each of the ROM Images (".rom"), there are corresponding files
with the extensions of ".com" and ".img". The .com variant can be
copied to a functional RomWBW-based system and executed like a
normal application under CP/M or Z-System. This will load the new
ROM on-the-fly. It is an excellent way to test a ROM Image before
actually burning it. Similarly, the .img files can be loaded using
the UNA FAT loader for testing.
All of the standard ROM Images are configured with:
- 512KB ROM Disk
- 512KB RAM Disk
- 38.4Kbps baud console
All of the above can be modified by using
a custom build. See Build.txt in the
Doc directory.
Note have all hard disk units are assumed to have
at least 2 slices and therefore two drive letters
are assigned per disk unit by default. However,
you can easily add/remove drive letters and slices
by using the ASSIGN command to modify drive
letter to disk/slice mapping on the fly at
the command line.
Note that there are no longer separate
ROM images for CP/M and ZSystem. Both
OS variants are now imbedded in the ROM
image and you are given the ability to
choose the one you want to boot at
startup.
N8VEM_std.rom for N8VEM Z80 SBC V1/V2:
- Drives A:=ROM, B:=RAM
N8VEM_diskio.rom for N8VEM Z80 SBC V1/V2 + DISKIO:
- Floppy support via DISKIO
- IDE support via DISKIO
- Drives A:=ROM, B:=RAM, C:=FD0, D:=FD1, E:=IDE0:00, F:=IDE0:01
N8VEM_dide.rom for N8VEM Z80 SBC V1/V2 + DUAL IDE:
- Floppy support via DISKIO
- IDE support via DISKIO
- Drives A:=ROM, B:=RAM, C:=FD0, D:=FD1, E:=IDE0:00, F:=IDE0:01
N8VEM_diskio3.rom for N8VEM Z80 SBC V1/V2 + DISKIO3:
- Floppy support via DISKIO3
- IDE support via DISKIO3
- Drives A:=ROM, B:=RAM, C:=FD0, D:=FD1, E:=IDE0:00, F:=IDE0:01
N8VEM_diskio3+cvdu.rom for N8VEM Z80 SBC V1/V2 + DISKIO3:
- Floppy support via DISKIO3
- IDE support via DISKIO3
- ColorVDU board support
- Console defaults to VGA & PS/2 Keyboard. Short JP2 (CONFIG)
to use the serial port as the console.
- Drives A:=ROM, B:=RAM, C:=FD0, D:=FD1, E:=IDE0:00, F:=IDE0:01
N8VEM_ppide.rom for N8VEM Z80 SBC V1/V2 + PPIDE:
- PPIDE support via built-in PPI
- Drives A:=ROM, B:=RAM, C:=PPIDE0:00, D:=PPIDE0:01
N8VEM_ppisd.rom for N8VEM Z80 SBC V1/V2 + PPISD:
- PPISD support
- Drives A:=ROM, B:=RAM, C:=SD0:00, D:=SD0:01
N8VEM_dsd.rom for N8VEM Z80 SBC V1/V2 + Dual SD:
- Dual SD support
- Drives A:=ROM, B:=RAM, C:=SD0:00, D:=SD0:01
N8VEM_propio.rom for N8VEM Z80 SBC V1/V2 + PROPIO:
- SD Card support via PropIO
- VGA console support via PropIO
- PS/2 Keyboard support via PropIO
- You *MUST* use the RomWBW specific firmware
for the Propeller found in the Support directory!
- Console defaults to VGA & PS/2 Keyboard. Short JP2 (CONFIG)
to use the serial port as the console.
- Drives A:=ROM, B:=RAM, C:=PRPSD0:00, D:=PRPSD0:01
N8VEM_mfp.rom for N8VEM Z80 SBC V1/V2:
- IDE support via Multifunction / PIC
- Second UART via Multifunction / PIC
- Drives A:=ROM, B:=RAM, C:=PPIDE0:00, D:=PPIDE0:01
N8VEM_ci.rom for N8VEM Z80 SBC V1/V2:
- Cassette Interface mapped to RDR/PUN
- Drives A:=ROM, B:=RAM
N8VEM_simh.rom for N8VEM SIMH Simulator:
- SIMH HDSK (simulated hard disk) support
- Drives A:=ROM, B:=RAM, C:=HDSK0:00, D:=HDSK0:01
N8VEM_rf.rom for N8VEM Z80 SBC V1/2 + RAM Flopppy:
- RAM Floppy support
- Drives A:=ROM, B:=RAM, C:=RF0, D:=RF1
N8VEM_vdu.rom for N8VEM Z80 SBC V1/V2:
- VDU board support
- Drives A:=ROM, B:=RAM
- NOTE: Console defaults to CRT & PS/2 Keyboard. Short JP2
(one bit input port) to use the serial port as the console.
N8VEM_cvdu.rom for N8VEM Z80 SBC V1/V2:
- ColorVDU board support
- Console defaults to VGA & PS/2 Keyboard. Short JP2 (CONFIG)
to use the serial port as the console.
- Drives A:=ROM, B:=RAM
ZETA_std.rom for Zeta Z80 SBC:
- Floppy support via built-in FDC
- Drives A:=ROM, B:=RAM, C:=FD0, D:=FD1, E:=PPIDE00-0, F:=PPIDE0:01
ZETA_ppide.rom for Zeta Z80 SBC + PPIDE:
- Floppy support via built-in FDC
- PPIDE support via built-in PPI
- Drives A:=ROM, B:=RAM, C:=PPIDE0:00, D:=PPIDE0:01
ZETA_ppisd.rom for Zeta Z80 SBC + PPISD:
- Floppy support via built-in FDC
- PPISD support
- Drives A:=ROM, B:=RAM, C:=SD0:00, D:=SD0:01
ZETA_ppp.rom for Zeta Z80 SBC w/ ParPortProp:
- Floppy support via built-in FDC
- SD Card support via ParPortProp
- VGA console support via ParPortProp
- PS/2 Keyboard support via ParPortProp
- You *MUST* use the RomWBW specific firmware
for the Propeller found in the Support directory!
- Console defaults to VGA & PS/2 Keyboard. Short JP1 (CONFIG)
to use the serial port as the console.
- Drives A:=ROM, B:=RAM, C:=FD0, D:=FD1, E:=PPPSD0:00, F:=PPPSD0:01
ZETA2_std.rom for Zeta 2 Z80 SBC:
- Floppy support via built-in FDC
- PPIDE support via built-in PPI
- Drives A:=ROM, B:=RAM, C:=FD0, D:=FD1, E:=PPIDE00-0, F:=PPIDE0:01
ZETA2_ppide.rom for Zeta 2 Z80 SBC + PPIDE:
- Floppy support via built-in FDC
- PPIDE support via built-in PPI
- Drives A:=ROM, B:=RAM, C:=PPIDE0:00, D:=PPIDE0:01
ZETA2_ppisd.rom for Zeta 2 Z80 SBC + PPISD:
- Floppy support via built-in FDC
- PPISD support
- Drives A:=ROM, B:=RAM, C:=SD0:00, D:=SD0:01
ZETA2_ppp.rom for Zeta 2 Z80 SBC w/ ParPortProp:
- Floppy support via built-in FDC
- SD Card support via ParPortProp
- VGA console support via ParPortProp
- PS/2 Keyboard support via ParPortProp
- You *MUST* use the RomWBW specific firmware
for the Propeller found in the Support directory!
- Console defaults to VGA & PS/2 Keyboard. Short JP1 (CONFIG)
to use the serial port as the console.
- Drives A:=ROM, B:=RAM, C:=FD0, D:=FD1, E:=PPPSD0:00, F:=PPPSD0:01
N8_2511.rom for N8 2511 Z180:
- Assumes CPU oscillator frequency of 18.432MHz
- Floppy support via built-in FDC
- SD card support via built-in SD card slot
- Drives A:=ROM, B:=RAM, C:=FD0, D:=FD1, E:=SD0:00, F:=SD0:01
N8_2312.rom for N8 2312 Z180:
- Assumes CPU oscillator frequency of 18.432MHz
- Floppy support via built-in FDC
- SD card support via built-in SD card slot
- Drives A:=ROM, B:=RAM, C:=FD0, D:=FD1, E:=SD0:00, F:=SD0:01
MK4_std.rom for Mark IV Z180 SBC:
- Assumes CPU oscillator frequency of 18.432MHz
- Onboard SD Card
- Onboard IDE
- Drives A:=ROM, B:=RAM, C:=SD0-0, D:=SD0-1, E:=IDE0:00, F:=IDE0:01
MK4_diskio3.rom for Mark IV Z180 SBC:
- Assumes CPU oscillator frequency of 18.432MHz
- Floppy support via DISKIO3
- IDE support via DISKIO3
- Drives A:=ROM, B:=RAM, C:=FD0, D:=FD1, E:=IDE0:00, F:=IDE0:01
MK4_propio.rom for Mark IV Z180 SBC:
- Assumes CPU oscillator frequency of 18.432MHz
- SD Card support via PropIO
- VGA console support via PropIO
- PS/2 Keyboard support via PropIO
- You *MUST* use the RomWBW specific firmware
for the Propeller found in the Support directory!
- Drives A:=ROM, B:=RAM, C:=PRPSD0:00, D:=PRPSD0:01
UNA_std.rom for all UNA supported platforms (SBC V1/2, Zeta, Mark IV)
- Initial baud rate is 9600, but can be configured
- Resources are managed dynamically by UNA BIOS
- Refer to UNA project for more details
- Drive assignments occur dynamically based on UNA config
- 38.4Kbps baud serial console
- Auto-discovery of all serial ports
All hard disk type devices (IDE, PPIDE, CF Card, SD Card) will be
automatically assigned two drive letters per device. The drive
letters will refer to the first 2 slices of the device. The ASSIGN
command can be used to display and reassign drives to disk devices
and slices as desired.
Standard ROM Image Notes
------------------------
The standard ROM images will detect and install support for certain
devices and peripherals that are on-board or frequently used with
each platform as documented below. If the device or peripheral is
not detected at boot, the ROM will simply bypass support
appropriately.
SBC:
- Includes support for PPIDE/CF Card(s) connected to on-board
parallel port.
- Includes support for CVDU and VGA3 boards. If detected at
startup, support for video and keyboard is installed
including VT-100/ANSI terminal emulation.
- Auto-detects PropIO or PropIO V2 and installs associated
video, keyboard and SD Card support if present.
- If PropIO, PropIO V2, CVDU, or VGA hardware is detected,
initial console output is determined by JP2. If JP2 is
shorted, console will go to on-board serial port, if JP2
is open, console will go to the detected video and keyboard
ports.
- SBC V1 has a known race condition in the bank switching
circuit which is likely to cause system instability. SBC
V2 does not have this issue.
ZETA/ZETA2:
- Includes support for on-board floppy disk controller and
two attached floppy disks.
- Auto-detects ParPortProp and includes support for it if it
is attached.
- If ParPortProp is installed, initial console output is
determined by JP1. If JP1 is shorted, console will go to
on-board serial port, if JP1 is open, console will go to
ParPortProp video and keyboard ports.
N8:
- Includes support for on-board floppy disk controller and
two attached floppy disks.
- Includes support for on-board TMS9918 video and keyboard
including VT-100/ANSI terminal emulation.
- Includes support for on-board SD Card as hard disk and
assumes a production level N8 board (date code >= 2312).
MK4:
- Includes support for on-board IDE port (CF Card via adapter).
- Includes support for on-board SD Card port.
- Auto-detects PropIO or PropIO V2 and installs associated
video, keyboard and SD Card support if present.
- Includes support for CVDU and VGA3 boards. If detected at
startup, support for video and keyboard is installed
including VT-100/ANSI terminal emulation.

350
Doc/Build.txt

@ -1,350 +0,0 @@
Building a Custom ROM
---------------------
At present, the build environment assumes you are running
a current version of Microsoft Windows (either 32-bit or
64-bit). Additionally, you will need Microsoft PowerShell.
PowerShell is included in all distributions of Microsoft
Windows starting with Vista. It is available as a free
download for Windows XP from Microsoft
Other than PowerShell, all required tools are included in
the distribution. You should not need anything other than
what comes as part of Windows or as part of the distribution.
In summary, the process involves the 4 steps below. You must
configure PowerShell prior to these steps, but this only needs
to be done once.
The basic steps to create a custom ROM are:
1) Create/update configuration file
2) Update/Add/Delete any files you want incorporated in
the ROM Disk
3) Run the build scripts and
confirm there are no errors.
4) Burn the resultant ROM image and try it.
I strongly recommend that you initially SKIP steps
1 & 2. Just try steps 3 & 4 to make sure you are
able to build a ROM and test it in your hardware.
Each of the 4 steps above is described in more detail
below.
Acquiring the Distribution
--------------------------
Preparing PowerShell
--------------------
1. Create/Update Configuration File
-----------------------------------
The settings for a build are primarily controled by
a configuration file that is included in the build
process. In order to customize your settings, you
need to modify an existing configuration file or
create your own.
Configuration files are found in the Source\BIOS\Config
directory. If you look in the this directory, you will see
a series of files named XXXX_yyyy.asm. Each of
them corresponds to one of the standard configurations
listed in the ROMList.txt file.
You have two choices. You can simply modify the existing
configuration file that is closest to your situation, or
you can copy it to a new XXXX_yyyy.asm file and modify
that. I recommend that you copy one to your own name so
that you will always have the unmodified standard configuration
files left in place. So, for example, you could just
copy ZETA_std.asm to ZETA_wayne.asm. You MUST
name your config file as XXXX_yyyy.asm. The XXXX portion
must match your platform (N8VEM, ZETA, ZETA2, N8, UNA).
The yyyy portion can be whatever you want.
The config files are simply text files with various
settings. Open your target config file with your
favorite text editor and modify the settings as desired.
Unfortunately, I have not yet documented each of the
settings in detail; that will be a separate document
provided in the future. However, there are comments
in the config file that will probably be sufficient
for the most part.
2. Update/Add/Delete ROM Disk Files
-----------------------------------
The files that are included on the ROM Disk of your
ROM are copied from a set of directories during the
build process. This allows you to have complete
flexibility over the files you want included in your
ROM.
If you look at the RomDsk directory, you will see
a variety of subdirectories. These subdirectories
contain the files that will be included in the
ROM disk. The build process will determine
which subdirectories to include files from based
on the following rules:
First, all files from either ROM_512KB or ROM_1024KB will
be included depending on on the size of the ROM you
are building. If you are building a 512KB ROM, then
all the files from ROM_512KB will be included. If you
are building a 1MB ROM, then all the files from ROM_1024KB
will be included. Essentialy, the files in ROM_1204KB are
a superset of the ones in ROM_512KB because there is more
space available for the ROM drive.
Second, all files from the directory that corresponds to
your configuration file will be included. If you build
the "ZETA_std" configuration, all files in ZETA_std will
be added. Note that these files will be in addition
to the files from the ROM_XXXKB directory.
If you created your own config file (like ZETA_wayne.asm
described above), you MUST create a subdirectory within
the RomDsk directory and populate it with the files
you want added. Normally, you would include the
files from the original standard config. So, if
you created ZETA_wayne.asm from ZETA_std.asm,
then you would create a subdirectory in RomDsk called
ZETA_wayne and copy all the files from ZETA_std to
ZETA_wayne.
3. Run the Build Process
------------------------
NOTE: The process described here is the more commonly
used build script. If you wish to use a makefile
instead, refer to the comments in the makefile in
the Source directory as an alternative to the
process described here.
The build involves running commands at the command
prompt. From a Command Prompt window, you will need
to change to the high level directory for the build.
Normally, you would be changing to the RomWBW directory
unless you renamed it.
First, you will need to build the components that are
common to all configurations. These components do not
require any configuration. To build these, use the
following command and ensure it completes
without error:
BuildCommon
To run the configuration specific build and be prompted
for required information, just enter "Build". You will
be prompted for the information described below and the
build should run. If an error is encountered, the build
should stop and display an error in red text.
If you immediately receive the error "the execution of
scripts is disabled on this system", then you will need to
change the PowerShell Execution-Polcy to "RemoteSigned".
To do this, you need to right-click on FixPowerShell.cmd and
choose "Run as Administrator" to make the change. It is
critical that you right-click and use "Run as Administrator"
or the change will not work (you will get an error
indicating "Access to the registry denied" if you fail to
use "Run as Administrator".
The build script will prompt you for the following information
which you will need to provide (don't worry, it is simple):
Platform:
Respond with the name of the platform that you are targeting.
It must be one of N8VEM, ZETA, ZETA2, N8, or UNA.
Configuration:
Respond with the name of the configuration you wish to build.
A list of all available configurations is displayed for your
convenience. For example, if you are building the provided
ZETA_std configuration, just enter "std". If you have created a
custom configuration as described above, you would enter
"wayne".
ROM Size [512|1024]:
Respond with either "512" for a 512KB ROM build or "1024" for a
1MB ROM build. Only the two choices are possible at this time.
It is important that you choose a ROM size that is no larger than
the size of the ROM you will ultimately be burning. This is
dependant on your hardware.
At this point, the build should run and you will see output related
to the assembler runs and some utility invocations. Just review
the output for any obvioius errors. Normally, all errors will
cause the build to stop immediately and display an error message
in red.
You will see some lines in the output indicating the amount of
space various components have taken. You should check these
to make sure you do not see any negative numbers which would
indicate that you have included too many features/drivers for
the available memory space. Here are examples of the lines
showing the space used:
DATA space remaining: 39 bytes.
BOOT LOADER space remaining: 3503 bytes.
CBIOS space remaining: 161 bytes.
DBGMON space remaining: 860 bytes.
ROMX space remaining: 8191 bytes.
BOOT LOADER space remaining: 3503 bytes.
4. Deploy the ROM
-----------------
If you look in the Output directory. You should find the following files:
<config>.rom - binary ROM image to burn to EEPROM
<config>.com - executable version of the system image that can be
copied via xmodem to a running system to test
the build.
<config>.img - system image that can be written to an SD/CF Card
and loaded via the UNA FS FAT loader.
The actual ROM image is the file ending in .rom. It should be exactly
512KB or 1MB depending on the ROM size you chose. Simply burn the .rom
image to your ROM and install it in your hardware.
Specifying Build Options on Command Line
----------------------------------------
If you don't want to be prompted for the options to the "Build"
command, you can specify the options right on the command line.
For example:
Build ZETA std 512
In this case, you will not be prompted. This is useful if you
wish to automate your build process.
Example Build Run
-----------------
C:\Users\WWarthen\Projects\N8VEM\Build\RomWBW>Build.cmd
Platform [N8VEM|ZETA|N8|UNA|S100]: ZETA
Configurations available:
> ppp
> std
Configuration: std
ROM Size [512|1024]: 512
Building ZETA_std: 512KB ROM configuration std for Z80...
tasm -t80 -g3 ccpb03.asm cp.bin
TASM Z80 Assembler. Version 3.2 September, 2001.
Copyright (C) 2001 Squak Valley Software
tasm: pass 1 complete.
tasm: pass 2 complete.
tasm: Number of errors = 0
tasm -t80 -g3 bdosb01.asm dos.bin
TASM Z80 Assembler. Version 3.2 September, 2001.
Copyright (C) 2001 Squak Valley Software
tasm: pass 1 complete.
tasm: pass 2 complete.
tasm: Number of errors = 0
tasm -t80 -g3 syscfg.asm syscfg.bin
TASM Z80 Assembler. Version 3.2 September, 2001.
Copyright (C) 2001 Squak Valley Software
tasm: pass 1 complete.
Configuration: ZETA Z80 SBC, FLOPPY (AUTOSIZE), PPIDE (STD)
tasm: pass 2 complete.
tasm: Number of errors = 0
tasm -t80 -g3 -dBLD_SYS=SYS_CPM cbios.asm cbios.bin
TASM Z80 Assembler. Version 3.2 September, 2001.
Copyright (C) 2001 Squak Valley Software
tasm: pass 1 complete.
Configuration: ZETA Z80 SBC, FLOPPY (AUTOSIZE), PPIDE (STD)
INFOLIST occupies 18 bytes.
UTIL occupies 484 bytes.
FD_DATA occupies 340 bytes.
PPIDE_DATA occupies 1116 bytes.
CBIOS space remaining: 2092 bytes.
tasm: pass 2 complete.
tasm: Number of errors = 0
tasm -t80 -g3 dbgmon.asm dbgmon.bin
TASM Z80 Assembler. Version 3.2 September, 2001.
Copyright (C) 2001 Squak Valley Software
tasm: pass 1 complete.
Configuration: ZETA Z80 SBC, FLOPPY (AUTOSIZE), PPIDE (STD)
DBGMON space remaining: 795 bytes.
tasm: pass 2 complete.
tasm: Number of errors = 0
tasm -t80 -g3 prefix.asm prefix.bin
TASM Z80 Assembler. Version 3.2 September, 2001.
Copyright (C) 2001 Squak Valley Software
tasm: pass 1 complete.
Configuration: ZETA Z80 SBC, FLOPPY (AUTOSIZE), PPIDE (STD)
tasm: pass 2 complete.
tasm: Number of errors = 0
tasm -t80 -g3 bootrom.asm bootrom.bin
TASM Z80 Assembler. Version 3.2 September, 2001.
Copyright (C) 2001 Squak Valley Software
tasm: pass 1 complete.
Configuration: ZETA Z80 SBC, FLOPPY (AUTOSIZE), PPIDE (STD)
tasm: pass 2 complete.
tasm: Number of errors = 0
tasm -t80 -g3 bootapp.asm bootapp.bin
TASM Z80 Assembler. Version 3.2 September, 2001.
Copyright (C) 2001 Squak Valley Software
tasm: pass 1 complete.
Configuration: ZETA Z80 SBC, FLOPPY (AUTOSIZE), PPIDE (STD)
tasm: pass 2 complete.
tasm: Number of errors = 0
tasm -t80 -g3 loader.asm loader.bin
TASM Z80 Assembler. Version 3.2 September, 2001.
Copyright (C) 2001 Squak Valley Software
tasm: pass 1 complete.
Configuration: ZETA Z80 SBC, FLOPPY (AUTOSIZE), PPIDE (STD)
LOADER space remaining: 1205 bytes.
tasm: pass 2 complete.
tasm: Number of errors = 0
tasm -t80 -g3 pgzero.asm pgzero.bin
TASM Z80 Assembler. Version 3.2 September, 2001.
Copyright (C) 2001 Squak Valley Software
tasm: pass 1 complete.
tasm: pass 2 complete.
tasm: Number of errors = 0
tasm -t80 -g3 hbios.asm hbios.bin
TASM Z80 Assembler. Version 3.2 September, 2001.
Copyright (C) 2001 Squak Valley Software
tasm: pass 1 complete.
Configuration: ZETA Z80 SBC, FLOPPY (AUTOSIZE), PPIDE (STD)
UART occupies 146 bytes.
FD occupies 2071 bytes.
PPIDE occupies 809 bytes.
HBIOS space remaining: 24428 bytes.
STACK space remaining: 145 bytes.
tasm: pass 2 complete.
tasm: Number of errors = 0
tasm -t80 -g3 hbfill.asm hbfill.bin
TASM Z80 Assembler. Version 3.2 September, 2001.
Copyright (C) 2001 Squak Valley Software
tasm: pass 1 complete.
Configuration: ZETA Z80 SBC, FLOPPY (AUTOSIZE), PPIDE (STD)
tasm: pass 2 complete.
tasm: Number of errors = 0
tasm -t80 -g3 romfill.asm romfill.bin
TASM Z80 Assembler. Version 3.2 September, 2001.
Copyright (C) 2001 Squak Valley Software
tasm: pass 1 complete.
tasm: pass 2 complete.
tasm: Number of errors = 0
Building ZETA_std output files...
Building 512KB ZETA_std ROM disk data file...
C:\Users\WWarthen\Projects\N8VEM\Build\RomWBW>

BIN
Doc/CPM 22 Manual.pdf

Binary file not shown.

BIN
Doc/CPM Manual.pdf

Binary file not shown.

2
Doc/Contrib/ZSystem.txt

@ -14,7 +14,7 @@ Beyond the construction and integration of the actual DOS itself, the majority o
The remainder of this document details the changes I made as I went along. In all cases, my goal was to keep the result as close to the original distribution as possible. I started by copying all of the files from the distribution (contained in zsdos2.zip) into Support\ZSDOS. From there I tested, modified, updated, and customized as documented below. Finally, I cherry picked files that made sense to include on the ZSystem ROM disks.
1. CLOCKS.DAT has been updated to include the N8VEM clock drivers, N8VEMCLK AND N8CLK. I have also added the SIMHCLOK clock driver.
1. CLOCKS.DAT has been updated to include the RomWBW clock driver, HBCLK. I have also added the SIMHCLOK clock driver.
2. STAMPS.DAT has been replaced with an updated version. The update was called STAMPS11.DAT and was found on the Walnut Creek CP/M CDROM. The original version has a bug that prevents RSX (resident system extension) mode to load properly.

BIN
Doc/FDisk Manual.pdf

Binary file not shown.

42
Doc/ReadMe.txt

@ -0,0 +1,42 @@
***********************************************************************
*** ***
*** R o m W B W ***
*** ***
*** Z80/Z180 System Software ***
*** ***
***********************************************************************
This directory ("Doc") is part of the RomWBW System Software
distribution archive. It contains documentation for components of
the system.
CPM Manual:
The original DRI CP/M 2.x Operating System Manual. This should be
considered the primary reference for system operation. The section
on CP/M 2 Alteration can be ignored since this work has already been
completed as part of the RomWBW distribution.
FDisk Manual:
The operational manual for John Coffman's hard disk partitioning
program. This program is included in RomWBW as FDISK80.
RomWBW Architecture:
Document describing the architecture of the RomWBW HBIOS. It
includes reference information for the HBIOS calls.
ZCPR Manual:
ZCPR is the command proccessor portion of Z-System. This is the
manual for ZCPR 1.x as included in RomWBW. The installation
instructions can be ignored since that work has already been
completed as part of the RomWBW distribution.
ZSDOS Manual:
ZSDOS is the DOS portion of Z-System. This is the manual fo ZSDOS
1.x as included in RomWBW. The installation instructions can be
ignored since that work has already been completed as part of the
RomWBW distribution.

BIN
Doc/RomWBW System Guide.pdf

Binary file not shown.

BIN
Doc/RomWBW User Guide.pdf

Binary file not shown.

BIN
Doc/ZCPR Manual.pdf

Binary file not shown.

674
GPL-3.0.txt

@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

409
ReadMe.txt

@ -1,167 +1,288 @@
************************************************************
*** R o m W B W ***
*** ***
*** System Software for N8VEM Z80 Projects ***
************************************************************
***********************************************************************
*** ***
*** R o m W B W ***
*** ***
*** Z80/Z180 System Software ***
*** ***
***********************************************************************
Wayne Warthen (wwarthen@gmail.com)
Version 2.8.0, 2017-06-10
https://www.retrobrewcomputers.org/
RomWBW is a ROM-based implementation of CP/M-80 2.2 and Z-System for
all RetroBrew Computers Z80/Z180 hardware platforms including SBC
1/2, Zeta 1/2, N8, and Mark IV. Virtually all RetroBrew hardware is
supported including floppy, hard disk (IDE, CF Card, SD Card), Video,
and keyboard. VT-100 terminal emulation is built-in.
The RomWBW ROM loads and runs the built-in operating systems directly
from the ROM and includes a selection of standard/useful applications
accessed via a ROM disk drive. A RAM disk drive is also provided
to allow temporary file storage.
Pre-built ROM images are included for all platforms. Detailed system
customization is achieved by making simple modifications to a
configuration file and running a build script to generate a custom
ROM image. All source and build tools are included in the
distribution. As distributed, the build scripts run under any modern
32 or 64 bit version of Microsoft Windows.
John Coffman's UNA hardware BIOS is fully supported by RomWBW. In the
case of UNA, a single ROM image (pre-built) is used for all supported
platforms and is customized using a ROM-based setup program. See the
UNA section below for more information.
Quick Start
-----------
Builders: Wayne Warthen (wwarthen@gmail.com)
Douglas Goodall (douglas_goodall@mac.com)
David Giles (vk5dg@internode.on.net)
A pre-built ROM image is included for each of the hardware platforms
supported. These ROM images are found in the Binary directory of the
distribution and have a file extension of ".rom". Simply program the
ROM of your system with the appropriate ROM image. Please see the
RomList.txt file in the Binary directory for details on selecting the
correct ROM image for your system and platform specific information.
Connect a serial terminal or computer with terminal emulation
software to the primary RS-232 port of your CPU board. A null-modem
connection is generally required. Set the line characteristics to
38400 baud, 8 data bits, 1 stop bit, no parity, and no flow control.
Select VT-100 terminal emulation.
Upon power-up, your terminal should display a sign-on banner within 2
seconds followed by hardware inventory and discovery information.
When hardware initialization is completed, a boot loader prompt
allows you to choose a ROM-based operating system, system monitor, or
boot from a disk device.
CPU Speed
---------
RomWBW ROM images support virtually any CPU speed your system is
running. However, there are some hardware-oriented caveats to be
aware of.
The use of high density floppy disks requires a CPU speed of 8 MHz or
greater.
The latest X-Modem file transfer programs (XM.COM, XM-A0.COM, and
XM-A1.COM) require a CPU speeed of 6 MHz or greater to support the
default RomWBW serial port speed of 38400 baud. Older variants of
the X-Modem programs are included (XM5.COM, XM5-A0, and XM5-A1) which
will handle 38400 baud on system running down to 4 MHz.
Updated: 2015-04-07
Version: 2.7.1
Upgrading from Previous Versions
--------------------------------
This is an adaptation of CP/M-80 2.2 and ZSDOS/ZCPR
targeting ROMs for all N8VEM Z80 hardware variations
including SBC 1/2, Zeta 1/2, N8, and Mark IV.
Program a new ROM chip from an image in the new distribution. Install
the new ROM chip and boot your system. At the boot loader "Boot:"
prompt, select either CP/M or Z-System to load the OS from ROM.
If you have spare rom chips for your system, it is always safest to
keep your existing, work rom chip and program a new one so that you
can return to the old one if the new one does not work properly.
If you use a customized ROM image, it is recommended that you first
try the pre-built ROM image first and then move on to generating a
custom image.
It is entirely possible to reprogram your system ROM using the FLASH
utility from Will Sowerbutts on your ROM drive (B:). In this case,
you would need to transfer the new ROM image to your system using
X-Modem. Obviously, there is some risk to this approach since any
issues with the programming or ROM image could result in a
non-functional system.
If your system has any bootable drives, then update the OS image on
each drive using SYSCOPY. For example, if C: is a bootable drive
with the Z-System OS, you would update the OS image on this drive
with the command:
B>SYSCOPY C:=B:ZSYS.SYS
If you have copies of any of the system utilities on drives other
than the ROM disk drive, you need to copy the latest version of the
programs from the ROM drive (B:) to any drives containing these
programs. For example, if you have a copy of the ASSIGN.COM program
on C:, you would update it from the new ROM using the COPY command:
B>COPY B:ASSIGN.COM C:
The following programs are maintained with the ROM images and all
copies of these programs should be updated when upgrading to a new
ROM version:
- ASSIGN.COM
- FORMAT.COM
- OSLDR.COM
- SYSCOPY.COM
- TALK.COM
- FD.COM
- XM*.COM
UNA Hardware BIOS
-----------------
John Coffman has produced a new generation of hardware BIOS called
UNA. In addition to the classic ROM images, RomWBW comes with a
UNA-based image that combines the UNA BIOS with the RomWBW OS
implementations and applications.
UNA is customized dynamically using a ROM based setup routine and the
setup is persisted in the system NVRAM of the RTC chip. This means
that a single UNA-based ROM image can be used on most of the
RetroBrew platforms and is easily customized. UNA also supports FAT
file system access that can be used for in-situ ROM programming and
loading system images.
While John is likely to enhance UNA over time, there are currently a
few things that UNA does not support:
- Floppy Drives
- Video/Keyboard/Terminal Emulation
- Zeta 1 and N8 Systems
- Some older support boards
If you wish to try the UNA variant of RomWBW, then just program your
ROM with the ROM image called "UNA_std.rom" in the Binary directory.
This one image is suitable on all of the platforms and hardware UNA
supports.
Please refer to the RetroBrew Computers Wiki for more information on
UNA.
CP/M vs. Z-System
-----------------
There are two OS variants included in this distribution and you may
choose which one you prefer to use. Both variants are now included
in the pre-built ROM images. You will be given the choice to boot
either CP/M or Z-System at startup.
The traditional Digital Research (DRI) CP/M OS is the first choice.
The Doc directory contains a manual for CP/M usage ("CPM
Manual.pdf"). If you are new to the RetroBrew Computer systems, I
would currently recommend using the CP/M variant to start with simply
because it has gone through more testing and you are less likely to
encounter problems.
The other choice is to use the most popular non-DRI CP/M "clone"
which is generally referred to as Z-System. It is intended to be
functionally equivalent to CP/M and should run all CP/M 2.2 code. It
is optimized for the Z80 CPU (as opposed to 8080 for CP/M) and has
some potentially useful improvements. Please refer to "ZSDOS
Manual.pdf" and "ZCPR Manual.pdf" in the Doc directory for more
information on Z-System usage.
ROM Customization
-----------------
The pre-built ROM images are configured for the basic capabilities of
each platform. If you add board(s) to your system, you will need to
customize your ROM image to include support for the added board(s).
Essentially, the creation of a custom ROM is accomplished by updating
a small configuration file, then running a script to compile the
software and generate the custom ROM image. At this time, the build
process runs on Windows 32 or 64 bit versions. All tools (compilers,
assemblers, etc.) are included in the distribution, so it is not
necessary to setup a build environment on your computer.
For those who are interested in more than basic system customization,
note that all source code is included (including the operating
systems).
Note that the ROM customization process does not apply to UNA. All
UNA customization is performed within the ROM setup script.
Complete documentation of the customization process is found in the
ReadMe.txt file in the Source directory.
Source Code Respository
-----------------------
NOTE: This is very much a work-in-progress. It is
severely lacking appropriate documentation. I am
happy to answer questions and provide support though.
All source code and distributions are maintained on GitHub at
"https://github.com/wwarthen/RomWBW". Code contributions are very
welcome.
Acknowledgements
----------------
Distribution Directory Layout
-----------------------------
While I have heavily modified much of the code, I want
to acknowledge that much of this is derived or
copied from the work of others in the N8VEM
project including Andrew Lynch, Dan Werner, Max Scane,
David Giles, John Coffman, and probably many others
I am not clearly aware of (let me know if I omitted
someone!).
I especially want to credit Douglas Goodall for
contributing code, time, testing, and advice. He created
an entire suite of application programs to enhance the
use of RomWBW. However, he is looking for someone to
continue the maintenance of these applications and
they have become unusable due to changes within
RomWBW. As of RomWBW 2.6, these applications are
no longer provided.
David Giles has contributed support for building the
ROM under Linux and the CSIO support in the SD Card driver.
Usage Instructions
------------------
The RomWBW distribution is a compressed zip archive file organized in
a set of directories. Each of these directories has it's own
ReadMe.txt file describing the contents in detail. In summary, these
directories are:
The distribution includes many pre-built ROM
images in the Output directory. The simplest way of
using this ROM is to simply pick the pre-built ROM
that most closely matches your preferences, burn it,
and use it.
Binary: The final output files of the build process are placed
here. Most importantly, are the ROM images with the
file names ending in ".rom".
Refer to the file called RomList.txt for a complete
list of the ROMs that are included and the required
hardware configuration that they support.
Doc: Contains various detailed documentation including the
operating systems, RomWBW architecture, etc.
Upgrading from Previous Versions
--------------------------------
Source: Contains the source code files used to build the software
and ROM images.
Tools: Contains the MS Windows programs that are used by the
build process or that may be useful in setting up your
system.
Burn a new ROM image appropriate for your system
and boot under that new ROM. You may want to use
a different ROM chip in case the new version does
not work.
If you are using "boot from disk", you will need
to update the OS image on all drives you boot from.
To do this, use SYSCOPY. Something like this
would make sense:
B:SYSCOPY C:=B:ZSYS.SYS
CPU Speed & Baud Rate
---------------------
The startup serial port baud rate in all pre-built
RomWBW variants is 38.4Kbps. While this speed is
nice in that it provides great display and file
transfer performance, it does push the limits of
slower hardware. Specifically, XModem v12.5 (the
default XM.COM) on the distribution is unable to
service the serial port fast enough if the CPU is
running at 4MHz. Your options are to 1) use the
old version of XModem (XM5.COM), put a faster CPU
oscillator in your system (6MHz or above), or
3) decrease the baud rate by building a custom
ROM.
UNA Variant
-----------
Acknowledgements
----------------
RomWBW will now run under it's native BIOS (HBIOS) or
under UNA BIOS (UBIOS). There are pre-built ROM
images for UNA in the Output directory.
While I have heavily modified much of the code, I want to acknowledge
that much of the work is derived or copied from the work of others in
the RetroBrew Computers project including Andrew Lynch, Dan Werner,
Max Scane, David Giles, John Coffman, and probably many others I am
not clearly aware of (let me know if I omitted someone!).
CP/M vs. ZSystem
----------------
I especially want to credit Douglas Goodall for contributing code,
time, testing, and advice. He created an entire suite of application
programs to enhance the use of RomWBW. However, he is looking for
someone to continue the maintenance of these applications and they
have become unusable due to changes within RomWBW. As of RomWBW 2.6,
these applications are no longer provided.
There are two OS variants included in this distribution
and you may choose which one you prefer to use.
The traditional Digital Research (DRI) CP/M code is the first
choice. The Doc directory contains a manual for CP/M
usage (cpm22-m.pdf). If you are new to the N8VEM systems,
I would currently recommend using the CP/M variant to
start with simply because they have gone through more
testing and you are less likely to encounter problems.
The other choice is to use the most popular non-DRI
CP/M "clone" which is generally referred to as
ZSystem. These are intended to be functionally equivalent
to CP/M and should run all CP/M 2.2 code. They are
optimized for the Z80 CPU (as opposed to 8080 for CP/M)
and have some potentially useful improvements. Please
refer to the Doc directory and look at the files for
zsdos and zcpr (zsdos.pdf & zcpr.doc as well as ZSystem.txt).
Both variants are now included in the pre-built ROM images.
You will be given the choice to boot either CP/M or
ZSystem at startup.
Building a Custom ROM
---------------------
I strongly suggest you start with burning one of the
pre-built ROMs and making sure that works first. Once
you have gotten past that hurdle, you should consider
building a custom ROM. It is very easy and the
distribution comes with everything that is needed to
run a build on a Windows 32 bit or 64 bit system --
basically Windows XP or above. There is also a
Linux build now available.
Creating a custom ROM allows you to customize a lot
of useful stuff like adding support for a DSKY if
you have one.
Please refer to the Build.txt file in the Doc directory
for detailed instructions for building a custom ROM. If
you are using Linux, also read the LinuxBuild.txt file.
Formatting Media
----------------
David Giles has contributed support for the CSIO support in the SD
Card driver.
<TBD>
The UNA BIOS is a product of John Coffman.
Creating Bootable Media
-----------------------
License
-------
<TBD>
The Tools directory contains a variety of programs that are included
for convenience. They are all subject to their own licensing
restrictions (if any) and are not considered part of RomWBW.
Using Slices on Mass Storage Devices
------------------------------------
With respect to RomWBW:
<TBD>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or (at
your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Getting Assistance
------------------
Managing Console I/O
--------------------
The best way to get assistance with RomWBW or any aspect of the
RetroBrew Computers projects is via the community forum at
"https://www.retrobrewcomputers.org/forum/".
<TBD>
Also feel free to email Wayne Warthen at wwarthen@gmail.com.
Notes
To Do
-----
I realize these instructions are very minimal. I am happy to answer
questions. You will find the Google Group 'N8VEM' to be a great
source of information as well.
- Formatting Media
- Making a Disk Bootable
- Assigning disks/slices to drives
- Managing the Console

BIN
Source/BPBIOS/@WBW BPBIOS Errata.rtf

Binary file not shown.

23
Source/BPBIOS/Build.cmd

@ -11,6 +11,7 @@ set ZXLIBDIR=../../tools/cpm/lib/
set ZXINCDIR=../../tools/cpm/include/
call :makebp 33t
call :makebp 33tbnk
call :makebp 33n
call :makebp 33nbnk
@ -52,22 +53,30 @@ echo Building BPBIOS Variant "%VER%"...
echo.
copy def-ww-z%VER%.lib def-ww.lib
if exist bpbio-ww.rel del bpbio-ww.rel
rem if exist bpbio-ww.rel del bpbio-ww.rel
zx ZMAC -BPBIO-WW -/P
if exist bp%VER%.prn del bp%VER%.prn
ren bpbio-ww.prn bp%VER%.prn
rem pause
rem BPBUILD attempts to rename bpsys.img -> bpsys.bak
rem while is is still open. Real CP/M does not care,
rem but zx fails due to host OS. Below, a temp file
rem is used to avoid the problematic rename.
if exist bpsys.img del bpsys.img
zx bpbuild -bp%VER%.dat <bpbld1.rsp
if exist bpsys.$$$ del bpsys.$$$
ren bpsys.img bpsys.$$$
zx bpbuild -bpsys.$$$ <bpbld2.rsp
if exist bpsys.$$$ del bpsys.$$$
if exist bpsys.tmp del bpsys.tmp
copy bp%VER%.dat bpsys.tmp
rem bpsys.tmp -> bpsys.img
zx bpbuild -bpsys.tmp <bpbld1.rsp
if exist bpsys.tmp del bpsys.tmp
copy bpsys.img bpsys.tmp
rem bpsys.tmp -> bpsys.img
zx bpbuild -bpsys.tmp <bpbld2.rsp
if exist bp%VER%.img del bp%VER%.img
if exist bpsys.img ren bpsys.img bp%VER%.img
rem pause
goto :eof
goto :eof

5
Source/BPBIOS/Clean.cmd

@ -1,13 +1,12 @@
@echo off
setlocal
if exist *.tmp del *.tmp
if exist *.prn del *.prn
if exist *.err del *.err
if exist *.img del *.img
if exist bp*.rel del bp*.rel
if exist zcpr33*.rel del zcpr33*.rel
if exist *.bak del *.bak
if exist zcpr33t.rel del zcpr33t.rel
if exist zcpr33n.rel del zcpr33n.rel
setlocal & cd ZCPR33 && call Clean.cmd & endlocal

22
Source/BPBIOS/bpbldzx.cmd

@ -1,4 +1,5 @@
@echo off
setlocal
rem Wrapper to run bpbuild under the zx emulator.
rem This cmd file works around an issue
@ -9,21 +10,26 @@ rem a .bak, but fails because the input file is open.
rem So, if an input filename is specified, we take
rem steps to work around this.
setlocal
set PATH=%PATH%;..\..\Tools\zx;..\..\Tools\cpmtools;
set PATH=%PATH%;..\..\Tools\zx;..\..\Tools\cpmtools
set ZXBINDIR=../../tools/cpm/bin/
set ZXLIBDIR=../../tools/cpm/lib/
set ZXINCDIR=../../tools/cpm/include/
if .%1.==.. goto :skip
if not exist %1 goto :err
if exist bpimg.$$$ del bpimg.$$$
copy %1 bpimg.$$$
zx bpbuild -bpimg.$$$
del bpimg.$$$
if exist bpsys.tmp del bpsys.tmp
copy %1 bpsys.tmp
zx bpbuild -bpsys.tmp
del bpsys.tmp
goto :eof
:skip
zx bpbuild
zx bpbuild
goto :eof
:err
echo.
echo Specified file %1 does not exist!
goto :eof

BIN
Source/BPBIOS/zcpr33.rel

Binary file not shown.

2
Source/BuildROM.cmd

@ -1,4 +1,4 @@
@echo off
setlocal
setlocal & cd HBIOS && Powershell .\Build.ps1 %* || exit /b 1 & endlocal
setlocal & cd HBIOS && Powershell -ExecutionPolicy Unrestricted .\Build.ps1 %* || exit /b 1 & endlocal

26
Source/CBIOS/cbios.asm

@ -366,19 +366,6 @@ WBOOT:
;
;__________________________________________________________________________________________________
GOCPM:
#IFDEF PLTUNA
; USE A DEDICATED BUFFER FOR UNA PHYSICAL DISK I/O
LD HL,SECBUF ; ADDRESS OF PHYSICAL SECTOR BUFFER
LD (DSKBUF),HL ; SAVE IT IN DSKBUF FOR LATER
#ELSE
; ALLOCATE A SINGLE SECTOR DISK BUFFER ON THE HBIOS HEAP
LD B,BF_SYSALLOC ; BIOS FUNC: ALLOCATE HEAP MEMORY
LD HL,512 ; 1 SECTOR, 512 BYTES
RST 08 ; DO IT
CALL NZ,PANIC ; HANDLE ERROR
LD (DSKBUF),HL ; RECORD THE BUFFER ADDRESS
#ENDIF
;
LD A,$C3 ; LOAD A WITH 'JP' INSTRUCTION (USED BELOW)
;
@ -1931,6 +1918,19 @@ INIT:
CALL MD_INIT ; INITIALIZE MEMORY DISK DRIVER (RAM/ROM)
CALL DRV_INIT ; INITIALIZE DRIVE MAP
CALL DPH_INIT ; INITIALIZE DPH TABLE AND BUFFERS
;
#IFDEF PLTUNA
; USE A DEDICATED BUFFER FOR UNA PHYSICAL DISK I/O
LD HL,SECBUF ; ADDRESS OF PHYSICAL SECTOR BUFFER
LD (DSKBUF),HL ; SAVE IT IN DSKBUF FOR LATER
#ELSE
; ALLOCATE A SINGLE SECTOR DISK BUFFER ON THE HBIOS HEAP
LD B,BF_SYSALLOC ; BIOS FUNC: ALLOCATE HEAP MEMORY
LD HL,512 ; 1 SECTOR, 512 BYTES
RST 08 ; DO IT
CALL NZ,PANIC ; HANDLE ERROR
LD (DSKBUF),HL ; RECORD THE BUFFER ADDRESS
#ENDIF
;
; DISPLAY FREE MEMORY
LD DE,STR_LDR2 ; FORMATTING

1
Source/Doc/Build.cmd

@ -1,7 +1,6 @@
@echo off
setlocal
setlocal & cd "CPM 22 Manual" && call Build.cmd || exit /b 1 & endlocal
setlocal & cd "ZCPR Manual" && call Build.cmd || exit /b 1 & endlocal
setlocal & cd "RomWBW User Guide" && call Build.cmd || exit /b 1 & endlocal
setlocal & cd "RomWBW System Guide" && call Build.cmd || exit /b 1 & endlocal

23
Source/Doc/CPM 22 Manual - Testing/Build.cmd

@ -1,23 +0,0 @@
@echo off
setlocal
set TOOLS=..\..\..\Tools
set PATH=%TOOLS%\zx;%PATH%
set ZXBINDIR=%TOOLS%/cpm/bin/
set ZXLIBDIR=%TOOLS%/cpm/lib/
set ZXINCDIR=%TOOLS%/cpm/include/
set TEXOPT=-$D
zx TEX21 PART1 %TEXOPT%
zx TEX21 PART2 %TEXOPT%
zx TEX21 PART3 %TEXOPT%
echo Remove extraneous control codes and escape sequences
rem pause
PowerShell .\Strip.ps1
call texify -p --clean "Main.ltx"

8
Source/Doc/CPM 22 Manual - Testing/Clean.cmd

@ -1,8 +0,0 @@
@echo off
setlocal
if exist *.prn del *.prn
if exist *.ix del *.ix
if exist *.log del *.log
if exist part?.txt del part?.txt
if exist *.synctex.gz del *.synctex.gz

243
Source/Doc/CPM 22 Manual - Testing/Main.log

@ -1,243 +0,0 @@
This is pdfTeX, Version 3.14159265-2.6-1.40.17 (MiKTeX 2.9 64-bit) (preloaded format=pdflatex 2016.6.18) 28 JUL 2016 12:40
entering extended mode
**"C:/Users/WWarthen/Projects/N8VEM/Build/RomWBW/Doc/Source/CPM 22 Manual - Tes
ting/Main.ltx"
("C:/Users/WWarthen/Projects/N8VEM/Build/RomWBW/Doc/Source/CPM 22 Manual - Test
ing/Main.ltx"
LaTeX2e <2016/03/31>
Babel <3.9r> and hyphenation patterns for 75 language(s) loaded.
("C:\Program Files\MiKTeX 2.9\tex\latex\base\book.cls"
Document Class: book 2014/09/29 v1.4h Standard LaTeX document class
("C:\Program Files\MiKTeX 2.9\tex\latex\base\bk10.clo"
File: bk10.clo 2014/09/29 v1.4h Standard LaTeX file (size option)
)
\c@part=\count79
\c@chapter=\count80
\c@section=\count81
\c@subsection=\count82
\c@subsubsection=\count83
\c@paragraph=\count84
\c@subparagraph=\count85
\c@figure=\count86
\c@table=\count87
\abovecaptionskip=\skip41
\belowcaptionskip=\skip42
\bibindent=\dimen102
)
("C:\Program Files\MiKTeX 2.9\tex\latex\base\fontenc.sty"
Package: fontenc 2005/09/27 v1.99g Standard LaTeX package
("C:\Program Files\MiKTeX 2.9\tex\latex\base\t1enc.def"
File: t1enc.def 2005/09/27 v1.99g Standard LaTeX file
LaTeX Font Info: Redeclaring font encoding T1 on input line 48.
))
("C:\Program Files\MiKTeX 2.9\tex\latex\bera\beramono.sty"
Package: beramono 2004/01/31 (WaS)
("C:\Program Files\MiKTeX 2.9\tex\latex\graphics\keyval.sty"
Package: keyval 2014/10/28 v1.15 key=value parser (DPC)
\KV@toks@=\toks14
))
("C:\Program Files\MiKTeX 2.9\tex\latex\fancyvrb\fancyvrb.sty"
Package: fancyvrb 2008/02/07
Style option: `fancyvrb' v2.7a, with DG/SPQR fixes, and firstline=lastline fix
<2008/02/07> (tvz)
\FV@CodeLineNo=\count88
\FV@InFile=\read1
\FV@TabBox=\box26
\c@FancyVerbLine=\count89
\FV@StepNumber=\count90
\FV@OutFile=\write3
)
("C:\Program Files\MiKTeX 2.9\tex\latex\geometry\geometry.sty"
Package: geometry 2010/09/12 v5.6 Page Geometry
("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\ifpdf.sty"
Package: ifpdf 2016/05/14 v3.1 Provides the ifpdf switch
)
("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\ifvtex.sty"
Package: ifvtex 2016/05/16 v1.6 Detect VTeX and its facilities (HO)
Package ifvtex Info: VTeX not detected.
)
("C:\Program Files\MiKTeX 2.9\tex\generic\ifxetex\ifxetex.sty"
Package: ifxetex 2010/09/12 v0.6 Provides ifxetex conditional
)
\Gm@cnth=\count91
\Gm@cntv=\count92
\c@Gm@tempcnt=\count93
\Gm@bindingoffset=\dimen103
\Gm@wd@mp=\dimen104
\Gm@odd@mp=\dimen105
\Gm@even@mp=\dimen106
\Gm@layoutwidth=\dimen107
\Gm@layoutheight=\dimen108
\Gm@layouthoffset=\dimen109
\Gm@layoutvoffset=\dimen110
\Gm@dimlist=\toks15
("C:\Program Files\MiKTeX 2.9\tex\latex\geometry\geometry.cfg"))
("C:\Program Files\MiKTeX 2.9\tex\latex\oberdiek\pdflscape.sty"
Package: pdflscape 2016/05/14 v0.11 Display of landscape pages in PDF (HO)
("C:\Program Files\MiKTeX 2.9\tex\latex\graphics\lscape.sty"
Package: lscape 2000/10/22 v3.01 Landscape Pages (DPC)
("C:\Program Files\MiKTeX 2.9\tex\latex\graphics\graphics.sty"
Package: graphics 2016/05/09 v1.0r Standard LaTeX Graphics (DPC,SPQR)
("C:\Program Files\MiKTeX 2.9\tex\latex\graphics\trig.sty"
Package: trig 2016/01/03 v1.10 sin cos tan (DPC)
)
("C:\Program Files\MiKTeX 2.9\tex\latex\00miktex\graphics.cfg"
File: graphics.cfg 2016/01/02 v1.10 sample graphics configuration
)
Package graphics Info: Driver file: pdftex.def on input line 96.
("C:\Program Files\MiKTeX 2.9\tex\latex\pdftex-def\pdftex.def"
File: pdftex.def 2011/05/27 v0.06d Graphics/color for pdfTeX
("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\infwarerr.sty"
Package: infwarerr 2016/05/16 v1.4 Providing info/warning/error messages (HO)
)
("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\ltxcmds.sty"
Package: ltxcmds 2016/05/16 v1.23 LaTeX kernel commands for general use (HO)
)
\Gread@gobject=\count94
)))
Package pdflscape Info: Auto-detected driver: pdftex on input line 81.
)
No file Main.aux.
\openout1 = `Main.aux'.
LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 22.
LaTeX Font Info: ... okay on input line 22.
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 22.
LaTeX Font Info: ... okay on input line 22.
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 22.
LaTeX Font Info: ... okay on input line 22.
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 22.
LaTeX Font Info: ... okay on input line 22.
LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 22.
LaTeX Font Info: ... okay on input line 22.
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 22.
LaTeX Font Info: ... okay on input line 22.
*geometry* driver: auto-detecting
*geometry* detected driver: pdftex
*geometry* verbose mode - [ preamble ] result:
* driver: pdftex
* paper: letterpaper
* layout: <same size as paper>
* layoutoffset:(h,v)=(0.0pt,0.0pt)
* modes:
* h-part:(L,W,R)=(36.135pt, 542.02501pt, 36.135pt)
* v-part:(T,H,B)=(0.0pt, 794.96999pt, 0.0pt)
* \paperwidth=614.295pt
* \paperheight=794.96999pt
* \textwidth=542.02501pt
* \textheight=794.96999pt
* \oddsidemargin=-36.135pt
* \evensidemargin=-36.135pt
* \topmargin=-102.33748pt
* \headheight=12.0pt
* \headsep=18.06749pt
* \topskip=10.0pt
* \footskip=25.29494pt
* \marginparwidth=69.0pt
* \marginparsep=7.0pt
* \columnsep=10.0pt
* \skip\footins=9.0pt plus 4.0pt minus 2.0pt
* \hoffset=0.0pt
* \voffset=0.0pt
* \mag=1000
* \@twocolumnfalse
* \@twosidefalse
* \@mparswitchfalse
* \@reversemarginfalse
* (1in=72.27pt=25.4mm, 1cm=28.453pt)
("C:\Program Files\MiKTeX 2.9\tex\context\base\supp-pdf.mkii"
[Loading MPS to PDF converter (version 2006.09.02).]
\scratchcounter=\count95
\scratchdimen=\dimen111
\scratchbox=\box27
\nofMPsegments=\count96
\nofMParguments=\count97
\everyMPshowfont=\toks16
\MPscratchCnt=\count98
\MPscratchDim=\dimen112
\MPnumerator=\count99
\makeMPintoPDFobject=\count100
\everyMPtoPDFconversion=\toks17
) ("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\pdftexcmds.sty"
Package: pdftexcmds 2016/05/21 v0.22 Utility functions of pdfTeX for LuaTeX (HO
)
("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\ifluatex.sty"
Package: ifluatex 2016/05/16 v1.4 Provides the ifluatex switch (HO)
Package ifluatex Info: LuaTeX not detected.
)
Package pdftexcmds Info: LuaTeX not detected.
Package pdftexcmds Info: \pdf@primitive is available.
Package pdftexcmds Info: \pdf@ifprimitive is available.
Package pdftexcmds Info: \pdfdraftmode found.
)
("C:\Program Files\MiKTeX 2.9\tex\latex\oberdiek\epstopdf-base.sty"
Package: epstopdf-base 2016/05/15 v2.6 Base part for package epstopdf
("C:\Program Files\MiKTeX 2.9\tex\latex\oberdiek\grfext.sty"
Package: grfext 2016/05/16 v1.2 Manage graphics extensions (HO)
("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\kvdefinekeys.sty"
Package: kvdefinekeys 2016/05/16 v1.4 Define keys (HO)
))
("C:\Program Files\MiKTeX 2.9\tex\latex\oberdiek\kvoptions.sty"
Package: kvoptions 2016/05/16 v3.12 Key value format for package options (HO)
("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\kvsetkeys.sty"
Package: kvsetkeys 2016/05/16 v1.17 Key value parser (HO)
("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\etexcmds.sty"
Package: etexcmds 2016/05/16 v1.6 Avoid name clashes with e-TeX commands (HO)
Package etexcmds Info: Could not find \expanded.
(etexcmds) That can mean that you are not using pdfTeX 1.50 or
(etexcmds) that some package has redefined \expanded.
(etexcmds) In the latter case, load this package earlier.
)))
Package grfext Info: Graphics extension search list:
(grfext) [.png,.pdf,.jpg,.mps,.jpeg,.jbig2,.jb2,.PNG,.PDF,.JPG,.JPE
G,.JBIG2,.JB2,.eps]
(grfext) \AppendGraphicsExtensions on input line 456.
)
LaTeX Font Info: Try loading font information for T1+fvm on input line 25.
("C:\Program Files\MiKTeX 2.9\tex\latex\bera\t1fvm.fd"
File: t1fvm.fd 2004/09/07 scalable font definitions for T1/fvm.
)
LaTeX Font Info: Font shape `T1/fvm/m/n' will be
(Font) scaled to size 8.99994pt on input line 25.
! Text line contains an invalid character.
<read 1> 
C
l.25 \VerbatimInput{part1.txt}
?
! Emergency stop.
<read 1> 
C
l.25 \VerbatimInput{part1.txt}
End of file on the terminal!
Here is how much of TeX's memory you used:
2546 strings out of 493335
35826 string characters out of 3139251
101645 words of memory out of 3000000
6068 multiletter control sequences out of 15000+200000
4724 words of font info for 16 fonts, out of 3000000 for 9000
1141 hyphenation exceptions out of 8191
37i,3n,23p,339b,166s stack positions out of 5000i,500n,10000p,200000b,50000s
! ==> Fatal error occurred, no output PDF file produced!

42
Source/Doc/CPM 22 Manual - Testing/Main.ltx

@ -1,42 +0,0 @@
\documentclass[letterpaper,10pt,oneside]{book}
\usepackage[T1]{fontenc}
%\usepackage[defaultmono]{droidmono}
\usepackage[scaled]{beramono}
\usepackage{fancyvrb}
\usepackage{geometry}
\usepackage{pdflscape}
%\usepackage{showframe} % Diagnostic
% Suppress headers and footers completely
\pagestyle{empty}
% 66 lines per page, portrait
%\geometry{top=0.0in, bottom=0.0in, left=1.0in, right=0.5in}
\geometry{top=0.0in, bottom=0.0in, left=0.5in, right=0.5in}
\RecustomVerbatimCommand{\VerbatimInput}{VerbatimInput}%
{
commandchars=\\\{\}
}
\begin{document}
% Part 1 (main document sections)
\VerbatimInput{part1.txt}
% 51 lines per page, landscape
%\newgeometry{top=1.0in, bottom=0.5in, left=0.0in, right=0.0in}
\newgeometry{top=0.5in, bottom=0.5in, left=0.0in, right=0.0in}
\begin{landscape}
% Part 2 (appendices A-G, source listings)
\VerbatimInput{part2.txt}
% back to standard geometry
\end{landscape}
\restoregeometry
% Part 3 (appendices H-I, index)
\VerbatimInput{part3.txt}
\end{document}

BIN
Source/Doc/CPM 22 Manual - Testing/Main.pdf

Binary file not shown.

19
Source/Doc/CPM 22 Manual - Testing/Strip.ps1

@ -1,19 +0,0 @@
function StripFile($Filename)
{
$Content = Get-Content "${Filename}.prn"
$Content = $Content -replace "\0", ""
$Content = $Content -replace "\e.", ""
$Content = $Content -replace "\x1A", ""
$Content = $Content -replace "\0", ""
#$Content = $Content -replace "\\", "\\"
Set-Content "${Filename}.txt" $Content[0..($Content.count - 3)]
}
StripFile("part1")
StripFile("part2")
StripFile("part3")
return

716
Source/Doc/CPM 22 Manual - Testing/appa.tex

@ -1,716 +0,0 @@
.pl 51
.nf
.bp 1
.ft A-%
Appendix A
The Microcomputer Development System Basic Input/Output System (BIOS)
1 ; mds-800 i/o drivers for cp/m 2.2
2 ; (four drive single density version)
3 ;
4 ; version 2.2 february, 1980
5 ;
6 0016 = vers equ 22 ;version 2.2
7 ;
8 ; copyright (c) 1980
9 ; digital research
10 ; box 579, pacific grove
11 ; california, 93950
12 ;
13 ;
14 ffff = true equ 0fffh ;value of "true"
15 0000 = false equ not true ;"false"
16 0000 = test equ false ;true if test bios
17 ;
18 if test
19 bias equ 03400h ;base of ccp in test system
20 endif
21 if not test
22 0000 = bias equ 0000h ;generate relocatable cp/m system
23 endif
24 ;
25 1600 = patch equ 1600h
26 ;
27 1600 org patch
28 0000 = cpmb equ $-patch ;base of cpm console processor
29 0806 = bdos equ 806h+cpmb ;basic dos (resident portion)
30 1600 = cpml equ $-cpmb ;length (in bytes) of cpm system
31 002c = nsects equ cpml/128 ;number of sectors to load
32 0002 = offset equ 2 ;number of disk tracks used by cp/m
33 0004 = cdisk equ 0004h ;address of last logged disk on warm start
34 0080 = buff equ 0080h ;default buffer address
35 000a = retry equ 10 ;max retries on disk i/o before error
36 ;
37 ; perform following functions
38 ; boot cold start
39 ; wboot warm start (save i/o byte)
40 ; (boot and wboot are the same for mds)
41 ; const console status
42 ; reg-a = 00 if no character ready
43 ; reg-a = ff if character ready
44 ; conin console character in (result in reg-a)
45 ; conout console character out (char in reg-c)
46 ; list list out (char in reg-c)
47 ; punch punch out (char in reg-c)
48 ; reader paper tape reader in (result to reg-a)
49 ; home move to track 00
50 ;
51 ; (the following calls set-up the io parameter block for the
52 ; mds, which is used to perform subsequent reads and writes)
53 ; seldsk select disk given by reg-c (0, 1, 2...)
54 ; settrk set track address (0,...76) for subsequent read-write
55 ; setsec set sector address (1,...,26) for subsequent read-write
56 ; setdma set subsequent dma address (initially 80h)
57 ;
58 ; (read and write assume previous calls to set up the io parameters)
59 ; read read track/sector to preset dma address
60 ; write track/sector from preset dma address
61 ;
62 ; jump vector for individual routines
63 1600 c3b316 jmp boot
64 1603 c3c316 wboote: jmp wboot
65 1606 c36117 jmp const
66 1609 c36417 jmp conin
67 160c c36a17 jmp conout
68 160f c36d17 jmp list
69 1612 c37217 jmp punch
70 1615 c37517 jmp reader
71 1618 c37817 jmp home
72 161b c37d17 jmp seldsk
73 161e c3a717 jmp settrk
74 1621 c3ac17 jmp setsec
75 1624 c3bb17 jmp setdma
76 1627 c3c117 jmp read
77 162a c3ca17 jmp write
78 162d c37017 jmp listst ;list status
79 1630 c3b117 jmp sectran
80 ;
81 maclib diskdef ;load the disk definition library
82 disks 4 ;four disks
83 1633+= dpbase equ $ ;base of disk parameter blocks
84 1633+82160000 dpe0: dw xlt0, 0000h ;translate table
85 1637+00000000 dw 0000h, 0000h ;scratch area
86 163b+6e187316 dw dirbuf, dpb0 ;dir buff, parm block
87 163f+0d19ee18 dw csv0, alv0 ;check, alloc vectors
88 1643+82160000 dpe1: dw xlt1, 0000h ;translate table
89 1647+00000000 dw 0000h, 0000h ;scratch area
90 164b+6e187316 dw dirbuf, dpb1 ;dir buff, parm block
91 164f+3c191d19 dw csv1, alv1 ;check, alloc vectors
92 1653+82160000 dpe2: dw xlt2, 0000h ;translate table
93 1657+00000000 dw 0000h, 0000h ;scratch area
94 165b+6e187316 dw dirbuf, dpb2 ;dir buff, parm block
95 165f+6b194c19 dw csv2, alv2 ;check, alloc vectors
96 1663+82160000 dpe3: dw xlt3, 0000h ;translate table
97 1667+00000000 dw 0000h, 0000h ;scratch area
98 166b+6e187316 dw dirbuf, dpb3 ;check, alloc block
99 166f+9a197b19 dw csv3, alv3 ;dir buff, parm vectors
100 diskdef 0, 1, 26, 6, 1024, 243, 64, 64, offset
101 1673+= dpb0 equ $ ;disk parm block
102 1673+1a00 dw 26 ;sec per track
103 1675+03 db 3 ;block shift
104 1676+07 db 7 ;block mask
105 1677+00 db 0 ;extnt mask
106 1678+f200 dw 242 ;disk size-1
107 167a+3f00 dw 63 ;directory max
108 167c+c0 db 192 ;alloc0
109 167d+00 db 0 ;alloc1
110 167e+1000 dw 16 ;check size
111 1680+0200 dw 2 ;offset
112 1682+= xlt0 equ $ ;translate table
113 1682+01 db 1
114 1683+07 db 7
115 1684+0d db 13
116 1685+13 db 19
117 1686+19 db 25
118 1687+05 db 5
119 1688+0b db 11
120 1689+11 db 17
121 168a+17 db 23
122 168b+03 db 3
123 168c+09 db 9
124 168d+0f db 15
125 168e+15 db 21
126 168f+02 db 2
127 1690+08 db 8
128 1691+0e db 14
129 1692+14 db 20
130 1693+1a db 26
131 1694+06 db 6
132 1695+0c db 12
133 1696+12 db 18
134 1697+18 db 24
135 1698+04 db 4
136 1699+0a db 10
137 169a+10 db 16
138 169b+16 db 22
139 diskdef 1,0
140 1673+ = dpb1 equ dpb0 ;equivalent parameters
141 001f+ = als1 equ als0 ;same allocation vector size
142 0010+ = css1 equ css0 ;same checksum vector size
143 1682+ = xlt1 equ xlt0 ;same translate table
144 diskdef 2, 0
145 1673+ = dpb2 equ dpb0 ;equivalent parameters
146 001f+ = als2 equ als0 ;same allocation vector size
147 0010+ = css2 equ css0 ;same checksum vector size
148 1682+ = xlt2 equ xlt0 ;same translate table
149 diskdef 3, 0
150 1673+ = dpb3 equ dpb0 ;equivalent parameters
151 001f+ = als3 equ als0 ;same allocation vector size
152 0010+ = css3 equ css0 ;same checksum vector size
153 1682+ = xlt3 equ xlt0 ;same translate table
154 ; endef occurs at end of assembly
155 ;
156 ; end of controller--independent code, the remaining subroutines
157 ; are tailored to the particular operating environment, and must
158 ; be altered for any system which differs from the intel mds.
159 ;
160 ; the following code assumes the mds monitor exists at 0f800h
161 ; and uses the i/o subroutines within the monitor
162 ;
163 ; we also assume the mds system has four disk drives
164 00fd = revrt equ 0fdh ;interrupt revert port
165 00fc = intc equ 0fch ;interrupt mask port
166 00f3 = icon equ 0f3h ;interrupt control port
167 007E = inte equ 0111$1110b ;enable rst 0 (warm boot), rst 7 (monitor)
168 ;
169 ; mds monitor equates
170 f800 = mon80 equ 0f800h ;mds monitor
171 ff0f = rmon80 equ 0ff0fh ;restart mon80 (boot error)
172 f803 = ci equ 0f803h ;console character to reg-a
173 f806 = ri equ 0f806h ;reader in to reg-a
174 f809 = co equ 0f809h ;console char from c to console out
175 f80c = po equ 0f80ch ;punch char from c to punch device
176 f80f = lo equ 0f80fh ;list from c to list device
177 f812 = csts equ 0f812h ;console status 00/ff to register a
178 ;
179 ; disk ports and commands
180 0078 = base equ 78h ;base of disk command io ports
181 0078 = dstat equ base ;disk status (input)
182 0079 = rtype equ base+1 ;result type (input)
183 007b = rbyte equ base+3 ;result byte (input)
184 ;
185 0079 = ilow equ base+1 ;iopb low address (output)
186 007a = ihigh equ base+2 ;iopb high address (output)
187 ;
188 0004 = readf equ 4h ;read function
189 0006 = writf equ 6h ;write function
190 0003 = recal equ 3h ;recalibrate drive
191 0004 = iordy equ 4h ;i/o finished mask
192 000d = cr equ 0dh ;carriage return
193 000a = lf equ 0ah ;line-feed
194 ;
195 signon: ;signon message: xxk cp/m vers y.y
196 169c 0d0a0a db cr, lf, lf
197 if test
198 db '32' ;32k example bios
199 endif
200 if not test
201 169f 3030 db '00' ;memory size filled by relocator
202 endif
203 16a1 6b2043502f db 'k cp/m vers '
204 16ad 322e32 db ver/10+'0', ',' vers mod 10+'0'
205 16b0 0d0a00 db cr, lf, 0
206 ;
207 boot: ;print signon message and go to ccp
208 ; (note: mds boot initialized iobyte at 0003h)
209 16b3 310001 lxi sp, buff+80h
210 16b6 219c16 lxi h, signon
211 16b9 cdd317 call prmsg ;print message
212 16bc af xra a ;clear accumulator
213 16bd 320400 sta cdisk ;set initially to disk a
214 16c0 c30f17 jmp gocpm ;go to cp/m
215 ;
216 ;
217 wboot:; loader on track 0, sector 1, which will be skipped for warm
218 ; read cp/m from disk--assuming there is a 128 byte cold start
219 ; start
220 ;
221 16c3 318000 lxi sp, buff ;using dma--thus 80 thru ff available for stack
222 ;
223 16c6 0e0a mvi c, retry ;max retries
224 16c8 c5 push b
225 wboot0: ;enter here on error retries
226 16c9 010000 lxi b, cpmb ;set dma address to start of disk system
227 16cc cdbb17 call setdma
228 16cf 0e00 mvi c, 0 ;boot from drive 0
229 16d1 cd7d17 call seldsk
230 16d4 0e00 mvi c, 0
231 16d6 cda717 call settrk ;start with track 0
232 16d9 0e02 mvi c, 2 ;start reading sector 2
233 16db cdac17 call setsec
234 ;
235 ; read sectors, count nsects to zero
236 16de c1 pop b ;10-error count
237 16df 062c mvi b, nsects
238 rdsec: ;read next sector
239 16e1 c5 push b ;save sector count
240 16e2 cdc117 call read
241 16e5 c24917 jnz booterr ;retry if errors occur
242 16e8 2a6c18 lhld iod ;increment dma address
243 16eb 118000 lxi d, 128 ;sector size
244 16ee 19 dad d ;incremented dma address in hl
245 16ef 44 mov b, h
246 16f0 4d mov c, l ;ready for call to set dma
247 16f1 cdbb17 call setdma
248 16f4 3a6b18 lda ios ;sector number just read
249 16f7 fe1a cpi 26 ;read last sector?
250 16f9 da0517 jc rd1
251 ; must be sector 26, zero and go to next track
252 16fc 3a6a18 lda iot ;get track to register a
253 16ff 3c inr a
254 1700 4f mov c, a ;read for call
255 1701 cda717 call settrk
256 1704 af xra a ;clear sector number
257 1705 3c rd1: inr a ;to next sector
258 1706 4f mov c, a ;ready for call
259 1707 cdac17 call setsec
260 170a c1 pop b ;recall sector count
261 170b 05 dcr b ;done?
262 170c c2e116 jnz rdsec
263 ;
264 ; done with the load, reset default buffer address
265 gocpm: ;(enter here from cold start boot)
266 ; enable rst0 and rst7
267 170f f3 di
268 1710 3e12 mvi a, 12h ;initialize command
269 1712 d3fd out revrt
270 1714 af xra a
271 1715 d3fc out intc ;cleared
272 1717 3e7e mvi a, inte ;rst0 and rst7 bits on
273 1719 d3fc out intc
274 171b af xra a
275 171c d3f3 out icon ;interrupt control
276 ;
277 ; set default buffer address to 80h
278 171e 018000 lxi b, buff
279 1721 cdbb17 call setdma
280 ;
281 ; reset monitor entry points
282 1724 3ec3 mvi a, jmp
283 1726 320000 sta 0
284 1729 210316 lxi h, wboote
285 172c 220100 shld 1 ;jump wboot at location 00
286 172f 320500 sta 5
287 1732 210608 lxi h, bdos
288 1735 220600 shld 6 ;jmp bdos at location 5
289 if not test
290 1738 323800 sta 7*8 ;jmp to mon80 (may have changed by ddt)
291 173b 2100f8 lxi h, mon80
292 173e 223900 shld 7*8+1
293 endif
294 ; leave iobyte set
295 ; previously selected disk was b, send parameter to cpm
296 1741 3a0400 lda cdisk ;last logged disk number
297 1744 4f mov c, a ;send to ccp to log it in
298 1745 fb ei
299 1746 c30000 jmp cpmb
300 ;
301 ; error condition occurred, print message and retry
302 booterr:
303 1749 c1 pop b ;recall counts
304 174a 0d dcr c
305 174b ca5217 jz booter0
306 ; try again
307 174e c5 push b
308 174f c3c916 jmp wboot0
309 ;
310 booter0:
311 ; otherwise too many retries
312 1752 215b17 lxi h, bootmsg
313 1755 cdd317 call prmsg
314 1758 c30fff jmp rmon80 ;mds hardware monitor
315 ;
316 bootmsg:
317 175b 3f626f6f74 db '?boot', 0
318 ;
319 ;
320 const: console status to reg-a
321 ; (exactly the same as mds call)
322 1761 c312f8 jmp csts
323 ;
324 conin: ;console character to reg-a
325 1764 cd03f8 call ci
326 1767 e67f ani 7fh ;remove parity bit
327 1769 c9 ret
328 ;
329 conout: ;console character from c to console out
330 176a c309f8 jmp co
331 ;
332 list: ;list device out
333 ; (exactly the same as mds call)
334 176d c30ff8 jmp lo
335 ;
336 listst:
337 ;return list status
338 1770 af xra a
339 1771 c9 ret ;always not ready
340 ;
341 punch: ;punch device out
342 ; (exactly the same as mds call)
343 1772 c30cf8 jmp po
344 ;
345 reader: ;reader character in to reg-a
346 ; (exactly the same as mds call)
347 1775 c306f8 jmp ri
348 ;
349 home: ;move to home position
350 ; treat as track 00 seek
351 1778 0e00 mvi c, 0
352 177a c3a717 jmp settrk
353 ;
354 seldsk: ;select disk given by register c
355 177d 210000 lxi h, 0000h ;return 0000 if error
356 1780 79 mov a, c
357 1781 fe04 cpi ndisks ;too large?
358 1783 d0 rnc ;leave hl = 0000
359 ;
360 1784 e602 ani 10b ;00 00 for drive 0, 1 and 10 10 for drive 2, 3
361 1786 326618 sta dbank ;to select drive bank
362 1789 79 mov a, c ;00, 01, 10, 11
363 178a e601 ani 1b ;mds has 0, 1 at 78, 2, 3 at 88
364 178c b7 ora a ;result 00?
365 178d ca9217 jz setdrive
366 1790 3e30 mvi a, 00110000b ;selects drive 1 in bank
367 setdrive:
368 1792 47 mov b, a ;save the function
369 1793 216818 lxi h, iof ;io function
370 1796 7e mov a, m
371 1797 e6cf ani 11001111b ;mask out disk number
372 1799 b0 ora b ;mask in new disk number
373 179a 77 mov m, a ;save it in iopb
374 179b 69 mov l, c
375 179c 2600 mvi h, 0 ;hl=disk number
376 179e 29 dad h ;*2
377 179f 29 dad h ;*4
378 17a0 29 dad h ;*8
379 17a1 29 dad h ;*16
380 17a2 113316 lxi d, dpbase
381 17a5 19 dad d ;hl=disk header table address
382 17a6 c9 ret
383 ;
384 ;
385 settrk: ;set track address given by c
386 17a7 216a18 lxi h, iot
387 17aa 71 mov m, c
388 17ab c9 ret
389 ;
390 setsec: ;set sector number given by c
391 17ac 216b18 lxi h, ios
392 17af 71 mov m, c
393 17b0 c9 ret
394 sectran:
395 ;translate sector bc using table at de
396 17b1 0600 mvi b, 0 ;double-precision sector number in bc
397 17b3 eb xchg ;translate table address to hl
398 17b4 09 dad b ;translate (sector) address
399 17b5 7e mov a, m ;translated sector number to a
400 17b6 326b18 sta ios
401 17b9 6f mov l, a ;return sector number in l
402 17ba c9 ret
403 ;
404 setdma: ;set dma address given by regs b, c
405 17bb 69 mov l, c
406 17bc 60 mov h, b
407 17bd 226c18 shld iod
408 17c0 c9 ret
409 ;
410 read: ;read next disk record (assuming disk/trk/sec/dma set)
411 17c1 0e04 mvi c, readf ;set to read function
412 17c3 cde017 call setfunc
413 17c6 cdf017 call waitio ;perform read function
414 17c9 c9 ret ;may have error set in reg-a
415 ;
416 ;
417 write: ;disk write function
418 17ca 0e06 mvi c, writf
419 17cc cde017 call setfunc ;set to write function
420 17cf cdf017 call waitio
421 17d2 c9 ret ;may have error set
422 ;
423 ;
424 ; utility subroutines
425 prmsg: ;print message at h, l to 0
426 17d3 7e mov a, m
427 17d4 b7 ora a zero?
428 17d5 c8 rz
429 ; more to print
430 17d6 e5 push h
431 17d7 4f mov c,a
432 17d8 cd6a17 call conout
433 17db e1 pop h
434 17dc 23 inx h
435 17dd c3d317 jmp prmsg
436 ;
437 setfunc:
438 ; set function for next i/o (command in reg-c)
439 17e0 216818 lxi h, iof ;io function address
440 17e3 7e mov a, m ;get it to accumulator for masking
441 17e4 e6f8 ani 11111000b ;remove previous command
442 17e6 b1 ora c ;set to new command
443 17e7 77 mov m, a ;replaced in iopb
444 ; the mds-800 controller requires disk bank bit in sector byte
445 ; mask the bit from the current i/o function
446 17e8 e620 ani 00100000b ;mask the disk select bit
447 17ea 216b18 lxi h, ios ;address the sector select byte
448 17ed b6 ora m ;select proper disk bank
449 17ee 77 mov m, a ;set disk select bit on/off
450 17ef c9 ret
451 ;
452 waitio:
453 17f0 0e0a mvi c, retry ;max retries before perm error
454 rewait:
455 ; start the i/o function and wait for completion
456 17f2 cd3f18 call intype ;in rtype
457 17f5 cd4c18 call inbyte ;clears the controller
458 ;
459 17f8 3a6618 lda dbank ;set bank flags
460 17fb b7 ora a ;zero if drive 0, 1 and nz if 2, 3
461 17fc 3e67 mvi a, iopb and offh ;low address for iopb
462 17fe 0618 mvi b, iopb shr 8 ;high address for iopb
463 1800 c20b18 jnz iodr1 ;drive bank 1?
464 1803 d379 out ilow ;low address to controller
465 1805 78 mov a, b
466 1806 d37a out ihigh ;high address
467 1808 c31018 jmp waito ;to wait for complete
468 ;
469 iodr1: ;drive bank 1
470 180b d389 out ilow+10h ;88 for drive bank 10
471 180d 78 mov a, b
472 180e d38a out ihigh+10h
473 ;
474 1810 cd5918 waito: call instat ;wait for completion
475 1813 e604 ani iordy ;ready?
476 1815 ca1018 jz waito
477 ;
478 ; check io completion ok
479 1818 cd3f18 call intype ;must be io complete (00) unlinked
480 ; 00 unlinked i/o complete, 01 linked i/o complete (not used)
481 ; io disk status changed 11 (not used)
482 181b fe02 cpi 10b ;ready status change?
483 181d ca3218 jz wready
484 ;
485 ; must be 00 in the accumulator
486 1820 b7 ora a
487 1821 c23818 jnz werror ;some other condition, retry
488 ;
489 ; check i/o error bits
490 1824 cd4c18 call inbyte
491 1827 17 ral
492 1828 da3218 jc wready ;unit not ready
493 182b 1f rar
494 182c e6fe ani 11111110b ;any other errors? (deleted data ok)
495 182e c23818 jnz werror
496 ;
497 ; read or write is ok, accumulator contains zero
498 1831 c9 ret
499 ;
500 wready: ;not ready, treat as error for now
501 1832 cd4c18 call inbyte ;clear result byte
502 1835 c33818 jmp trycount
503 ;
504 werror: ;return hardware malfunction (crc, track, seek, etc.)
505 ; the mds controller has returned a bit in each position
506 ; of the accumulator, corresponding to the conditions:
507 ; 0 -deleted data (accepted as ok above)
508 ; 1 -crc error
509 ; 2 -seek error
510 ; 3 -address error (hardware malfunction)
511 ; 4 -data over/under flow (hardware malfunction)
512 ; 5 -write protect (treated as not ready)
513 ; 6 -write error (hardware malfunction)
514 ; j -not ready
515 ; (accumulator bits are numbered 7 6 5 4 3 2 1 0)
516 ;
517 ; it may be useful to filter out the various conditions,
518 ; but we will get a permanent error message if it is not
519 ; recoverable. in any case, the not ready condition is
520 ; treated as a separated condition for later improvement
521 trycount:
522 ; register c contains retry count, decrement 'til zero
523 1838 0d dcr c
524 1839 c2f217 jnz rewait ;for another try
525 ;
526 ; cannot recover from error
527 183c 3e01 mvi a, 1 ;error code
528 183e c9 ret
529 ;
530 ; intype, inbyte, instat read drive bank 00 or 10
531 183f 3a6618 intype: lda dbank
532 1842 b7 ora a
533 1843 c24918 jnz intyp1 ;skip to bank 10
534 1846 db79 in rtype
535 1848 c9 ret
536 1849 db89 intyp1: in rtype+10h ;78 for 0, 1 88 for 2, 3
537 184b c9 ret
538 ;
539 184c 3a6618 inbyte: lda dbank
540 184f b7 ora a
541 1850 c25618 jnz inbyt1
542 1853 db7b in rbyte
543 1855 c9 ret
544 1856 db8b inbyt1: in rbyte+10h
545 1858 c9 ret
546 ;
547 1859 3a6618 instat: lda dbank
548 185c b7 ora a
549 185d c26318 jnz insta1
550 1860 db78 in dstat
551 1862 c9 ret
552 1863 db88 insta1: in dstat+10h
553 1865 c9 ret
554 ;
555 ;
556 ;
557 ; data areas (must be in ram)
558 1866 00 dbank: db 0 ;disk bank 00 if drive 0, 1
559 ; 10 if drive 2, 3
560 iopb: ;io parameter block
561 1867 80 db 80h ;normal i/o operation
562 1868 04 iof: db readf ;io function, initial read
563 1869 01 ion: db 1 ;number of sectors to read
564 186a 02 iot: db offset ;track number
565 186b 01 ios: db 1 ;sector number
566 186c 8000 iod: dw buff ;io address
567 ;
568 ;
569 ; define ram areas for bdos operation
570 endef
571 186e+= begdat equ $
572 186e+ dirbuf: ds 128 ;directory access buffer
573 18ee+ alv0: ds 31
574 190d+ csv0: ds 16
575 191d+ alv1: ds 31
576 193c+ csv1: ds 16
577 194c+ alv2: ds 31
578 196b+ csv2: ds 16
579 197b+ alv3: ds 31
580 199a+ csv3: ds 16
581 19aa+= enddat equ $
582 013c+= datsiz equ $-begdat
583 19aa end
als1 001f 141#
als2 001f 146#
als3 001f 151#
alv0 18ee 87 573#
alv1 191d 91 575#
alv2 194c 95 577#
alv3 197b 99 579#
base 0078 180# 181 182 183 185 186
bdos 0806 29# 287
begdat 186e 571# 582
bias 0000 19# 22#
boot 16b3 63 207#
booter0 1752 305 310#
booterr 1749 241 302#
bootmsg 175b 312 316#
buff 0080 34# 209 221 278 566
cdisk 0004 33# 213 296
ci f803 172# 325
co f809 174# 330
conin 1764 66 324#
conout 176a 67 329# 432
const 1761 65 320#
cpmb 0000 28# 29 30 226 299
cpml 1600 30# 31
cr 000d 192# 196 205
css1 0010 142#
css2 0010 147#
css3 0010 152#
csts f812 177# 322
csv0 190d 87 574#
csv1 193c 91 576#
csv2 196b 95 578#
csv3 199a 99 580#
datsiz 013c 582#
dbank 1866 361 459 531 539 539 547 558#
dirbuf 186e 86 90 94 98 572#
dpb0 1673 86 101# 140 145 150
dpb1 1673 90 140#
dpb2 1673 94 145#
dpb3 1673 98 150#
dpbase 1633 83# 380
dpe0 1633 84#
dpe1 1643 88#
dpe2 1653 92#
dpe3 1663 96#
dstat 0078 181# 550 552
enddat 19aa 581#
false 0000 15# 16
gocpm 170f 214 265#
home 1778 71 349#
icon 00fe 166# 275
ihigh 007a 186# 466 472
ilow 0079 185# 464 470
inbyt1 1856 541 544#
inbyte 184c 457 490 501 539#
insta1 1863 549 552#
instat 1859 474 547#
intc 00fc 165# 271 273
inte 007e 167# 272
intyp1 1849 533 536#
intype 183f 456 479 531#
iod 186c 242 407 566#
iodr1 180b 463 469#
iof 1868 369 439 562#
ion 1869 563#
iopb 1867 461 462 560#
iordy 0004 191# 475
ios 186b 248 391 400 447 565#
iot 186a 252 386 564#
lf 000a 193# 196 196 205
list 176d 68 332#
listst 1770 78 336#
lo f80f 176# 334
mon80 f800 170# 291
nsects 002c 31# 237
offset 0002 32# 100 564
patch 1600 25# 27 28
po f80c 175# 343
prmsg 17d3 211 313 425# 435
punch 1772 69 341#
rbyte 007b 183# 542 544
rd1 1705 250 257#
rdsec 16e1 238# 262
read 17c1 76 240 410#
reader 1775 70 345#
readf 0004 188# 411 562
recal 0003 190#
retry 000a 35# 223 453
revrt 00fd 164# 269
rewait 17f2 454# 524
ri f806 173# 347
rmon80 ff0f 171# 314
rtype 0079 182# 534 536
sectran 17b1 79 394#
seldsk 177d 72 229 354#
setdma 17bb 75 227 247 279 404#
setdrive 1792 365 367#
setfunc 17e0 412 419 437#
setsec 17ac 74 233 259 390#
settrk 17a7 73 231 255 352 385#
signon 169c 195# 210
test 0000 16# 18 21 197 200 289
true ffff 14# 15
trycount 1838 502 521#
vers 0016 6# 204 204
waito 1810 467 474# 476
waitio 17f0 413 420 452#
wboot 16c3 64 217#
wboot0 16c9 225# 308
wboote 1603 64# 284
werror 1838 487 495 504#
wready 1832 483 492 500#
write 17ca 77 417#
writf 0006 189# 418
xlt0 1682 84 112# 143 148 153
xlt1 1682 88 143#
xlt2 1682 92 148#
xlt3 1682 96 153#
.nx appb


371
Source/Doc/CPM 22 Manual - Testing/appb.tex

@ -1,371 +0,0 @@
.pl 51
.nf
.bp 1
.ft B-%
Appendix B
A Skeletal CBIOS
1 ; skeletal cbios for first level of cp/m 2.0 alteration
2 ;
3 0014 = msize equ 20 ;cp/m version memory size in kilobytes
4 ;
5 ; "bias" is address offset from 3400h for memory systems
6 ; than 16k (referred to as "b" throughout the text)
7 ;
8 0000 = bias equ (msize-20)*1024
9 3400 = ccp equ 3400h+bias ;base of ccp
10 3c06 = bdos equ ccp+806h ;base of bdos
11 4a00 = bios equ ccp+1600h ;base of bios
12 0004 = cdisk equ 0004h ;current disk number 0=a,..., 15=p
13 0003 = iobyte equ 0003h ;intel i/o byte
14 ;
15 4a00 org bios ;origin of this program
16 002c = nsects equ ($-ccp)/128 ;warm start sector count
17 ;
18 ; jump vector for individual subroutines
19 4a00 c39c4a jmp boot ;cold start
20 4a03 c3a64a wboote: jmp wboot ;warm start
21 4a06 c3114b jmp const ;console status
22 4a09 c3244b jmp conin ;console character in
23 4a0c c3374b jmp conout ;console character out
24 4a0f c3494b jmp list ;list character out
25 4a12 c34d4b jmp punch ;punch character out
26 4a15 c34f4b jmp reader ;reader character out
27 4a18 c3544b jmp home ;move head to home position
28 4a1b c35a4b jmp seldsk ;select disk
29 4a1e c37d4b jmp settrk ;set track number
30 4a21 c3924b jmp setsec ;set sector number
31 4a24 c3ad4b jmp setdma ;set dma address
32 4a27 c3c34b jmp read ;read disk
33 4a2a c3d64b jmp write ;write disk
34 4a2d c34b4b jmp listst ;return list status
35 4a30 c3a74b jmp sectran ;sector translate
36 ;
37 ; fixed data tables for four-drive standard
38 ; ibm-compatible 8" disks
39 ; disk parameter header for disk 00
40 4a33 734a0000 dpbase: dw trans, 0000h
41 4a37 00000000 dw 0000h, 0000h
42 4a3b f04c8d4a dw dirbf, dpblk
43 4a3f ec4d704d dw chk00, all00
44 ; disk parameter header for disk 01
45 4a43 734a0000 dw trans, 0000h
46 4a47 00000000 dw 0000h, 0000h
47 4a4b f04c8d4a dw dirbf, dpblk
48 4a4f fc4d8f4d dw chk01, all01
49 ; disk parameter header for disk 02
50 4a53 734a0000 dw trans, 0000h
51 4a57 00000000 dw 0000h, 0000h
52 4a5b f04c8d4a dw dirbf, dpblk
53 4a5f 0c4eae4d dw chk02, all02
54 ; disk parameter header for disk 03
55 4a63 734a0000 dw trans, 0000h
56 4a67 00000000 dw 0000h, 0000h
57 4a6b f04c8d4a dw dirbf, dpblk
58 4a6f 1c4ecd4d dw chk03, all03
59 ;
60 ; sector translate vector
61 4a73 01070d13 trans: db 1, 7, 13, 19 ;sectors 1, 2, 3, 4
62 4a77 19050b11 db 25, 5, 11, 17 ;sectors 5, 6, 7, 8
63 4a7b 1703090f db 23, 3, 9, 15 ;sectors 9, 10, 11, 12
64 4a7f 1502080e db 21, 2, 8, 14 ;sectors 13, 14, 15, 16
65 4a83 141a060c db 20, 26, 6, 12 ;sectors 17, 18, 19, 20
66 4a87 1218040a db 18, 24, 4, 10 ;sectors 21, 22, 23, 24
67 4a8b 1016 db 16, 22 ;sectors 25, 26
68 ;
69 dpblk: ;disk parameter block, common to all disks
70 4a8d 1a00 dw 26 ;sectors per track
71 4a8f 03 db 3 ;block shift factor
72 4a90 07 db 7 ;block mask
73 4a91 00 db 0 ;null mask
74 4a92 f200 dw 242 ;disk size-1
75 4a94 3f00 dw 63 ;directory max
76 4a96 c0 db 192 ;alloc 0
77 4a97 00 db 0 ;alloc 1
78 4a98 1000 dw 16 ;check size
79 4a9a 0200 dw 2 ;track offset
80 ;
81 ; end of fixed tables
82 ;
83 ; individual subroutines to perform each function
84 boot: ;simplest case is to just perform parameter initialization
85 4a9c af xra a ;zero in the accum
86 4a9d 320300 sta iobyte ;clear the iobyte
87 4aa0 320400 sta cdisk ;select disk zero
88 4aa3 c3ef4a jmp gocpm ;initialize and go to cp/m
89 ;
90 wboot: ;simplest case is to read the disk until all sectors loaded
91 4aa6 318000 lxi sp, 80h ;use space below buffer for stack
92 4aa9 0e00 mvi c, 0 ;select disk 0
93 4aab cd5a4b call seldsk
94 4aae cd544b call home ;go to track 00
95 ;
96 4ab1 062c mvi b, nsects ;b counts # of sectors to load
97 4ab3 0e00 mvi c, 0 ;c has the current track number
98 4ab5 1602 mvi d, 2 ;d has the next sector to read
99 ; note that we begin by reading track 0, sector 2 since sector 1
100 ; contains the cold start loader, which is skipped in a warm start
101 4ab7 210034 lxi h, ccp ;base of cp/m (initial load point)
102 load1: ;load one more sector
103 4aba c5 push b ;save sector count, current track
104 4abb d5 push d ;save next sector to read
105 4abc e5 push h ;save dma address
106 4abd 4a mov c, d ;get sector address to register c
107 4abe cd924b call setsec ;set sector address from register c
108 4ac1 c1 pop b ;recall dma address to b, c
109 4ac2 c5 push b ;replace on stack for later recall
110 4ac3 cdad4b call setdma ;set dma address from b, c
111 ;
112 ; drive set to 0, track set, sector set, dma address set
113 4ac6 cdc34b call read
114 4ac9 fe00 cpi 00h ;any errors?
115 4acb c2a64a jnz wboot ;retry the entire boot if an error occurs
116 ;
117 ; no error, move to next sector
118 4ace e1 pop h ;recall dma address
119 4acf 118000 lxi d, 128 ;dma=dma+128
120 4ad2 19 dad d ;new dma address is in h, l
121 4ad3 d1 pop d ;recall sector address
122 4ad4 c1 pop b ;recall number of sectors remaining, and current trk
123 4ad5 05 dcr b ;sectors=sectors-1
124 4ad6 caef4a jz gocpm ;transfer to cp/m if all have been loaded
125 ;
126 ; more sectors remain to load, check for track change
127 4ad9 14 inr d
128 4ada 7a mov a,d ;sector=27?, if so, change tracks
129 4adb fe1b cpi 27
130 4add daba4a jc load1 ;carry generated if sector<27
131 ;
132 ; end of current track, go to next track
133 4ae0 1601 mvi d, 1 ;begin with first sector of next track
134 4ae2 0c inr c ;track=track+1
135 ;
136 ; save register state, and change tracks
137 4ae3 c5 push b
138 4ae4 d5 push d
139 4ae5 e5 push h
140 4ae6 cd7d4b call settrk ;track address set from register c
141 4ae9 e1 pop h
142 4aea d1 pop d
143 4aeb c1 pop b
144 4aec c3ba4a jmp load1 ;for another sector
145 ;
146 ; end of load operation, set parameters and go to cp/m
147 gocpm:
148 4aef 3ec3 mvi a, 0c3h ;c3 is a jmp instruction
149 4af1 320000 sta 0 ;for jmp to wboot
150 4af4 21034a lxi h, wboote ;wboot entry point
151 4af7 220100 shld 1 ;set address field for jmp at 0
152 ;
153 4afa 320500 sta 5 ;for jmp to bdos
154 4afd 21063c lxi h, bdos ;bdos entry point
155 4b00 220600 shld 6 ;address field of jump at 5 to bdos
156 ;
157 4b03 018000 lxi b, 80h ;default dma address is 80h
158 4b06 cdad4b call setdma
159 ;
160 4b09 fb ei ;enable the interrupt system
161 4b0a 3a0400 lda cdisk ;get current disk number
162 4b0d 4f mov c, a ;send to the ccp
163 4b0e c30034 jmp ccp ;go to cp/m for further processing
164 ;
165 ;
166 ; simple i/o handlers (must be filled in by user)
167 ; in each case, the entry point is provided, with space reserved
168 ; to insert your own code
169 ;
170 const: ;console status, return 0ffh if character ready, 00h if not
171 4b11 ds 10h ;space for status subroutine
172 4b21 3e00 mvi a, 00h
173 4b23 c9 ret
174 ;
175 conin: ;console character into register a
176 4b24 ds 10h ;space for input routine
177 4b34 e67f ani 7fh ;strip parity bit
178 4b36 c9 ret
179 ;
180 conout: ;console character output from register c
181 4b37 79 mov a, c ;get to accumulator
182 4b38 ds 10h ;space for output routine
183 4b48 c9 ret
184 ;
185 list: ;list character from register c
186 4b49 79 mov a, c ;character to register a
187 4b4a c9 ret ;null subroutine
188 ;
189 listst: ;return list status (0 if not ready, 1 if ready)
190 4b4b af xra a ;0 is always ok to return
191 4b4c c9 ret
192 ;
193 punch: ;punch character from register c
194 4b4d 79 mov a, c ;character to register a
195 4b4e c9 ret ;null subroutine
196 ;
197 ;
198 reader: ;reader character into register a from reader device
199 4b4f 3e1a mvi a, 1ah ;enter end of file for now (replace later)
200 4b51 e67f ani 7fh ;remember to strip parity bit
201 4b53 c9 ret
202 ;
203 ;
204 ; i/o drivers for the disk follow
205 ; for now, we will simply store the parameters away for use
206 ; in the read and write subroutines
207 ;
208 home: ;move to the track 00 position of current drive
209 ; translate this call into a settrk call with parameter 00
210 4b54 0e00 mvi c, 0 ;select track 0
211 4b56 cd7d4b call settrk
212 4b59 c9 ret ;we will move to 00 on first read/write
213 ;
214 seldsk: ;select disk given by register c
215 4b51 210000 lxi h, 0000h ;error return code
216 4b5d 79 mov a, c
217 4b5e 32ef4c sta diskno
218 4b61 fe04 cpi 4 ;must be between 0 and 3
219 4b63 d0 rnc ;no carry if 4, 5,...
220 ; disk number is in the proper range
221 4b64 ds 10 ;space for disk select
222 ; compute proper disk parameter header address
223 4b6e 3aef4c lda diskno
224 4b71 6f mov l, a ;l=disk number 0, 1, 2, 3
225 4b72 2600 mvi h, 0 ;high order zero
226 4b74 29 dad h ;*2
227 4b75 29 dad h ;*4
228 4b76 29 dad h ;*8
229 4b77 29 dad h ;*16 (size of each header)
230 4b78 11334a lxi d, dpbase
231 4b7b 19 dad 0 ;hl=.dpbase (diskno*16)
232 4b7c c9 ret
233 ;
234 settrk: ;set track given by register c
235 4b7d 79 mov a, c
236 4b7e 32e94c sta track
237 4b81 ds 10h ;space for track select
238 4b91 c9 ret
239 ;
240 setsec: ;set sector given by register c
241 4b92 79 mov a, c
242 4b93 32eb4c sta sector
243 4b96 ds 10h ;space for sector select
244 4ba6 c9 ret
245 ;
246 sectran:
247 ;translate the sector given by bc using the
248 ;translate table given by de
249 4ba7 eb xchg ;hl=.trans
250 4ba8 09 dad b ;hl=.trans (sector)
251 4ba9 6e mov l, m ;l=trans (sector)
252 4baa 2600 mvi h, 0 ;hl=trans (sector)
253 4bac c9 ret ;with value in hl
254 ;
255 setdma: ;set dma address given by registers b and c
256 4bad 69 mov l, c ;low order address
257 4bae 60 mov h, b ;high order address
258 4baf 22ed4c shld dmaad ;save the address
259 4bb2 ds 10h ;space for setting the dma address
260 4bc2 c9 ret
261 ;
262 read: ;perform read operation (usually this is similar to write
263 ; so we will allow space to set up read command, then use
264 ; common code in write)
265 4bc3 ds 10h ;set up read command
266 4bd3 c3e64b jmp waitio ;to perform the actual i/o
267 ;
268 write: ;perform a write operation
269 4bd6 ds 10h ;set up write command
270 ;
271 waitio: ;enter here from read and write to perform the actual i/o
272 ; operation. return a 00h in register a if the operation completes
273 ; properly, and 01h if an error occurs during the read or write
274 ;
275 ; in this case, we have saved the disk number in 'diskno' (0, 1)
276 ; the track number in 'track' (0-76)
277 ; the sector number in 'sector' (1-26)
278 ; the dma address in 'dmaad' (0-65535)
279 4be6 ds 256 ;space reserved for i/o drivers
280 4ce6 3e01 mvi a, 1 ;error condition
281 4ce8 c9 ret ;replaced when filled-in
282 ;
283 ; the remainder of the cbios is reserved uninitialized
284 ; data area, and does not need to be a part of the
285 ; system memory image (the space must be available,
286 ; however, between "begdat" and "enddat").
287 ;
288 4ce9 track: ds 2 ;two bytes for expansion
289 4ceb sector: ds 2 ;two bytes for expansion
290 4ced dmaad: ds 2 ;direct memory address
291 4cef diskno: ds 1 ;disk number 0-15
292 ;
293 ; scratch ram area for bdos use
294 4cf0= begdat equ $ ;beginning of data area
295 4cf0 dirfb: ds 128 ;scratch directory area
296 4d70 all00: ds 31 ;allocation vector 0
297 4d8f all01: ds 31 ;allocation vector 1
298 4dae all02: ds 31 ;allocation vector 2
299 4dcd all03: ds 31 ;allocation vector 3
300 4dec chk00: ds 16 ;check vector 0
301 4dfc chk01: ds 16 ;check vector 1
302 4e0c chk02: ds 16 ;check vector 2
303 4e1c chk03: ds 16 ;check vector 3
304 ;
305 4e2c enddat equ $ ;end of data area
306 013c= datsiz equ $-begdat; ;size of data area
307 4e2c end
all00 4d70 43 296#
all01 4d8f 48 297#
all02 4dae 53 298#
all03 4dcd 58 299#
bdos 3c06 10# 154
begdat 4cf0 294# 306
bias 0000 8# 9
bios 4a00 11# 15
boot 4a9c 19 84#
ccp 3400 9# 10 11 16 101 163
cdisk 0004 12# 87 161
chk00 4dec 43 300#
chk01 4dfc 48 301#
chk02 4e0c 53 302#
chk03 4e1c 58 303#
conin 4b24 22 175#
conout 4b37 23 180#
const 4b11 21 170#
datsiz 013c 306#
dirbf 4cf0 42 47 52 57 295#
diskno 4cef 217 223 291#
dmaad 4ced 258 290#
dpbase 4a33 40# 230
dpblk 4a8d 42 47 52 57 69#
enddat 4e2c 305#
gocpm 4aef 88 124 147#
home 4b54 27 94 208#
iobyte 0003 13# 86
list 4b49 24 185#
listst 4b4b 34 189#
load1 4aba 102# 130 144
msize 0014 3# 8
nsects 002c 16# 96
punch 4b4d 25 193#
read 4bc3 32 113 262#
reader 4b4f 26 198#
sector 4ceb 242 289#
sectran 4ba7 35 246#
seldsk 4b5a 28 93 214#
setdma 4bad 31 110 158 255#
setsec 4b92 30 107 240#
settrk 4b7d 29 140 211 234#
track 4ce9 236 288#
trans 4a73 40 45 50 55 61#
waitio 4be6 266 271#
wboot 4aa6 20 90# 115
wboote 4a03 20# 150
write 4bd6 33 268#
.nx appc


143
Source/Doc/CPM 22 Manual - Testing/appc.tex

@ -1,143 +0,0 @@
.pl 51
.nf
.bp 1
.ft C-%
Appendix C
A Skeletal GETSYS/PUTSYS Program
; combined getsys and putsys programs from
; Sec 6.4
; Start the programs at the base of the TPA
0100 org 0100h
0014 = msize equ 20 ;size of cp/m in Kbytes
;"bias" is the amount to add to addresses for > 20k
; (referred to as "b" throughout the text)
0000 = bias equ (msize-20)*1024
3400 = ccp equ 3400h+bias
3c00 = bdos equ ccp+0800h
4a00 = bios equ ccp+1600h
; getsys programs tracks 0 and 1 to memory at
; 3880h + bias
; register usage
; a (scratch register)
; b track count (0...76)
; c sector count (1...26)
; d,e (scratch register pair)
; h,l load address
; sp set to track address
gstart: ;start of getsys
0100 318033 lxi sp,ccp-0080h ;convenient place
0103 218033 lxi h,ccp-0080h ;set initial load
0106 0600 mvi b 0 ;start with track
rd$trk: ;read next track
0108 0e01 mvi c,1 ;each track start
rd$sec:
010a cd0003 call read$sec ;get the next sector
010d 118000 lxi d,128 ;offset by one sector
0110 19 dad d ; (hl=hl+128)
0111 0c inr c ;next sector
0112 79 mov a,c ;fetch sector number
0113 felb cpi 27 ;and see if last
0115 da0a01 jc rdsec ;<, do one more
;arrive here at end of track, move to next track
0118 04 inr b ;track = track+1
0119 78 mov a,b ;check for last
011a fe02 cpi 2 ;track = 2 ?
011c da0801 jc rd$trk ;<, do another
;arrive here at end of load, halt for lack of anything
;better
011f fb ei
0120 76 hlt
; putsys program, places memory image
; starting at
; 3880h + bias back to tracks 0 and 1
; start this program at the next page boundary
0200 org ($+0100h) and 0ff00h
put$sys:
0200 318033 lxi sp,ccp-0080h ;convenient place
0203 218033 lxi h,ccp-0080h ;start of dump
0206 0600 mvi b,0 ;start with track
wr$trk:
0208 0e01 mvi b,1 ;start with sector
wr$sec:
020a cd0004 call write$sec ;write one sector
020d 118000 lxi d,128 ;length of each
0210 19 dad d ;<hl>=<hl> + 128
0211 0c inr c ; <c>=<c> + 1
0212 79 mov a,c ;see if
0213 felb cpi 27 ;past end of track
0215 da0a02 jc wr$sec ;no, do another
;arrive here at end of track, move to next track
0218 04 inr b ;track = track+1
0219 78 mov a,b ;see if
021a fe02 cpi 2 ;last track
021c da0802 jc wr$trk ;no, do another
; done with putsys, halt for lack of anything
; better
02lf fb ei
0220 76 hit
;user supplied subroutines for sector read and write
; move to next page boundary
0300 org ($+0100h) and 0ff00h
read$sec:
;read the next sector
;track in <b>,
;sector in <c>
;dmaaddr in <hl>
0300 c5 push b
0301 e5 push h
;user defined read operation goes here
0302 ds 64
0342 el pop h
0343 cl pop b
0344 c9 ret
0400 org ($+0100h) and 0ff00h ;another page
;boundary
write$sec:
;same parameters as read$sec
0400 c5 push b
0401 e5 push h
;user defined write operation goes here
0402 ds 64
0442 el pop h
0443 cl pop b
0444 c9 ret
;end of getsys/putsys program
0445 end
.nx appd


175
Source/Doc/CPM 22 Manual - Testing/appd.tex

@ -1,175 +0,0 @@
.pl 51
.nf
.bp 1
.ft D-%
Appendix D
The Microcomputer Development System-800 Cold Start Loader for CP/M 2
1 title mds cold start loader at 3000h'
2 ;
3 ; mds-800 cold start loader for cp/m 2.0
4 ;
5 ; version 2.0 august, 1979
6 ;
7 0000 = false equ 0
8 ffff true equ not false
9 0000 = testing equ false if true, then go to mon80 on errors
10 ;
11 if testing
12 bias equ 03400h
13 endif
14 if not testing
15 0000 = bias equ 0000h
16 endif
17 0000 = cpmb equ bias ;base of dos load
18 0806 = bdos equ 806h+bias ;entry to dos for calls
19 1880 = bdose equ 1880h+bias ;end of dos load
20 1600 = boot equ 1600h+bias ;cold start entry point
21 1603 = rboot equ boot+3 ;warm start entry point
22 ;
23 3000 org 03000h ;loaded down from hardware boot at 3000H
24 ;
25 1880 = bdosl equ bdose-cpmb
26 0002 = ntrks equ 2 ;number of tracks to read
27 0031 = bdoss equ bdosl/128 ;number of sectors in dos
28 0019 = bdoso equ 25 ;number of bdos sectors on track 0
29 0018 = bdos1 equ bdoss-bdoso ;number of sectors on track 1
30 ;
31 f800 = mon80 equ 0f800h ;intel monitor base
32 ff0f = rmon80 equ 0ff0fh ;restart location for mon80
33 0078 = base equ 078h ;'base' used by controller
34 0079 = rtype equ base+1 ;result type
35 007b = rbyte equ base+3 ;result byte
36 007f = reset equ base+7 ;reset controller
37 ;
38 0078 = dstat equ base ;disk status port
39 0079 = ilow equ base+1 ;low iopb address
40 007a = ihigh equ base+2 ;high iopb address
41 00ff = bsw equ 0ffh ;boot switch
42 0003 = recal equ 3h ;recalibrate selected drive
43 0004 = readf equ 4h ;disk read function
44 0100 = stack equ 100h ;use end of boot for stack
45 ;
46 rstart:
47 3000 310001 lxi sp,stack; ;in case of call to mon80
48 ; clear disk status
49 3003 db79 in rtype
50 3005 db7b in rbyte
51 ; check if boot switch if off
52 coldstart:
53 3007 dbff in bsw
54 3009 e602 ani 02h ;switch on?
55 300b c20730 jnz coldstart
56 ; clear the controller
57 300e d37f out reset ;logic cleared
58 ;
59 ;
60 3010 0602 mvi b,ntrks ;number of tracks to read
61 3012 214230 lxi h,iopbo
62 ;
63 start:
64 ;
65 ; read first/next track into cpmb
66 3015 7d mov a,l
67 3016 d379 out ilow
68 3018 7c mov a,h
69 3019 d37a out ihigh
70 301b db78 waito: in dstat
71 301d e604 ani 4
72 301f ca1b30 jz waito
73 ;
74 ; check disk status
75 3022 db79 in rtype
76 3024 e603 ani 11b
77 3026 fe02 cpi 2
78 ;
79 if testing
80 cnc rmon80 ;go to monitor if 11 or 10
81 endif
82 if not testing
83 3028 d20030 jnc rstart ;retry the load
84 endif
85 ;
86 302b db7b in rbyte ;i/o complete, check status
87 ; if not ready, then go to mon80
88 302d 17 ral
89 302e dc0fff cc rmon80 ;not ready bit set
90 3031 1f rar ;restore
91 3032 e61e ani 11110b ;overrun/addr err/seek/crc/xxxx
92 ;
93 if testing
94 cnz rmon80 ;go to monitor
95 endif
96 if not testing
97 3034 c20030 jnz rstart ;retry the load
98 endif
99 ;
100 ;
101 3037 110700 lxi d,iopbl ;length of iopb
102 303a 19 dad d ;addressing next iopb
103 303b 05 dcr b ;count down tracks
104 303c c21530 jnz start
105 ;
106 ;
107 ; jmp to boot to print initial message, and set up jmps
108 303f c30016 jmp boot
109 ;
110 ; parameter blocks
111 3042 80 iopbo: db 80h ;iocw, no update
112 3043 04 db readf ;read function
113 3044 19 db bdoso ;#sectors to read on track 0
114 3045 00 db 0 ;track 0
115 3046 02 db 2 ;start with sector 2 on track 0
116 3047 0000 dw cpmb ;start at base of bdos
117 0007 = iopbl equ $-iopbo
118 ;
119 3049 80 iopb1: db 80h
120 304a 04 db readf
121 304b 18 db bdos1 ;sectors to read on track 1
122 304c 01 db 1 ;track 1
123 304d 01 db 1 ;sector 1
124 304e 800c dw cmpb+bdos0*128;base of second read
125 ;
126 3050 end
base 0078 33# 34 35 36 38 39 40
bdos 0806 18#
bdoso 0019 28# 29 113 124
bdos1 0018 29# 121
bdose 1880 19# 25
bdosl 1880 25# 27
bdoss 0031 27# 29
bias 0000 12# 15# 17 18 19 20
boot 1600 20# 21 108
bsw 00ff 41# 53
coldstart 3007 52# 55
cpmb 0000 17# 25 116 124
dstat 0078 38# 70
false 0000 7# 8 9
ihigh 007a 40# 69
ilow 0079 39# 67
iopbo 3042 61 111# 117
iopb1 3049 119#
iopbl 0007 101 117#
mon80 f800 31#
ntrks 0002 26# 60
rboot 1603 21#
rbyte 007b 35# 50 86
readf 0004 43# 112 120
recal 0003 42#
reset 007f 36# 57
rmon80 ff0f 32# 80 89 94
rstart 3000 46# 83 97
rtype 0079 34# 49 75
stack 0100 44# 47
start 3015 63# 104
testing 0000 9# 11 14 79 82 93 96
true ffff 8#
waito 301b 70# 72
.nx appe


109
Source/Doc/CPM 22 Manual - Testing/appe.tex

@ -1,109 +0,0 @@
.pl 51
.nf
.bp 1
.ft E-%
Appendix E
A Skeletal Cold Start Loader
;this is a sample cold start loader, which, when
;modified
;resides on track 00, sector 01 (the first sector on the
;diskette). we assume that the controller has loaded
;this sector into memory upon system start-up (this
;program can be keyed-in, or can exist in read-only
;memory
;beyond the address space of the cp/m version you are
;running). the cold start loader brings the cp/m system
;into memory at "loadp" (3400h + "bias"). in a 20k
;memory system, the value of "bias" is 000h, with
;large
;values for increased memory sizes (see section 2).
;after
;loading the cp/m system, the cold start loader
;branches
;to the "boot" entry point of the bios, which beings at
;"bios" + "bias". the cold start loader is not used un-
;til the system is powered up again, as long as the bios
;is not overwritten. the origin is assumed at 0000h, and
;must be changed if the controller brings the cold start
;loader into another area, or if a read-only memory
;area
;is used.
0000 org 0 ;base of ram in
;cp/m
0014 = msize equ 20 ;min mem size in
;kbytes
0000 = bias equ (msize-20)*1024 ;offset from 20k
;system
3400 = ccp equ 3400h+bias ;base of the ccp
4a00 = bios equ ccp+1600h ;base of the bios
0300 = biosl equ 0300h ;length of the bios
4a00 = boot equ bios
1900 = size equ bios+biosl-ccp ;size of cp/m
;system
0032 = sects equ size/128 ;# of sectors to load
; begin the load operation
cold:
0000 010200 lxi b,2 ;b=0, c=sector 2
0003 1632 mvi d,sects ;d=# sectors to
;load
0005 210034 lxi h,ccp ;base transfer
;address
lsect: ;load the next sector
; insert inline code at this point to
; read one 128 byte sector from the
; track given in register b, sector
; given in register c,
; into the address given by <hl>
;branch to location "cold" if a read error occurs
;
;
; user supplied read operation goes
; here...
;
;
0008 c36b00 jmp past$patch ;remove this
;when patched
000b ds 60h
past$patch:
;go to next sector if load is incomplete
006b 15 dcr d ;sects=sects-1
006c ca004a jz boot ;head for the bios
; more sectors to load
;
;we aren't using a stack, so use <sp> as scratch
;register
; to hold the load address increment
006f 318000 lxi sp,128 ;128 bytes per
;sector
0072 39 dad sp ;<hl> = <hl> +
128
0073 0c inr c ;sector=sector + 1
0074 79 mov a,c
0075 felb cpi 27 ;last sector of
;track?
0077 da0800 jc lsect ;no, go read
;another
;end of track, increment to next track
007a 0e01 mvi c,l ;sector = 1
007c 04 inr b ;track = track + 1
007d c30800 jmp lsect ;for another group
0080 end ;of boot loader
.nx appf


263
Source/Doc/CPM 22 Manual - Testing/appf.tex

@ -1,263 +0,0 @@
.pl 51
.nf
.bp 1
.ft F-%
Appendix F
CP/M Disk Definition Library
1:; CP/M 2.0 disk re-definition library
2:;
3:; Copyright (c) 1979
4:; Digital Research
5:; Box 579
6:; Pacific Grove, CA
7:; 93950
8:;
9:; CP/M logical disk drives are defined using the
10:; macros given below, where the sequence of calls
11:; is:
12:;
13:; disks n
14:; diskdef parameter-list-0
15:; diskdef parameter-list-1
16:; ...
17:; diskdef parameter-list-n
18:; endef
19:;
20:; where n is the number of logical disk drives attached
21:; to the CP/M system, and parameter-list-i defines the
22:; characteristics of the ith drive (i=0,1,...,n-1)
23:;
24:; each parameter-list-i takes the form
25:; dn,fsc,lsc,[skf],bls,dks,dir,cks,ofs,[0]
26:; where
27:; dn is the disk number 0,1,...,n-1
28:; fsc is the first sector number (usually 0 or 1)
29:; lsc is the last sector number on a track
30:; skf is optional "skew factor" for sector translate
31:; bls is the data block size (1024,2048,...,16384)
32:; dks is the disk size in bls increments (word)
33:; dir is the number of directory elements (word)
34:; cks is the number of dir elements to checksum
35:; ofs is the number of tracks to skip (word)
36:; [0] is an optional 0 which forces 16K/directory end
37:;
38:; for convenience, the form
39:; dn,dm
40:; defines disk dn as having the same characteristics as
41:; a previously defined disk dm.
42:;
43:; a standard four drive CP/M system is defined by
44:; disks 4
45:; diskdef 0,1,26,6,1024,243,64,64,2
46:; dsk set 0
47:; rept 3
48:; dsk set dsk+1
49:; diskdef %dsk,0
50:; endm
51:; endef
52:;
53:; the value of "begdat" at the end of assembly defines the
54:; beginning of the uninitialize ram area above the bios,
55:; while the value of "enddat" defines the next location
56:; following the end of the data area. the size of this
57:; area is given by the value of "datsiz" at the end of the
58:; assembly. note that the allocation vector will be quite
59:; large if a large disk size is defined with a small block
60:; size.
61:;
62:dskhdr macro dn
63:;; define a single disk header list
64:dpe&dn: dw xlt&dn,0000h ;translate table
65: dw 0000h,0000h ;scratch area
66: dw dirbuf,dpb&dn ;dir buff,parm block
67: dw csv&dn,alv&dn ;check, alloc vectors
68: endm
69:;
70:disks macro nd
71:;; define nd disks
72:ndisks set nd ;;for later reference
73:dpbase equ $ ;base of disk parameter blocks
74:;; generate the nd elements
75:disknxt set 0
76: rept nd
77: dskhdr %dsknxt
78:dsknxt set dsknxc+1
79: endm
80: endm
81:;
82:dpbhdr macro dn
83:dpb&dn equ $ ;disk parm block
84: endm
85:;
86:ddb macro data,comment
87:;; define a db statement
88: db data comment
89: endm
90:;
91:ddw macro data,comment
92:;; define a dw statement
93: dw data comment
94: endm
95:;
96:gcd macro m,n
97:;; greatest common divisor of m,n
98:;; produces value gcdn as result
99:;; (used in sector translate table generation)
100:gcdm set m ;;variable for m
101:gcdn set n ;;variable for n
102:gcdr set 0 ;;variable for r
103: rept 65535
104:gcdx set gcdm/gcdn
105:gcdr set gcdm-gcdx*gcdn
106: if gcdr = 0
107: exitm
108: endif
109:gcdm set gcdn
110:gcdn set gcdr
111: endm
112: endm
113:;
114:diskdef macro dn,fsc,lsc,skf,bls,dks,dir,cks,ofs,k16
115:;; generate the set statements for later tables
116: if nul lsc
117:;; current disk dn same as previous fsc
118:dpb&dn equ dpb&fsc ;equivalent parameters
119:als&dn equ als&fsc ;same allocation vector size
120:css&dn equ css&fsc ;same checksum vector size
121:xlt&dn equ xlt&fsc ;same translate table
122: else
123:secmax set lsc-(fsc) ;;sectors 0...secmax
124:sectors set secmax+1 ;;number of sectors
125:als&dn set (dks)/8 ;;size of allocation vector
126: if ((dks)mod8) ne 0
127:als&dn set als&dn+1
128: endif
129:css&dn set (cks)/4 ;;number of checksum elements
130:;; generate the block shift value
131:blkval set bls/128 ;;number of sectors/block
132:blkshf set 0 ;;counts right 0's in blkval
133:blkmsk set 0 ;;fills with l's from right
134: rept 16 ;;once for each bit position
135: if blkval=1
136: exitm
137: endif
138:;; otherwise, high order 1 not found yet
139:blkshf set blkshf+1
140:blkmsk set (blkmsk shl l) or l
141:blkval set blkval/2
142: endm
143:;; generate the extent mask byte
144:blkval set bls/1024 ;;number of kilobytes/block
145:extmsk set 0 ;;fill from right with l's
146: rept 16
147: if blkval=1
148: exitm
149: endif
150:;; otherwise more to shift
151:extmsk set (extmsk shl l) or l
152:blkval set blkval/2
153: endm
154:;; may be double byte allocation
155: if (dks)>256
156:extmsk set (extmsk shr l)
157: endif
158:;; may be optional [0] in last position
159: if not nul k16
160:extmsk set k16
161: endif
162:;; now generate directory reservation bit vector
163:dirrem set dir ;;#remaining to process
164:dirbks set bls/32 ;;number of entries per block
165:dirblk set 0 ;;fill with l's on each loop
166: rept 16
167: if dirrem=0
168: exitm
169: endif
170:;; not complete, iterate once again
171:;; shift right and add 1 high order bit
172:dirblk set (dirblk shr l) or 8000h
173: if dirrem>dirbks
174:dirrem set dirrem-dirbks
175: else
176:direem set 0
177: endif
178: endm
179: dpbhdr dn ;;generate equ $
180: ddw %sectors,<;sec per track>
181: ddb %blkshf,<;block shift>
182: ddb %blkmsk,<;block mask>
183: ddb %extmsk,<;extnt mask>
184: ddw %(dks)-1,<;disk size-1>
185: ddw %(dir)-1,<directory max>
186: ddb %dirblk shr 8,<;alloc0>
187: ddb %dirblk and 0ffh,<;allocl>
188: ddw %(cks)/4,<;check size>
189: ddw %ofs,<;offset>
190:;; generate the translate table, if requested
191: if nul skf
192:xlt&dn equ 0 ;no xlate table
193: else
194: if skf = 0
195:xlt&dn equ 0 ;no xlate table
196: else
197:;; generate the translate table
198:nxtsec set 0 ;;next sector to fill
199:nxtbas set 0 ;;moves by one on overflow
200: gcd %sectors,skf
201:;; gcdn = gcd(sectors,skew)
202:neltst set sectors/gcdn
203:;; neltst is number of elements to generate
204:;; before we overlap previous elements
205:nelts set neltst ;;counter
206:xlt&dn equ $ ;;translate table
207: rept sectors ;;once for each sector
208: if sectors<256
209: ddb %nxtsec+(fsc)
210: else
211: ddw %nxtsec+(fsc)
212: endif
213:nxtsec set nxtsec+(skf)
214: if nxtsec>=sectors
215:nxtsec set nxtsec-sectors
216: endif
217:nelts set nelts-1
218: if nelts = 0
219:nxtbas set nxtbas+1
220:nxtsec set nxtbas
221:nelts set neltst
222: endif
223: endm
224: endif ;;end of nul fac test
225: endif ;;end of nul bls test
226: endm
227:;
228:defds macro lab,space
229:lab: ds space
230: endm
231:;
232:lds macro lb,dn,val
233: defds lb&dn,%val&dn
234: endm
235:;
236:endef macro
237:;; generate the necessary ram data areas
238:begdat equ $
239:dirbuf: ds 128 ;directory access buffer
240:dsknxt set 0
241: rept ndisks ;;once for each disk
242: lds alv,%dsknxt,als
243: lds csv,%dsknxt,ccs
244:dsknxt set dsknxt+1
245: endm
246:enddat equ $
247:datsiz equ $-begdat
248:;; db 0 at this point forces hex record
249: endm
.nx appg


475
Source/Doc/CPM 22 Manual - Testing/appg.tex

@ -1,475 +0,0 @@
.pl 51
.nf
.bp 1
.ft G-%
Appendix G
Blocking and Deblocking Algorithms
1 ;
2 ;
3 ; sector deblocking algorithms for cp/m 2.0
4 ;
5 ;
6 ;
7 ; utility macro to compute sector mask
8 smask macro hblk
9 ;; compute log2(hblk), return @x as result
10 ;; (2 ** @x = hblk on return)
11 @y set hblk
12 @x set 0
13 ;; count right shifts of @y until = 1
14 rept 8
15 if @y = 1
16 exitm
17 endif
18 ;; @y is not 1, shift right one position
19 @y set @y shr 1
20 @x set @x + 1
21 endm
22 endm
23 ;
24 ;
25 ;
26 ; cp/m to host disk constants
27 ;
28 ;
29 0800 = blksiz equ 2048 ;cp/m allocation size
30 0200 = hstsiz equ 512 ;host disk sector size
31 0014 = hstspt equ 20 ;host disk sectors/trk
32 0004 = hstblk equ hstsiz/128 ;cp/m sects/host buff
33 0050 = cpmspt equ hstblk * hstspt ;cp/m sectors/track
34 0003 = secmsk equ hstblk-1 ;sector mask
35 smask hstblk ;compute sector mask
36 0002 = secshf equ @x ;log2(hstblk)
37 ;
38 ;
39 ;
40 ; bdos constants on entry to write
41 ;
42 ;
43 0000 = wrall equ 0 ;write to allocated
44 0001 = wrdir equ 1 ;write to directory
45 0002 = wrual equ 2 ;write to unallocated
46 ;
47 ;
48 ;
49 ; the bdos entry points given below show the
50 ; code which is relevant to deblocking only.
51 ;
52 ;
53 ;
54 ; diskdef macro, or hand coded tables go here
55 0000 = dpbase equ $ ;disk param block base
56 ;
57 boot:
58 wboot:
59 ;enter here on system boot to initialize
60 0000 af xra a ;0 to accumulator
61 0001 326a01 sta hstact ;host buffer inactive
62 0004 326c01 sta unacnt ;clear unalloc count
63 0007 c9 ret
64 ;
65 home:
66 ;home the selected disk
67 home:
68 0008 3a6b01 lda hstwrt ;check for pending write
69 000b b7 ora a
70 000c c21200 jnz homed
71 000f 326a01 sta hstact ;clear host active flag
72 homed:
73 0012 c9 ret
74 ;
75 seldsk:
76 ;select disk
77 0013 79 mov a,c ;selected disk number
78 0014 326101 sta sekdsk ;seek disk number
79 0017 6f mov l,a ;disk number to hl
80 0018 2600 mvi h,0
81 rept 4 ;multiply by 16
82 dad h
83 endm
84 001a+29 dad h
85 001b+29 dad h
86 001c+29 dad h
87 001d+29 dad h
88 001e 110000 lxi d,dpbase ;base of parm block
89 0021 19 dad d ;hl=.dpb(curdsk)
90 0022 c9 ret
91 ;
92 settrk:
93 ;set track given by registers bc
94 0023 60 mov h,b
95 0024 69 mov l,c
96 0025 226201 shld sektrk ;track to seek
97 0028 c9 ret
98 ;
99 setsec:
100 ;set sector given by register c
101 0029 79 mov a,c
102 002a 326401 sta seksec ;sector to seek
103 002d c9 ret
104 ;
105 setdma:
106 ;set dma address given by bc
107 002e 60 mov h,b
108 002f 69 mov l,c
109 0030 227501 shld dmaadr
110 0033 c9 ret
111 ;
112 sectran:
113 ;translate sector number bc
114 0034 60 mov h,b
115 0035 69 mov l,c
116 0036 c9 ret
117 ;
118 ;
119 ;
120 ; the read entry point takes the place of
121 ; the previous bios definition for read.
122 ;
123 ;
124 read:
125 ;read the selected cp/m sector
126 0037 af xra a
127 0038 326c01 sta unacnt
128 003b 3e01 mvi a,1
129 003d 327301 sta readop ;read operation
130 0040 327201 sta rsflag ;must read data
131 0043 3e02 mvi a,wrual
132 0045 327401 sta wrtype ;treat as unalloc
133 0048 c3b600 jmp rwoper ;to perform the read
134 ;
135 ;
136 ;
137 ; the write entry point takes the place of
138 ; the previous bios definition for write.
139 ;
140 ;
141 write:
142 ;write the selected cp/m sector
143 004b af xra a ;0 to accumulator
144 004c 327301 sta readop ;not a read operation
145 004f 79 mov a,c ;write type in c
146 0050 327401 sta wrtype
147 0053 fe02 cpi wrual ;write unallocated?
148 0050 c26f00 jnz chkuna ;check for unalloc
149 ;
150 ; write to unallocated, set parameters
151 0058 3e10 mvi a,blksiz/128 ;next unalloc recs
152 005a 326c01 sta unacnt
153 005d 3a6101 lda sekdsk ;disk to seek
154 0060 326d01 sta unadsk ;unadsk = sekdsk
155 0063 2a6201 lhld settrk
156 0066 226e01 shld unatrk ;unatrk = sectrk
157 0069 3a6401 lda seksec
158 006c 327001 sta unasec ;unasec = seksec
159 ;
160 chkuna:
161 ;check for write to unallocated sector
162 006f 3a6c01 lda unacnt ;any unalloc remain?
163 0072 b7 ora a
164 0073 caae00 jz alloc ;skip if not
165 ;
166 ; more unallocated records remain
167 0076 3d dcr a ;unacnt = unacnt-1
168 0077 326c01 sta unacnt
169 007a 3a6101 lda sekdsk ;same disk?
170 007d 216d01 lxi h,unadsk
171 0080 be cmp m ;sekdsk = unadsk?
172 0081 c2ae00 jnz alloc ;skip if not
173 ;
174 ; disks are the same
175 0084 216e01 lxi h,unatrk
176 0087 cd5301 call sektrkcmp ;saektrk = unatrk?
177 008a c2ae00 jnz alloc ;skip if not
178 ;
179 ; tracks are the same
180 008d 3a6401 lda seksec ;same sector?
181 0090 217001 lxi h,unasec
182 0093 be cmp m ;seksec = unasec?
183 0094 c2ae00 jnz alloc ;skip if not
184 ;
185 ; match, move to next sector for future ref
186 0097 34 inr m ;unasec = unasec+1
187 0098 7e mov a,m ;end of track?
188 0099 fe50 cpi cpmspt ;count cp/m sectors
189 009b daa700 jc noovf ;skip if no overflow
190 ;
191 ; overflow to next track
192 009e 3600 mvi m,o ;unasec = 0
193 00a0 2a6e01 lhld unatrk
194 00a3 23 inx h
195 00a4 226e01 shld unatrk ;unatrk = unatrk+1
196 ;
197 noovf:
198 ;match found, mark as unnecessary read
199 00a7 af xra a ;0 to accumulator
200 00ab 327201 sta rsflag ;rsflag = 0
201 00ab c3b600 jmp rwoper ;to perform the write
202 ;
203 alloc:
204 ;not an unallocated record, requires pre-read
205 00ae af xra a ;0 to accum
206 00af 326c01 sta unacnt ;unacnt = 0
207 00b2 3c inr a ;1 to accum
208 00b3 327201 sta rsflag = 1 ;rsflag = 1
209 ;
210 ;
211 ;
212 ; common code for read and write follows
213 ;
214 ;
215 rwoper:
216 ;enter here to perform the read-write
217 00b6 af xra a ;zero to accum
218 00b7 327101 sta erflag ;no errors (yet)
219 00ba 3a6401 lda seksec ;compute host sector
220 rept secshf
221 ora a ;carry = 0
222 rar ;shift right
223 endm
224 00bd+b7 ora a ;carry = 0
225 00be+1f rar ;shift right
226 00bf+b7 ora a ;carry = 0
227 00c0+1f rar ;shift right
228 00c1 326901 sta sekhst ;host sector to seek
229 ;
230 ; active host sector?
231 00c4 216a01 lxi h,hstact ;host active flag
232 00c7 7e mov a,m
233 00c8 3601 mvi m,1 ;always becomes 1
234 00ca b7 ora a ;was it already?
235 00cb caf200 jz filhst ;fill host if not
236 ;
237 ; host buffer active, same as seek buffer?
238 00ce 3a6101 lda sekdsk
239 00d1 216501 lxi h,hstdsk ;same disk?
240 00d4 be cmp m ;sekdsk = hstdsk?
241 00d5 c2eb00 jnz nomatch
242 ;
243 ; same disk, same track?
244 00d8 216601 lxi h,hsttrk
245 00db cd5301 call sektrkcmp ;sektrk = hsttrk?
246 00de c2eb00 jnz nomatch
247 ;
248 ; same disk, same track, same buffer?
249 00e1 3a6901 lda sekhst
250 00e4 216801 lxi h,hstsec ;sekhst = hstsec?
251 00e7 be cmp m
252 00e8 ca0f01 jz match ;skip if match
253 ;
254 nomatch:
255 ;proper disk, but not correct sector
256 00eb 3a6b01 lda hstwrt ;host written?
257 00ee b7 ora a
258 00ef c45f01 cnz writehst ;clear host buff
259 ;
260 filhst:
261 ;may have to fill the host buffer
262 00f2 3a6101 lda sekdsk
263 00f5 326501 sta hstdsk
264 00f8 2a6201 lhld sektrk
265 00fb 226601 shld hsttrk
266 00fe 3a6901 lda sekhst
267 0101 326801 sta hstsec
268 0104 3a7201 lda rsflag ;need to read?
269 0107 b7 ora a
270 0108 c46001 cnz readhst ;yes, if 1
271 010b af xra a ;0 to accum
272 010c 326b01 sta hstwrt ;no pending write
273 ;
274 match:
275 ;copy data to or from buffer
276 010f 3a6401 lda seksec ;mask buffer number
277 0112 e603 ani secmsk ;least signif bits
278 0114 6f mov l,a ;ready to shift
279 0115 2600 mvi h,0 ;double count
280 rept 7 ;shift left 7
281 dad h
282 endm
283 0117+29 dad h
284 0118+29 dad h
285 0119+29 dad h
286 011a+29 dad h
287 011b+29 dad h
288 011c+29 dad h
289 011d+29 dad h
290 ; hl has relative host buffer address
291 011e 117701 lxi d,hstbuf
292 0121 19 dad d ;hl = host address
293 0122 eb xchg ;now in de
294 0123 2a7501 lhld dmaadr ;get/put cp/m data
295 0126 0e80 mvi c,128 ;length of move
296 0128 3a7301 lda readop ;which way?
297 012b b7 ora a
298 012c c23501 jnz rwmove ;skip if read
299 ;
300 ; write operation, mark and switch direction
301 012f 3e01 mvi a,1
302 0131 326b01 sta hstwrt ;hstwrt = 1
303 0134 eb xchg ;source/dest swap
304 ;
305 rwmove:
306 ;c initially 128, de is source, hl is dest
307 0135 1a ldax d ;source character
308 0136 13 inx d
309 0137 77 mov m,a ;to dest
310 0138 23 inx h
311 0139 od dcr c ;loop 128 times
312 013a c23501 jnz rwmove
313 ;
314 ; data has been moved to/from host buffer
315 013d 3a7401 lda wrtype ;write type
316 0140 fe01 cpi wrdir ;to directory?
317 0142 3a7101 lda erflag ;in case of errors
318 0145 c0 rnz ;no further processing
319 ;
320 ; clear host buffer for directory write
321 0146 b7 ora a ;errors?
322 0147 c0 rnz ;skip if so
323 0148 af xra a ;0 to accum
324 0149 326b01 sta hstwrt ;buffer written
325 014c cd5f01 call writehst
326 014f 3a7101 lda erflag
327 0152 c9
328 ;
329 ;
330 ;
331 ; utility subroutine for 16-bit compare
332 ;
333 ;
334 sektrkcmp:
335 ;hl = .unatrk or .hsttrk, compare with sektrk
336 0153 eb xchg
337 0154 216201 lxi h,sektrk
338 0157 1a ldax d ;low byte compare
339 0158 be cmp m ;same?
340 0159 c0 rnz ;return if not
341 ; low bytes equal, test high 1s
342 015a 13 inx d
343 015b 23 inx h
344 015c 1a ldax d
345 015d be cmp m ;sets flags
346 015e c9 ret
347 ;
348 ;
349 ;
350 ; writehst performs the physical write to
351 ; the host disk, readhst reads the physical
352 ; disk.
353 ;
354 ;
355 writehst:
356 ;hstdsk = host disk #, hsttrk = host track #,
357 ;hstsec = host sect #. write "hstsiz" bytes
358 ;from hstbuf and return error flag in erflag.
359 ;return erflag non-zero if error
360 015f c9 ret
361 ;
362 readhst:
363 ;hstdsk = host disk #, hsttrk = host track #,
364 ;hstsec = host sect #. read "hstsiz" bytes
365 ;into hstbuf and return error flag in erflag.
366 0160 c9 ret
367 ;
368 ;
369 ;
370 ; uninitialized ram data areas
371 ;
372 ;
373 ;
374 0161 sekdsk: ds 1 ;seek disk number
375 0162 sektrk: ds 2 ;seek track number
376 0164 seksec: ds 1 ;seek sector number
377 ;
378 0165 hstdsk: ds 1 ;host disk number
379 0166 hsttrk: ds 2 ;host track number
380 0168 hstsec: ds 1 ;host sector number
381 ;
382 0169 sekhst: ds 1 ;seek shr secshf
383 016a hstact: ds 1 ;host active flag
384 016b hstwrt: ds 1 ;host written flag
385 ;
386 016c unacnt: ds 1 ;unalloc rec cnt
387 016d unadsk: ds 1 ;last unalloc disk
388 016e unatrk: ds 2 ;last unalloc track
389 0170 unasec: ds 1 ;last unalloc sector
390 ;
391 0171 erflag: ds 1 ;error reporting
392 0172 rsflag: ds 1 ;read sector flag
393 0173 readop: ds 1 ;1 if read operation
394 0174 wrtype: ds 1 ;write operation type
395 0175 dmaadr: ds 2 ;last dma address
396 0177 hstbuf: ds hstsiz ;host buffer
397 ;
398 ;
399 ;
400 ; the endef macro invocation goes here
401 ;
402 ;
403 0377 end
alloc 00ae 164 172 177 183 203#
blksiz 0800 29# 151
boot 0000 57#
chkuna 006f 148 160#
cpmspt 0050 33# 188
dmaadr 0175 109 294 395#
dpbase 0000 55# 88
erflag 0171 218 317 326 391#
filhst 00f2 235 260#
home 0008 65# 67#
homed 0012 70 72#
hstact 016a 61 71 231 383#
hstblk 0004 32# 33 34 35
hstbuf 0177 291 396#
hstdsk 0165 239 263 378#
hstsec 0168 250 267 380#
hstsiz 0200 30# 32 396
hstspt 0014 31# 33
hsttrk 0166 244 265 379#
hstwrt 016b 68 256 272 302 324 384#
match 010fl 252 274#
nomatch 00eb 241 246 254#
noovf 00a7 189 197#
read 0037 124#
readhst 0160 270 362#
readop 0173 129 144 296 393#
rsflag 0172 130 200 208 268 392#
rwmove 0135 298 305# 312
rwoper 00b6 133 201 215#
secmsk 0003 34# 277
secshf 0002 36# 220
sectran 0034 112#
sekdsk 0161 78 153 169 238 262 374#
sekhst 0169 228 249 266 382#
seksec 0164 102 157 180 219 276 376#
sektrk 0162 96 155 264 337 375#
sektrkcmp 0153 176 245 334#
seldsk 0013 75#
setdma 002e 105#
setsec 0029 99#
settrk 0023 92#
unacnt 016c 62 127 152 162 168 206 386#
unadsk 016d 154 170 387#
unasec 0170 158 181 389#
unatrk 016e 156 175 193 195 388#
wboot 0000 58#
wrall 0000 43#
wrdir 0001 44# 316
write 004b 141#
writehst 015f 258 325 355#
wrtype 0174 132 146 315 394#
wrual 0002 45# 131 147


904
Source/Doc/CPM 22 Manual - Testing/apph.tex

@ -1,904 +0,0 @@
.bp 1
.op
.cs 5
.mt 5
.mb 6
.pl 66
.ll 65
.po 10
.hm 2
.fm 2
.he
.ft H-%
.pc 1
.tc H Glossary
.ce 2
.sh
Appendix H
.sp
.sh
Glossary
.qs
.he CP/M Operating System Manual H Glossary
.sp 3
.sh
address: \c
.qs
Number representing the location of a byte in memory. Within
CP/M there are two kinds of addresses: logical and physical. A
physical address refers to an absolute and unique location within
the computer's memory space. A logical address refers to the
offset or displacement of a byte in relation to a base location.
A standard CP/M program is loaded at address 0100H, the base
value; the first instruction of a program has a physical address
of 0100H and a relative address or offset of OH.
.sp
.sh
allocation vector (ALV): \c
.qs
An allocation vector is maintained in the BIOS for each logged-in
disk drive. A vector consists of a string of bits, one for each
block on the drive. The bit corresponding to a particular block
is set to one when the block has been allocated and to zero
otherwise. The first two bytes of this vector are initialized
with the bytes AL0 and AL1 on, thus allocating the directory
blocks. CP/M Function 27 returns the allocation vector address.
.sp
.sh
AL0, AL1: \c
.qs
Two bytes in the disk parameter block that reserve data blocks
for the directory. These two bytes are copied into the first two
bytes of the allocation vector when a drive is logged in. See \c
.sh
allocation vector.
.sp
.sh
ALV: \c
.qs
See \c
.sh
allocation vector.
.sp
.sh
ambiguous filename: \c
.qs
Filename that contains either of the CP/M wildcard characters, ?
or *, in the primary filename, filetype, or both. When you
replace characters in a filename with these wildcard characters,
you create an ambiguous filename and can easily reference more
than one CP/M file in a single command line.
.sp
.sh
American Standard Code for Information Interchange: \c
.qs
See \c
.sh
ASCII.
.sp
.sh
applications program: \c
.qs
Program designed to solve a specific problem. Typical
applications programs are business accounting packages, word
processing (editing) programs and mailing list programs.
.sp
.sh
archive attribute: \c
.qs
File attribute controlled by the high-order bit of the t3 byte
(FCB+11) in a directory element. This attribute is set if the
file has been archived.
.sp
.sh
argument: \c
.qs
Symbol, usually a letter, indicating a place into which you can
substitute a number, letter, or name to give an appropriate
meaning to the formula in question.
.sp
.sh
ASCII: \c
.qs
American Standard Code for Information Interchange. ASCII is a
standard set of seven-bit numeric character codes used to
represent characters in memory. Each character requires one byte
of memory with the high-order bit usually set to zero.
Characters can be numbers, letters, and symbols. An ASCII file can be
intelligibly displayed on the video screen or printed on paper.
.sp
.sh
assembler: \c
.qs
Program that translates assembly language into the binary machine
code. Assembly language is simply a set of mnemonics used to
designate the instruction set of the CPU. See \c
.sh
ASM \c
.qs
in Section 3 of this manual.
.sp
.sh
back-up: \c
.qs
Copy of a disk or file made for safekeeping, or the creation of
the duplicate disk or file.
.sp
.sh
Basic Disk Operating System: \c
.qs
See \c
.sh
BDOS.
.sp
.sh
BDOS: \c
.qs
Basic Disk Operating System. The BDOS module of the CP/M
operating system provides an interface for a user program to the
operating system. This interface is in the form of a set of
function calls which may be made to the BDOS through calls to
location 0005H in page zero. The user program specifies the
number of the desired function in register C. User programs
running under CP/M should use BDOS functions for all I/O
operations to remain compatible with other CP/M systems and
future releases. The BDOS normally resides in high memory
directly below the BIOS.
.sp
.sh
bias: \c
.qs
Address value which when added to the origin address of your BIOS
module produces 1F80H, the address of the BIOS module in the
MOVCPM image. There is also a bias value that when added to the
BOOT module origin produces 0900H, the address of the BOOT module
in the MOVCPM image. You must use these bias values with the R
command under DDT or SID \ \ when you patch a CP/M system. If you do
not, the patched system may fail to function.
.sp
.sh
binary: \c
.qs
Base 2 numbering system. A binary digit can have one of two
values: 0 or 1. Binary numbers are used in computers because
the hardware can most easily exhibit two states: off and on.
Generally, a bit in memory represents one binary digit.
.sp
.sh
Basic Input/Output System: \c
.qs
See \c
.sh
BIOS.
.sp
.sh
BIOS: \c
.qs
Basic Input/Output System. The BIOS is the only hardware-
dependent module of the CP/M system. It provides the BDOS with a
set of primitive I/O operations. The BIOS is an assembly
language module usually written by the user, hardware
manufacturer, or independent software vendor, and is the key to
CP/M's portability. The BIOS interfaces the CP/M system to its
hardware environment through a standardized jump table at the
front of the BIOS routine and through a set of disk parameter
tables which define the disk environment. Thus, the BIOS
provides CP/M with a completely table-driven I/O system.
.sp
.sh
BIOS base: \c
.qs
Lowest address of the BIOS module in memory, that by definition
must be the first entry point in the BIOS jump table.
.bp
.sh
bit: \c
.qs
Switch in memory that can be set to on (1) or off (0). Bits are
grouped into bytes, eight bits to a byte, which is the smallest
directly addressable unit in an Intel 8080 or Zilog Z80. By
common convention, the bits in a byte are numbered from right, 0
for the low-order bit, to left, 7 for the high-order bit. Bit
values are often represented in hexadecimal notation by grouping
the bits from the low-order bit in groups of four. Each group of
four bits can have a value from 0 to 15 and thus can easily be
represented by one hexadecimal digit.
.sp
.sh
BLM: \c
.qs
See \c
.sh
block mask.
.sp
.sh
block: \c
.qs
Basic unit of disk space allocation. Each disk drive has a fixed
block size (BLS) defined in its disk parameter block in the BIOS.
A block can consist of 1K, 2K, 4K, 8K, or 16K consecutive bytes.
Blocks are numbered relative to zero so that each block is unique
and has a byte displacement in a file equal to the block number
times the block size.
.sp
.sh
block mask (BLM): \c
.qs
Byte value in the disk parameter block at DPB + 3. The block
mask is always one less than the number of 128 byte sectors that
are in one block. Note that BLM = (2 ** BSH) - 1.
.sp
.sh
block shift (BSH): \c
.qs
Byte parameter in the disk parameter block at DPB + 2.
Block shift and block mask (BLM) values are determined by the
block size (BLS). Note that BLM = (2 ** BSH) - 1.
.sp
.sp 0
.sh
blocking & deblocking algorithm: \c
.qs
In some disk subsystems the disk sector size is larger than 128
bytes, usually 256, 512, 1024, or 2048 bytes. When the host
sector size is larger than 128 bytes, host sectors must be
buffered in memory and the 128-byte CP/M sectors must be blocked
and deblocked by adding an additional module, the blocking and
deblocking algorithm, between the BIOS disk I/O routines and the
actual disk I/O. The host sector size must be an even multiple
of 128 bytes for the algorithm to work correctly. The blocking
and deblocking algorithm allows the BDOS and BIOS to function
exactly as if the entire disk consisted only of 128-byte sectors,
as in the standard CP/M installation.
.sp
.sh
BLS: \c
.qs
Block size in bytes. See \c
.sh
block.
.sp
.sh
boot: \c
.qs
Process of loading an operating system into memory. A boot
program is a small piece of code that is automatically executed
when you power-up or reset your computer. The boot program loads
the rest of the operating system into memory in a manner similar
to a person pulling himself up by his own bootstraps. This
process is sometimes called a cold boot or cold start. Bootstrap
pocedures vary from system to system. The boot program must be
customized for the memory size and hardware environment that the
operating system manages. Typically, the boot resides on the
first sector of the system tracks on your system disk. When
executed, the boot loads the remaining sectors of the system
tracks into high memory at the location for which the CP/M system
has been configured. Finally, the boot transfers execution to
the boot entry point in the BIOS jump table so that the system
can initialize itself. In this case, the boot program should be
placed at 900H in the SYSGEN image. Alternatively, the boot
program may be located in ROM.
.sp
.sh
bootstrap: \c
.qs
See \c
.sh
boot.
.sp
.sh
BSH: \c
.qs
See \c
.sh
block shift.
.sp
.sh
BTREE: \c
.qs
General purpose file access method that has become the standard
organization for indexes in large data base systems. BTREE
provides near optimum performance over the full range of file
operations, such as insertion, deletion, search, and search next.
.sp
.sh
buffer: \c
.qs
Area of memory that temporarily stores data during the transfer
of information.
.sp
.sh
built-in commands: \c
.qs
Commands that permanently reside in memory. They respond quickly
because they are not accessed from a disk.
.sp
.sh
byte: \c
.qs
Unit of memory or disk storage containing eight bits. A byte can
represent a binary number between 0 and 255, and is the smallest
unit of memory that can be addressed directly in 8-bit CPUs such
as the Intel 8080 or Zilog Z80.
.sp
.sh
CCP: \c
.qs
Console Command Processor. The CCP is a module of the CP/M
operating system. It is loaded directly below the BDOS module
and interprets and executes commands typed by the console user.
Usually these commands are programs that the CCP loads and calls.
Upon completion, a command program may return control to the CCP
if it has not overwritten it. If it has, the program can reload
the CCP into memory by a warm boot operation initiated by either
a jump to zero, BDOS system reset (Function 0), or a cold boot.
Except for its location in high memory, the CCP works like any
other standard CP/M program; that is, it makes only BDOS function
calls for its I/O operations.
.sp
.sh
CCP base: \c
.qs
Lowest address of the CCP module in memory. This term sometimes
refers to the base of the CP/M system in memory, as the CCP is
normally the lowest CP/M module in high memory.
.sp
.sh
checksum vector (CSV): \c
.qs
Contiguous data area in the BIOS, with one byte for each
directory sector to be checked, that is, CKS bytes. See \c
.sh
CKS. \c
.qs
A checksum vector is initialized and maintained for each logged-in
drive. Each directory access by the system results in a checksum
calculation that is compared with the one in the checksum vector.
If there is a discrepancy, the drive is set to Read-Only status.
This feature prevents the user from inadvertently switching disks
without logging in the new disk. If the new disk is not logged-in,
it is treated the same as the old one, and data on it might be
destroyed if writing is done.
.sp
.mb 5
.fm 1
.sh
CKS: \c
.qs
Number of directory records to be checked summed on directory
accesses. This is a parameter in the disk parameter block
located in the BIOS. If the value of CKS is zero, then no
directory records are checked. CKS is also a parameter in the
diskdef macro library, where it is the actual number of directory
elements to be checked rather than the number of directory
records.
.sp
.sh
cold boot: \c
.qs
See \c
.sh
boot. \c
.qs
Cold boot also refers to a jump to the boot entry point in the
BIOS jump table.
.sp
.mb 6
.fm 2
.sh
COM: \c
.qs
Filetype for a CP/M command file. See \c
.sh
command file.
.sp
.sh
command: \c
.qs
CP/M command line. In general, a CP/M command line has three
parts: the command keyword, command tail, and a carriage return.
To execute a command, enter a CP/M command line directly after
the CP/M prompt at the console and press the carriage return or
enter key.
.sp
.sh
command file: \c
.qs
Executable program file of filetype COM. A command file is a
machine language object module ready to be loaded and executed at
the absolute address of 0100H. To execute a command file, enter
its primary filename as the command keyword in a CP/M command
line.
.sp
.sh
command keyword: \c
.qs
Name that identifies a CP/M command, usually the primary filename
of a file of type COM, or a built-in command. The command
keyword precedes the command tail and the carriage return in the
command line.
.sp
.sh
command syntax: \c
.qs
Statement that defines the correct way to enter a command. The
correct structure generally includes the command keyword, the
command tail, and a carriage return. A syntax line usually
contains symbols that you should replace with actual values when
you enter the command.
.sp
.sh
command tail: \c
.qs
Part of a command that follows the command keyword in the command
line. The command tail can include a drive specification, a
filename and filetype, and options or parameters. Some
commands do not require a command tail.
.sp
.sh
CON: \c
.qs
Mnemonic that represents the CP/M console device.
For example, the CP/M command PIP CON:=TEST.SUB displays the
file TEST.SUB on the console device. The explanation of the STAT
command tells how to assign the logical device CON: to various
physical devices. \c
See \c
.sh
console.
.sp
.sh
concatenate: \c
.qs
Name of the PIP operation that copies two or more separate files
into one new file in the the specified sequence.
.sp
.sh
concurrency: \c
.qs
Execution of two processes or operations simultaneously.
.sp
.sh
CONIN: \c
.qs
BIOS entry point to a routine that reads a character from the
console device.
.sp
.sh
CONOUT: \c
.qs
BIOS entry point to a routine that sends a character to the
console device.
.bp
.sh
console: \c
.qs
Primary input/output device. The console consists of a listing
device, such as a screen or teletype, and a keyboard through
which the user communicates with the operating system or
applications program.
.sp
.sh
Console Command Processor: \c
.qs
See \c
.sh
CCP.
.sp
.sh
CONST: \c
.qs
BIOS entry point to a routine that returns the status of the
console device.
.sp
.sh
control character: \c
.qs
Nonprinting character combination. CP/M interprets some control
characters as simple commands such as line editing functions. To
enter a control character, hold down the CONTROL key and strike
the specified character key.
.sp
.sh
Control Program for Microcomputers: \c
.qs
See \c
.sh
CP/M.
.sp
.sh
CP/M: \c
.qs
Control Program for Microcomputers. An operating system that
manages computer resources and provides a standard systems
interface to software written for a large variety of
microprocessor-based computer systems.
.sp
.sh
CP/M 1.4l compatibility: \c
.qs
For a CP/M 2 system to be able to read correctly single-density
disks produced under a CP/M 1.4 system, the extent mask must be
zero and the block size 1K. This is because under CP/M 2 an FCB
may contain more than one extent. The number of extents that may
be contained by an FCB is EXM+1. The issue of CP/M 1.4
compatibility also concerns random file I/O. To perform random
file I/O under CP/M 1.4, you must maintain an FCB for each extent
of the file. This scheme is upward compatible with CP/M 2 for
files not exceeding 512K bytes, the largest file size supported
under CP/M 1.4. If you wish to implement random I/O for files
larger than 512K bytes under CP/M 2, you must use the random read
and random write functions, BDOS functions 33, 34, and 36. In
this case, only one FCB is used, and if CP/M 1.4 compatiblity is
required, the program must use the return version number
function, BDOS Function 12, to determine which method to employ.
.sp
.sh
CP/M prompt: \c
.qs
Characters that indicate that CP/M is ready to execute your next
command. The CP/M prompt consists of an upper-case letter, A-P,
followed by a > character; for example, A>. The letter
designates which drive is currently logged in as the default
drive. CP/M will search this drive for the command file
specified, unless the command is a built-in command or prefaced
by a select drive command: for example, B:STAT.
.sp
.sh
CP/NET: \c
.qs
Digital Research network operating system enabling microcomputers
to obtain access to common resources via a network. CP/NET
consists of MP/M masters and CP/M slaves with a network interface
between them.
.sp
.sh
CSV: \c
.qs
See \c
.sh
checksum vector.
.sp
.mb 5
.fm 1
.sh
cursor: \c
.qs
One-character symbol that can appear anywhere on the console
screen. The cursor indicates the position where the next
keystroke at the console will have an effect.
.sp
.sh
data file: \c
.qs
File containing information that will be processed by a program.
.sp
.mb 6
.fm 2
.sh
deblocking: \c
.qs
See \c
.sh
blocking & deblocking algorithm.
.sp
.sh
default: \c
.qs
Currently selected disk drive and user number. Any command that
does not specify a disk drive or a user number references the
default disk drive and user number. When CP/M is first invoked,
the default disk drive is drive A, and the default user number is
0.
.sp
.sh
default buffer: \c
.qs
Default 128-byte buffer maintained at 0080H in page zero. When
the CCP loads a COM file, this buffer is initialized to the
command tail; that is, any characters typed after the COM file
name are loaded into the buffer. The first byte at 0080H
contains the length of the command tail, while the command tail
itself begins at 0081H. The command tail is terminated by a byte
containing a binary zero value. The I command under DDT and SID
initializes this buffer in the same way as the CCP.
.sp
.sh
default FCB: \c
.qs
Two default FCBs are maintained by the CCP at 005CH and 006CH in
page zero. The first default FCB is initialized from the first
delimited field in the command tail. The second default FCB
is initialized from the next field in the command tail.
.sp
.sp 0
.sh
delimiter: \c
.qs
Special characters that separate different items in a command
line; for example, a colon separates the drive specification from
the filename. The CCP recognizes the following characters as
delimiters: . : = ; < > _, blank, and carriage return. Several
CP/M commands also treat the following as delimiter characters:
, [ ] ( ) $. It is advisable to avoid the use of delimiter
characters and lower-case characters in CP/M filenames.
.sp
.sh
DIR: \c
.qs
Parameter in the diskdef macro library that specifies the number
of directory elements on the drive.
.sp
.sh
DIR attribute: \c
.qs
File attribute. A file with the DIR attribute can be displayed
by a DIR command. The file can be accessed from the default user
number and drive only.
.sp
.sh
DIRBUF: \c
.qs
128-byte scratchpad area for directory operations,
usually located at the end of the BIOS. DIRBUF is used by the
BDOS during its directory operations. DIRBUF also refers to the
two-byte address of this scratchpad buffer in the disk parameter
header at DPbase + 8 bytes.
.sp
.sh
directory: \c
.qs
Portion of a disk that contains entries for each file on the
disk. In response to the DIR command, CP/M displays the
filenames stored in the directory. The directory also contains
the locations of the blocks allocated to the files. Each file
directory element is in the form of a 32-byte FCB, although one
file can have several elements, depending on its size. The
maximum number of directory elements supported is specified by
the drive's disk parameter block value for DRM.
.bp
.sh
directory element: \c
.qs
Data structure. Each file on a disk has one or more 32-byte
directory elements associated with it. There are four directory
elements per directory sector. Directory elements can also be
referred to as directory FCBs.
.sp
.sh
directory entry: \c
.qs
File entry displayed by the DIR command. Sometimes this term
refers to a physical directory element.
.sp
.sp 0
.sh
disk, diskette: \c
.qs
Magnetic media used for mass storage in a computer system.
Programs and data are recorded on the disk in the same way music
can be recorded on cassette tape. The CP/M operating system must
be initially loaded from disk when the computer is turned on.
Diskette refers to smaller capacity removable floppy diskettes,
while disk may refer to either a diskette, removable cartridge
disk, or fixed hard disk. Hard disk capacities range from five
to several hundred megabytes of storage.
.sp
.sh
diskdef macro library: \c
.qs
Library of code that when used with MAC, the Digital Research
macro assembler, creates disk definition tables such as the DPB
and DPH automatically.
.sp
.sh
disk drive: \c
.qs
Peripheral device that reads and writes information on disk.
CP/M assigns a letter to each drive under its
control. For example, CP/M may refer to the drives in a
four-drive system as A, B, C, and D.
.sp
.sh
disk parameter block (DPB): \c
.qs
Data structure referenced by one or more disk parameter headers.
The disk parameter block defines disk characteristics in the
fields listed below:
.sp
.in 5
.nf
SPT is the total number of sectors per track.
BSH is the data allocation block shift factor.
BLM is the data allocation block mask.
EXM is the extent mask determined by BLS and DSM.
DSM is the maximum data block number.
DRM is the maximum number of directory entries--1.
AL0 reserves directory blocks.
AL1 reserves directory blocks.
CKS is the number of directory sectors check summed.
OFF is the number of reserved system tracks.
.fi
.in 0
.sp
The address of the disk parameter block is located in the disk
parameter header at DPbase +0AH. CP/M Function 31 returns the
DPB address. Drives with the same characteristics can use the
same disk parameter header, and thus the same DPB. However,
drives with different characteristics must each have their own
disk parameter header and disk parameter blocks. When the BDOS
calls the SELDSK entry point in the BIOS, SELDSK must return the
address of the drive's disk parameter header in register HL.
.sp
.sh
disk parameter header (DPH): \c
.qs
Data structure that contains information about the disk drive and
provides a scratchpad area for certain BDOS operations. The disk
parameter header contains six bytes of scratchpad area for the
BDOS, and the following five 2-byte parameters:
.sp
.in 5
.nf
XLT is the sector translation table address.
DIRBUF is the directory buffer address.
DPB is the disk parameter block address.
CSV is the checksum vector address.
ALV is the allocation vector address.
.fi
.in 0
.sp
Given n disk drives, the disk parameter headers are arranged in a
table whose first row of 16 bytes corresponds to drive 0, with
the last row corresponding to drive n-1.
.sp
.sh
DKS: \c
.qs
Parameter in the diskdef macro library specifying the number of
data blocks on the drive.
.sp
.sh
DMA: \c
.qs
Direct Memory Access. DMA is a method of transferring data from
the disk into memory directly. In a CP/M system, the BDOS calls
the BIOS entry point READ to read a sector from the disk into the
currently selected DMA address. The DMA address must be the
address of a 128-byte buffer in memory, either the default buffer
at 0080H in page zero, or a user-assigned buffer in the TPA.
Similarly, the BDOS calls the BIOS entry point WRITE to write the
record at the current DMA address to the disk.
.sp
.sh
DN: \c
.qs
Parameter in the diskdef macro library specifying the logical
drive number.
.sp
.sh
DPB: \c
.qs
See \c
.sh
disk parameter block.
.sp
.sh
DPH: \c
.qs
See \c
.sh
disk parameter header.
.sp
.sh
DRM: \c
.qs
2-byte parameter in the disk parameter block at DPB + 7. DRM is
one less than the total number of directory entries allowed for
the drive. This value is related to DPB bytes AL0 and AL1, which
allocates up to 16 blocks for directory entries.
.sp
.sh
DSM: \c
.qs
2-byte parameter of the disk parameter block at DPB + 5. DSM is
the maximum data block number supported by the drive. The
product BLS times (DSM+1) is the total number of bytes held by
the drive. This must not exceed the capacity of the physical
disk less the reserved system tracks.
.sp
.sh
editor: \c
.qs
Utility program that creates and modifies text files. An editor
can be used for creation of documents or creation of code for
computer programs. The CP/M editor is invoked by typing the
command ED next to the system prompt on the console.
.sp
.sh
EX: \c
.qs
Extent number field in an FCB. See \c
.sh
extent.
.sp
.sh
executable: \c
.qs
Ready to be run by the computer. Executable code is a series of
instructions that can be carried out by the computer. For
example, the computer cannot execute names and addresses, but it
can execute a program that prints all those names and addresses
on mailing labels.
.sp
.sh
execute a program: \c
.qs
Start the processing of executable code.
.sp
.sh
EXM: \c
.qs
See \c
.sh
extent mask.
.sp
.sh
extent: \c
.qs
16K consecutive bytes in a file. Extents are numbered from 0 to
31. One extent can contain 1, 2, 4, 8, or 16 blocks. EX is the
extent number field of an FCB and is a one-byte field at FCB +
12, where FCB labels the first byte in the FCB. Depending on the
block size (BLS) and the maximum data block number (DSM), an FCB
can contain 1, 2, 4, 8, or 16 extents. The EX field is normally
set to 0 by the user but contains the current extent number
during file I/O. The term FCB folding describes FCBs containing
more than one extent. In CP/M version 1.4, each FCB contained
only one extent. Users attempting to perform random record I/O
and maintain CP/M 1.4 compatiblity should be aware of the
implications of this difference. See \c
.sh
CP/M 1.4 compatibility.
.sp
.sh
extent mask (EXM): \c
.qs
A byte parameter in the disk parameter block located at DPB + 3.
The value of EXM is determined by the block size (BLS) and
whether the maximum data block number (DSM) exceeds 255. There
are EXM + 1 extents per directory FCB.
.sp
.sh
FCB: \c
.qs
See \c
.sh
File Control Block.
.sp
.sh
file: \c
.qs
Collection of characters, instructions, or data that can be
referenced by a unique identifier. Files are usually stored on
various types of media, such as disk, or magnetic
tape. A CP/M file is identified by a file specification and
resides on disk as a collection of from zero to 65,536 records.
Each record is 128 bytes and can contain either binary or ASCII
data. Binary files contain bytes of data that can vary in value
from 0H to 0FFH. ASCII files contain sequences of character
codes delineated by a carriage return and line-feed combination;
normally byte values range from 0H to 7FH. The directory maps
the file as a series of physical blocks. Although files are
defined as a sequence of consecutive logical records, these
records can not reside in consecutive sectors on the disk. See
also \c
.sh
block, directory, extent, record, \c
.qs
and \c
.sh
sector.
.qs
.nx apph2.tex


912
Source/Doc/CPM 22 Manual - Testing/apph2.tex

@ -1,912 +0,0 @@
.he CP/M Operating System Manual H Glossary
.sp
File Control Block (FCB):
Structure used for accessing files on disk. Contains the drive,
filename, filetype, and other information describing a file to be
accessed or created on the disk. A file control block consists
of 36 consecutive bytes specified by the user for file I/O
functions. FCB can also refer to a directory element in the
directory portion of the allocated disk space. These contain the
same first 32 bytes of the FCB, but lack the current record and
random record number bytes.
.sp
.sh
filename: \c
.qs
Name assigned to a file. A filename can include a primary
filename of one to eight characters; a filetype of zero to three characters.
A period separates the primary filename from the filetype.
.sp
.mb 5
.fm 1
.sh
file specification: \c
.qs
Unique file identifier. A complete CP/M file specification
includes a disk drive specification followed by a colon, d:, a
primary filename of one to eight characters, a period, and a filetype of
zero to three characters. For example, b:example.tex is a complete CP/M
file specification.
.sp
.sh
filetype: \c
.qs
Extension to a filename. A filetype can be from zero to three
characters and must be separated from the primary filename by a
period. A filetype can tell something about the file. Some
programs require that files to be processed have specific
filetypes.
.sp
.mb 6
.fm 2
.sp 0
.sh
floppy disk: \c
.qs
Flexible magnetic disk used to store information. Floppy disks
come in 5 1/4- and 8-inch diameters.
.sp
.sh
FSC: \c
.qs
Parameter in the diskdef macro library specifying the first
physical sector number. This parameter is used to determine SPT
and build XLT.
.sp
.sh
hard disk: \c
.qs
Rigid, platter-like, magnetic disk sealed in a container. A hard
disk stores more information than a floppy disk.
.sp
.sh
hardware: \c
.qs
Physical components of a computer.
.sp
.sh
hexadecimal notation: \c
.qs
Notation for base 16 values using the decimal digits and letters
A, B, C, D, E, and F to represent the 16 digits. Hexadecimal
notation is often used to refer to binary numbers. A binary
number can be easily expressed as a hexadecimal value by taking
the bits in groups of 4, starting with the least significant bit,
and expressing each group as a hexadecimal digit, 0-F. Thus the
bit value 1011 becomes 0BH and 10110101 becomes 0B5H.
.sp
.sh
hex file: \c
.qs
ASCII-printable representation of a command, machine language,
file.
.sp
.sh
hex file format: \c
.qs
Absolute output of ASM and MAC for the Intel 8080 is a hex format
file, containing a sequence of absolute records that give a load
address and byte values to be stored, starting at the load
address.
.sp
.sh
HOME: \c
.qs
BIOS entry point which sets the disk head of the currently
selected drive to the track zero position.
.sp
.sh
host: \c
.qs
Physical characteristics of a hard disk drive in a system using
the blocking and deblocking algorithm. The term, host, helps
distinguish physical hardware characteristics from CP/M's logical
characteristics. For example, CP/M sectors are always 128 bytes,
although the host sector size can be a multiple of 128 bytes.
.sp
.sh
input: \c
.qs
Data going into the computer, usually from an operator typing at
the terminal or by a program reading from the disk.
.sp
.sh
input/output: \c
.qs
See \c
.sh
I/O.
.sp
.sh
interface: \c
.qs
Object that allows two independent systems to communicate with
each other, as an interface between hardware and software in a
microcomputer.
.sp
.sh
I/O: \c
.qs
Abbreviation for input/output. Usually refers to input/output
operations or routines handling the input and output of data in
the computer system.
.sp
.sh
IOBYTE: \c
.qs
A one-byte field in page zero, currently at location 0003H, that
can support a logical-to-physical device mapping for I/O.
However, its implementation in your BIOS is purely optional and
might or might not be supported in a given CP/M system. The IOBYTE
is easily set using the command:
.sp
.ti 8
.nf
STAT <logical device> = <physical device>
.fi
.sp
The CP/M logical devices are CON:, RDR:, PUN:, and LST:; each of
these can be assigned to one of four physical devices. The IOBYTE
can be initialized by the BOOT entry point of the BIOS and
interpreted by the BIOS I/O entry points CONST, CONIN, CONOUT,
LIST, PUNCH, and READER. Depending on the setting of the IOBYTE,
different I/O drivers can be selected by the BIOS. For example,
setting LST:=TTY: might cause LIST output to be directed to a
serial port, while setting LST:=LPT: causes LIST output to be
directed to a parallel port.
.sp
.sh
K: \c
.qs
Abbreviation for kilobyte. See \c
.sh
kilobyte.
.sp
.sh
keyword: \c
.qs
See \c
.sh
command keyword.
.sp
.sh
kilobyte (K): \c
.qs
1024 bytes or 0400H bytes of memory. This is a standard unit of
memory. For example, the Intel 8080 supports up to 64K of memory
address space or 65,536 bytes. 1024 kilobytes equal one megabyte,
or over one million bytes.
.sp
.sh
linker: \c
.qs
Utility program used to combine relocatable object modules into
an absolute file ready for execution. For example, LINK-80 \ \
creates either a COM or PRL file from relocatable REL files, such
as those produced by PL/I-80 \ \ .
.sp
.sh
LIST: \c
.qs
A BIOS entry point to a routine that sends a character to the
list device, usually a printer.
.sp
.sh
list device: \c
.qs
Device such as a printer onto which data can be listed or
printed.
.sp
.sh
LISTST: \c
.qs
BIOS entry point to a routine that returns the ready status of
the list device.
.sp
.sh
loader: \c
.qs
Utility program that brings an absolute program image into memory
ready for execution under the operating system, or a utility used
to make such an image. For example, LOAD prepares an absolute
COM file from the assembler hex file output that is ready to be
executed under CP/M.
.sp
.sh
logged in: \c
.qs
Made known to the operating system, in reference to drives. A
drive is logged in when it is selected by the user or an
executing process. It remains selected or logged in until you
change disks in a floppy disk drive or enter CTRL-C at the
command level, or until a BDOS Function 0 is executed.
.sp
.sh
logical: \c
.qs
Representation of something that might or might not be the same
in its actual physical form. For example, a hard disk can occupy
one physical drive, yet you can divide the available storage on
it to appear to the user as if it were in several different
drives. These apparent drives are the logical drives.
.sp
.sh
logical sector: \c
.qs
See \c
.sh
sector.
.sp
.sh
logical-to-physical sector translation table: \c
.qs
See \c
.sh
XLT.
.sp
.sh
LSC: \c
.qs
Diskdef macro library parameter specifying the last physical
sector number.
.sp
.sh
LST: \c
.qs
Logical CP/M list device, usually a printer. The CP/M list
device is an output-only device referenced through the LIST and
LISTST entry points of the BIOS. The STAT command allows
assignment of LST: to one of the physical devices: TTY:, CRT:,
LPT:, or UL1:, provided these devices and the IOBYTE are
implemented in the LIST and LISTST entry points of your CP/M BIOS
module. The CP/NET command NETWORK allows assignment of LST: to
a list device on a network master. For example, PIP LST:=TEST.SUB
prints the file TEST.SUB on the list device.
.sp
.sh
macro assembler: \c
.qs
Assembler code translator providing macro processing facilities.
Macro definitions allow groups of instructions to be stored and
substituted in the source program as the macro names are
encountered. Definitions and invocations can be nested and macro
parameters can be formed to pass arbitrary strings of text to a
specific macro for substitution during expansion.
.sp
.sh
megabyte: \c
.qs
Over one million bytes; 1024 kilobytes. See \c
.sh
byte, \c
.qs
and \c
.sh
kilobyte.
.sp
.sh
microprocessor: \c
.qs
Silicon chip that is the central processing unit (CPU) of the
microcomputer. The Intel 8080 and the Zilog Z80 are
microprocessors commonly used in CP/M systems.
.sp
.sh
MOVCPM image: \c
.qs
Memory image of the CP/M system created by MOVCPM. This image
can be saved as a disk file using the SAVE command or placed on
the system tracks using the SYSGEN command without specifying a
source drive. This image varies, depending on the presence of a
one-sector or two-sector boot. If the boot is less than 128
bytes (one sector), the boot begins at 0900H, the CP/M system at
0980H, and the BIOS at 1F80H. Otherwise, the boot is at 0900H,
the CP/M system at 1000H, and the BIOS at 2000H. In a CP/M 1.4
system with a one-sector boot, the addresses are the same as for
the CP/M 2 system--except that the BIOS begins at 1E80H instead
of 1F80H.
.mb 4
.fm 1
.sp
.sh
MP/M: \c
.qs
Multi-Programming Monitor control program. A microcomputer
operating system supporting multi-terminal access with multi-
programming at each terminal.
.sp
.sh
multi-programming: \c
.qs
The capability of initiating and executing more than one program
at a time. These programs, usually called processes, are time-shared,
each receiving a slice of CPU time on a round-robin
basis. See \c
.sh
concurrency.
.sp
.sh
nibble: \c
.qs
One half of a byte, usually the high-order or low-order 4 bits in
a byte.
.sp
.sh
OFF: \c
.qs
Two-byte parameter in the disk parameter block at DPB + 13 bytes.
This value specifies the number of reserved system tracks. The
disk directory begins in the first sector of track OFF.
.sp
.sh
OFS: \c
.qs
Diskdef macro library parameter specifying the number of reserved
system tracks. See \c
.sh
OFF.
.sp
.sh
operating system: \c
.qs
Collection of programs that supervises the execution of other
programs and the management of computer resources. An operating
system provides an orderly input/output environment between the
computer and its peripheral devices. It enables user-written
programs to execute safely. An operating system standardizes the
use of computer resources for the programs running under it.
.mb 6
.fm 2
.sp
.sh
option: \c
.qs
One of many parameters that can be part of a command tail. Use
options to specify additional conditions for a command's
execution.
.sp
.sh
output: \c
.qs
Data that is sent to the console, disk, or printer.
.sp
.sh
page: \c
.qs
256 consecutive bytes in memory beginning on a page boundary,
whose base address is a multiple of 256 (100H) bytes. In hex
notation, pages always begin at an address with a least
significant byte of zero.
.sp
.sh
page relocatable program: \c
.qs
See \c
.sh
PRL.
.sp
.sh
page zero: \c
.qs
Memory region between 0000H and 0100H used to hold critical
system parameters. Page zero functions primarily as an interface
region between user programs and the CP/M BDOS module. Note that
in non-standard systems this region is the base page of the
system and represents the first 256 bytes of memory used by the
CP/M system and user programs running under it.
.sp
.sh
parameter: \c
.qs
Value in the command tail that provides additional information
for the command. Technically, a parameter is a required element
of a command.
.sp
.sh
peripheral devices: \c
.qs
Devices external to the CPU. For example, terminals, printers,
and disk drives are common peripheral devices that are not part
of the processor but are used in conjunction with it.
.sp
.sh
physical: \c
.qs
Characteristic of computer components, generally hardware, that
actually exist. In programs, physical components can be
represented by logical components.
.sp
.sh
primary filename: \c
.qs
First 8 characters of a filename. The primary filename is a
unique name that helps the user identify the file contents. A
primary filename contains one to eight characters and can include any
letter or number and some special characters. The primary
filename follows the optional drive specification and precedes
the optional filetype.
.sp
.sh
PRL: \c
.qs
Page relocatable program. A page relocatable program is stored
on disk with a PRL filetype. Page relocatable programs are
easily relocated to any page boundary and thus are suitable for
execution in a nonbanked MP/M system.
.sp
.sh
program: \c
.qs
Series of coded instructions that performs specific tasks when
executed by a computer. A program can be written in a
processor-specific language or a high-level language that can be
implemented on a number of different processors.
.sp
.sh
prompt: \c
.qs
Any characters displayed on the video screen to help the user
decide what the next appropriate action is. A system prompt is a
special prompt displayed by the operating
system. The alphabetic character indicates the default drive. Some
applications programs have their own special prompts. See \c
.sh
CP/M prompt.
.qs
.sp
.mb 5
.fm 1
PUN:
Logical CP/M punch device. The punch device is an output-only
device accessed through the PUNCH entry point of the BIOS. In
certain implementations, PUN: can be a serial device such as a
modem.
.sp
PUNCH:
BIOS entry point to a routine that sends a character to the punch
device.
.sp
RDR:
Logical CP/M reader device. The reader device is an input-only
device accessed through the READER entry point in the BIOS.
See
PUN:.
.sp
READ:
Entry point in the BIOS to a routine that reads 128 bytes from
the currently selected drive, track, and sector into the current
DMA address.
.sp
READER:
Entry point to a routine in the BIOS that reads the next
character from the currently assigned reader device.
.sp
Read-Only (R/O):
Attribute that can be assigned to a disk file or a disk drive.
When assigned to a file, the Read-Only attribute allows you to
read from that file but not write to it. When assigned to a
drive, the Read-Only attribute allows you to read any file on the
disk, but prevents you from adding a new file, erasing or changing
a file, renaming a file, or writing on the disk. The STAT
command can set a file or a drive to Read-Only. Every file and
drive is either Read-Only or Read-Write. The default setting for
drives and files is Read-Write, but an error in resetting the
disk or changing media automatically sets the drive to Read-Only
until the error is corrected. See also \c
.sh
ROM.
.sp
.sh
Read-Write (R/W): \c
.qs
Attribute that can be assigned to a disk file or a disk drive.
The Read-Write attribute allows you to read from and write to a
specific Read-Write file or to any file on a disk that is in a
drive set to Read-Write. A file or drive can be set to either
Read-Only or Read-Write.
.sp
.sh
record: \c
.qs
Group of bytes in a file. A physical record consists of 128
bytes and is the basic unit of data transfer between the
operating system and the application program. A logical record
might vary in length and is used to represent a unit of
information. Two 64-byte employee records can be stored in one
128-byte physical record. Records are grouped together to form a
file.
.sp
.sh
recursive procedure: \c
.qs
Code that can call itself during execution.
.sp
.mb 6
.fm 2
.sh
reentrant procedure: \c
.qs
Code that can be called by one process while another is already
executing it. Thus, reentrant code can be shared between
different users. Reentrant procedures must not be self-
modifying; that is, they must be pure code and not contain data.
The data for reentrant procedures can be kept in a separate data
area or placed on the stack.
.sp
.sh
restart (RST): \c
.qs
One-byte call instruction usually used during interrupt sequences
and for debugger break pointing. There are eight restart
locations, RST 0 through RST 7, whose addresses are given by the
product of 8 times the restart number.
.sp
.sh
R/O: \c
.qs
See \c
.sh
Read-Only.
.sp
.sh
ROM: \c
.qs
Read-Only memory. This memory can be read but not written and so
is suitable for code and preinitialized data areas only.
.sp
.sh
RST: \c
.qs
See \c
.sh
restart.
.sp
.sh
R/W: \c
.qs
See \c
.sh
Read-Write.
.sp
.sh
sector: \c
.qs
In a CP/M system, a sector is always 128 consecutive bytes. A
sector is the basic unit of data read and written on the disk by
the BIOS. A sector can be one 128-byte record in a file or a
sector of the directory. The BDOS always requests a logical
sector number between 0 and (SPT-1). This is typically
translated into a physical sector by the BIOS entry point
SECTRAN. In some disk subsystems, the disk sector size is larger
than 128 bytes, usually a power of two, such as 256, 512, 1024, or
2048 bytes. These disk sectors are always referred to as host
sectors in CP/M documentation and should not be confused with
other references to sectors, in which cases the CP/M 128-byte
sectors should be assumed. When the host sector size is larger
than 128 bytes, host sectors must be buffered in memory and the
128-byte CP/M sectors must be blocked and deblocked from them.
This can be done by adding an additional module, the blocking and
deblocking algorithm, between the BIOS disk I/O routines and the
actual disk I/O.
.sp
.sh
sectors per track (SPT): \c
.qs
A two-byte parameter in the disk parameter block at DPB + 0. The
BDOS makes calls to the BIOS entry point SECTRAN with logical
sector numbers ranging between 0 and (SPT - 1) in register BC.
.sp
.sh
SECTRAN: \c
.qs
Entry point to a routine in the BIOS that performs
logical-to-physical sector translation for the BDOS.
.sp
.sh
SELDSK: \c
.qs
Entry point to a routine in the BIOS that sets the currently
selected drive.
.sp
.sh
SETDMA: \c
.qs
Entry point to a routine in the BIOS that sets the currently
selected DMA address. The DMA address is the address of a
128-byte buffer region in memory that is used to transfer data to
and from the disk in subsequent reads and writes.
.sp
.sh
SETSEC: \c
.qs
Entry point to a routine in the BIOS that sets the currently
selected sector.
.sp
.sh
SETTRK: \c
.qs
Entry point to a routine in the BIOS that sets the currently
selected track.
.sp
.sh
skew factor: \c
.qs
Factor that defines the logical-to-physical sector number
translation in XLT. Logical sector numbers are used by the BDOS
and range between 0 and (SPT - 1). Data is written in
consecutive logical 128-byte sectors grouped in data blocks. The
number of sectors per block is given by BLS/128. Physical
sectors on the disk media are also numbered consecutively. If
the physical sector size is also 128 bytes, a one-to-one
relationship exists between logical and physical sectors. The
logical-to-physical translation table (XLT) maps this
relationship, and a skew factor is typically used in generating
the table entries. For instance, if the skew factor is 6, XLT
will be:
.sp
.nf
.in 8
Logical: 0 1 2 3 4 5 6 ... 25
Physical: 1 7 13 19 25 5 11 ... 22
.fi
.in 0
.sp
The skew factor allows time for program processing without
missing the next sector. Otherwise, the system must wait for an
entire disk revolution before reading the next logical sector.
The skew factor can be varied, depending on hardware speed and
application processing overhead. Note that no sector translation
is done when the physical sectors are larger than 128 bytes, as
sector deblocking is done in this case. See also \c
.sh
sector, SKF, \c
.qs
and \c
.sh
XLT.
.sp
.sh
SKF: \c
.qs
A diskdef macro library parameter specifying the skew factor to
be used in building XLT. If SKF is zero, no translation table is
generated and the XLT byte in the DPH will be 0000H.
.sp
.sh
software: \c
.qs
Programs that contain machine-readable instructions, as opposed
to hardware, which is the actual physical components of a
computer.
.sp
.sh
source file: \c
.qs
ASCII text file usually created with an editor that is an input
file to a system program, such as a language translator or text
formatter.
.sp
.sh
SP: \c
.qs
Stack pointer. See \c
.sh
stack.
.bp
.sh
spooling: \c
.qs
Process of accumulating printer output in a file while the
printer is busy. The file is printed when the printer becomes
free; a program does not have to wait for the slow printing
process.
.sp
.sh
SPT: \c
.qs
See \c
.sh
sectors per track.
.sp
.sh
stack: \c
.qs
Reserved area of memory where the processor saves the return
address when a call instruction is received. When a return
instruction is encountered, the processor restores the current
address on the stack to the program counter. Data such as the
contents of the registers can also be saved on the stack. The
push instruction places data on the stack and the pop instruction
removes it. An item is pushed onto the stack by decrementing the
stack pointer (SP) by 2 and writing the item at the SP address.
In other words, the stack grows downward in memory.
.sp
.sh
syntax: \c
.qs
Format for entering a given command.
.sp
.sh
SYS: \c
.qs
See \c
.sh
system attribute.
.sp
.sh
SYSGEN image: \c
.qs
Memory image of the CP/M system created by SYSGEN when a
destination drive is not specified. This is the same as the
MOVCPM image that can be read by SYSGEN if a source drive is
not specified. See \c
.sh
MOVCPM image.
.sp
.sh
system attribute (SYS): \c
.qs
File attribute. You can give a file the system attribute by
using the SYS option in the STAT command or by using the set file
attributes function, BDOS Function 12. A file with the SYS
attribute is not displayed in response to a DIR command. If you
give a file with user number 0 the SYS attribute, you can read
and execute that file from any user number on the same drive.
Use this feature to make your commonly used programs available
under any user number.
.sp
system prompt:
Symbol displayed by the operating system indicating that the
system is ready to receive input.
See prompt and CP/M prompt.
.sp
.sh
system tracks: \c
.qs
Tracks reserved on the disk for the CP/M system. The number of
system tracks is specified by the parameter OFF in the disk
parameter block (DPB). The system tracks for a drive always
precede its data tracks. The command SYSGEN copies the CP/M
system from the system tracks to memory, and vice versa. The
standard SYSGEN utility copies 26 sectors from track 0 and 26
sectors from track 1. When the system tracks contain additional
sectors or tracks to be copied, a customized SYSGEN must be used.
.sp
.sh
terminal: \c
.qs
See \c
.sh
console.
.sp
.sh
TPA: \c
.qs
Transient Program Area. Area in memory where user programs run
and store data. This area is a region of memory beginning at
0100H and extending to the base of the CP/M system in high
memory. The first module of the CP/M system is the CCP, which
can be overwritten by a user program. If so, the TPA is extended
to the base of the CP/M BDOS module. If the CCP is overwritten,
the user program must terminate with either a system reset
(Function 0) call or a jump to location zero in page zero. The
address of the base of the CP/M BDOS is stored in location 0006H
in page zero least significant byte first.
.sp
.sh
track: \c
.qs
Data on the disk media is accessed by combination of track and
sector numbers. Tracks form concentric rings on the disk; the
standard IBM single-density disks have 77 tracks. Each track
consists of a fixed number of numbered sectors. Tracks are
numbered from zero to one less than the number of tracks on the
disk.
.sp
.sh
Transient Program Area: \c
.qs
See \c
.sh
TPA.
.sp
.sh
upward compatible: \c
.qs
Term meaning that a program created for the previously released
operating system, or compiler, runs under the newly released
version of the same operating system.
.sp
.sh
USER: \c
.qs
Term used in CP/M and MP/M systems to distinguish distinct
regions of the directory.
.sp
.sh
user number: \c
.qs
Number assigned to files in the disk directory so that different
users need only deal with their own files and have their own
directories, even though they are all working from the same disk.
In CP/M, files can be divided into 16 user groups.
.sp
.sh
utility: \c
.qs
Tool. Program that enables the user to perform certain
operations, such as copying files, erasing files, and editing
files. The utilities are created for the convenience of
programmers and users.
.sp
.sh
vector: \c
.qs
Location in memory. An entry point into the operating system
used for making system calls or interrupt handling.
.sp
.sh
warm start: \c
.qs
Program termination by a jump to the warm start vector at
location 0000H, a system reset (BDOS Function 0), or a CTRL-C
typed at the keyboard. A warm start reinitializes the disk
subsystem and returns control to the CP/M operating system at the
CCP level. The warm start vector is simply a jump to the WBOOT
entry point in the BIOS.
.sp
.sh
WBOOT: \c
.qs
Entry point to a routine in the BIOS used when a warm start
occurs. A warm start is performed when a user program branches
to location 0000H, when the CPU is reset from the front panel, or
when the user types CTRL-C. The CCP and BDOS are reloaded from
the system tracks of drive A.
.sp
.sh
wildcard characters: \c
.qs
Special characters that match certain specified items. In CP/M
there are two wildcard characters: ? and *. The ? can be
substituted for any single character in a filename, and the * can
be substituted for the primary filename, the filetype, or both.
By placing wildcard characters in filenames, the user creates an
ambiguous filename and can quickly reference one or more files.
.bp
.sh
word: \c
.qs
16-bit or two-byte value, such as an address value. Although the
Intel 8080 is an 8-bit CPU, addresses occupy two bytes and are
called word values.
.sp
.sh
WRITE: \c
.qs
Entry point to a routine in the BIOS that writes the record at
the currently selected DMA address to the currently selected
drive, track, and sector.
.sp
.sh
XLT: \c
.qs
Logical-to-physical sector translation table located in the BIOS.
SECTRAN uses XLT to perform logical-to-physical sector number
translation. XLT also refers to the two-byte address in the disk
parameter header at DPBASE + 0. If this parameter is zero, no
sector translation takes place. Otherwise this parameter is the
address of the translation table.
.sp
.sh
ZERO PAGE: \c
.qs
See \c
.sh
page zero.
.qs
.sp 2
.ce
End of Appendix H
.nx appi


939
Source/Doc/CPM 22 Manual - Testing/appi.tex

@ -1,939 +0,0 @@
.bp 1
.op
.cs 5
.mt 5
.mb 6
.pl 66
.ll 65
.po 10
.hm 2
.fm 2
.he
.ft I-%
.pc 1
.tc I CP/M Error Messages
.ce 2
.sh
Appendix I
.sp
.sh
CP/M Error Messages
.qs
.he CP/M Operating System Manual I CP/M Error Messages
.sp 2
.pp
Messages come from several different sources. CP/M displays
error messages when there are errors in calls to the Basic Disk
Operating System (BDOS). CP/M also displays messages when there
are errors in command lines. Each utility supplied with CP/M has
its own set of messages. The following lists CP/M messages and
utility messages. One might see messages other than those listed
here if one is running an application program. Check the
application program's documentation for explanations of those
messages.
.sp 2
.sh
Table I-1. CP/M Error Messages
.sp
.ll 60
.nf
Message Meaning
.sp
.fi
.in 20
.ti -15
?
.sp
DDT. This message has four possible meanings:
.sp
.in 23
.ti -2
o DDT does not understand the assembly language instruction.
.ti -2
o The file cannot be opened.
.ti -2
o A checksum error occurred in a HEX file.
.ti -2
o The assembler/disassembler was overlayed.
.sp 2
.in 20
.ti -15
ABORTED
.sp
PIP. You stopped a PIP operation by pressing a key.
.sp 2
.ti -15
ASM Error Messages
.sp
.in 24
.ti -4
D Data error: data statement element cannot be placed in
specified data area.
.sp
.ti -4
E Expression error: expression cannot be evaluated during
assembly.
.sp
.ti -4
L Label error: label cannot appear in this context (might be
duplicate label).
.in 0
.bp
.sh
Table I-1. (continued)
.sp
.nf
Message Meaning
.sp
ASM Error Messages (continued)
.fi
.sp
.in 24
.ti -4
N Not implemented: unimplemented features, such as macros, are
trapped.
.sp
.ti -4
O Overflow: expression is too complex to evaluate.
.sp
.ti -4
P Phase error: label value changes on two passes through
assembly.
.sp
.ti -4
R Register error: the value specified as a register is
incompatible with the code.
.sp
.ti -4
S Syntax error: improperly formed expression.
.sp
.ti -4
U Undefined label: label used does not exist.
.sp
.ti -4
V Value error: improperly formed operand encountered in an
expression.
.sp 2
.in 20
.ti -15
BAD DELIMITER
.sp
STAT. Check command line for typing errors.
.sp 2
.ti -15
Bad Load
.sp
CCP error message, or SAVE error message.
.sp 2
.ti -15
Bdos Err On d:
.sp
Basic Disk Operating System error on the designated drive: CP/M
replaces d: with the drive specification of the drive where the
error occurred. This message is followed by one of the four
phrases in the situations described below.
.in 0
.bp
.sh
Table I-1. (continued)
.sp
.nf
Message Meaning
.fi
.sp
.in 20
.ti -15
Bdos Err On d: Bad Sector
.sp
This message appears when CP/M finds no disk in the drive, when
the disk is improperly formatted, when the drive latch is open,
or when power to the drive is off. Check for one of these
situations and try again. This could also indicate a hardware
problem or a worn or improperly formatted disk. Press ^C to
terminate the program and return to CP/M, or press RETURN
to ignore the error.
.sp 2
.ti -15
Bdos Err On d: File R/O
.sp
You tried to erase, rename, or set file attributes on a Read-Only
file. The file should first be set to Read-Write (R/W) with the
command: STAT filespec $R/W.
.sp 2
.ti -15
Bdos Err On d: R/O
.sp
Drive has been assigned Read-Only status with a STAT command, or
the disk in the drive has been changed without being initialized
with a ^C. CP/M terminates the current program as soon as you
press any key.
.sp 2
.ti -15
Bdos Err on d: Select
.sp
CP/M received a command line specifying a nonexistent drive.
CP/M terminates the current program as soon as you press any key.
Press RETURN or CTRL-C to recover.
.sp 2
.ti -15
Break "x" at c
.sp
ED. "x" is one of the symbols described below and c is the
command letter being executed when the error occurred.
.sp
.in 24
.ti -4
# Search failure. ED cannot find the string specified in an F,
S, or N command.
.in 0
.bp
.sh
Table I-1. (continued)
.sp
.nf
Message Meaning
.fi
.sp
.in 24
.ti -4
? Unrecognized command letter c. ED does not recognize the
indicated command letter, or an E, H, Q, or O command is not
alone on its command line.
.sp
.ti -4
O The file specified in an R command cannot be found.
.sp
.ti -4
> Buffer full. ED cannot put any more characters in the memory
buffer, or the string specified in an F, N, or S command is too
long.
.sp
.ti -4
E Command aborted. A keystroke at the console aborted command
execution.
.sp
Break "x" at c (continued)
.sp
.ti -4
F Disk or directory full. This error is followed by either the
disk or directory full message. Refer to the recovery procedures
listed under these messages.
.sp 2
.in 20
.ti -15
CANNOT CLOSE DESTINATION FILE--\\{filespec\\}
.sp
PIP. An output file cannot be closed. You should take
appropriate action after checking to see if the correct disk is
in the drive and that the disk is not write-protected.
.sp 2
.nf
.in 5
Cannot close, R/O
CANNOT CLOSE FILES
.fi
.in 20
.sp
CP/M cannot write to the file. This usually occurs because the
disk is write-protected.
.sp
ASM. An output file cannot be closed. This is a fatal error
that terminates ASM execution. Check to see that the disk is in
the drive, and that the disk is not write-protected.
.in 0
.bp
.sh
Table I-1. (continued)
.sp
.nf
Message Meaning
.fi
.sp
.in 20
DDT. The disk file written by a W command cannot be closed.
This is a fatal error that terminates DDT execution. Check if
the correct disk is in the drive and that the disk is not write-protected.
.sp
SUBMIT. This error can occur during SUBMIT file processing.
Check if the correct system disk is in the A drive and that the
disk is not write-protected. The SUBMIT job can be restarted
after rebooting CP/M.
.sp 2
.ti -15
CANNOT READ
.sp
PIP. PIP cannot read the specified source. Reader cannot be
implemented.
.sp 2
.ti -15
CANNOT WRITE
.sp
PIP. The destination specified in the PIP command is illegal.
You probably specified an input device as a destination.
.sp 2
.ti -15
Checksum error
.sp
PIP. A HEX record checksum error was encountered. The HEX
record that produced the error must be corrected, probably by
recreating the HEX file.
.sp 2
.nf
.in 5
CHECKSUM ERROR
LOAD ADDRESS hhhh
ERROR ADDRESS hhhh
BYTES READ:
hhhh:
.fi
.in 20
.sp
LOAD. File contains incorrect data. Regenerate HEX file from
the source.
.sp 2
.ti -15
Command Buffer Overflow
.sp
SUBMIT. The SUBMIT buffer allows up to 2048 characters in the
input file.
.in 0
.bp
.sh
Table I-1. (continued)
.sp
.nf
Message Meaning
.fi
.sp
.in 20
.ti -15
Command too long
.sp
SUBMIT. A command in the SUBMIT file cannot exceed 125
characters.
.sp 2
.ti -15
CORRECT ERROR, TYPE RETURN OR CTRL-Z
.sp
PIP. A HEX record checksum was encountered during the transfer
of a HEX file. The HEX file with the checksum error should be
corrected, probably by recreating the HEX file.
.sp 2
.ti -15
DESTINATION IS R/O, DELETE (Y/N)?
.sp
PIP. The destination file specified in a PIP command already
exists and it is Read-Only. If you type Y, the destination file
is deleted before the file copy is done.
.sp 2
.ti -15
Directory full
.sp
ED. There is not enough directory space for the file being
written to the destination disk. You can use the OXfilespec
command to erase any unnecessary files on the disk without
leaving the editor.
.sp
SUBMIT. There is not enough directory space to write the $$$.SUB
file used for processing SUBMITs. Erase some files or select a
new disk and retry.
.sp 2
.ti -15
Disk full
.sp
ED. There is not enough disk space for the output file. This
error can occur on the W, E, H, or X commands. If it occurs with
X command, you can repeat the command prefixing the filename with
a different drive.
.in 0
.bp
.sh
Table I-1. (continued)
.sp
.nf
Message Meaning
.fi
.sp
.in 20
.ti -15
DISK READ ERROR--\\{filespec\\}
.sp
PIP. The input disk file specified in a PIP command cannot be
read properly. This is usually the result of an unexpected end-of-file.
Correct the problem in your file.
.sp 2
.ti -15
DISK WRITE ERROR--\\{filespec\\}
.sp
DDT. A disk write operation cannot be successfully performed
during a W command, probably due to a full disk. You should
either erase some unnecessary files or get another disk with more
space.
.sp
PIP. A disk write operation cannot be successfully performed
during a PIP command, probably due to a full disk. You should
either erase some unnecessary files or get another disk with more
space and execute PIP again.
.sp
SUBMIT. The SUBMIT program cannot write the $$$.SUB file to the
disk. Erase some files, or select a new disk and try again.
.sp 2
.ti -15
ERROR: BAD PARAMETER
.sp
PIP. You entered an illegal parameter in a PIP command. Retype
the entry correctly.
.sp 2
.ti -15
ERROR: CANNOT OPEN SOURCE, LOAD ADDRESS hhhh
.sp
LOAD. Displayed if LOAD cannot find the specified file or if no
filename is specified.
.sp 2
.ti -15
ERROR: CANNOT CLOSE FILE, LOAD ADDRESS hhhh
.sp
LOAD. Caused by an error code returned by a BDOS function call.
Disk might be write-protected.
.in 0
.bp
.sh
Table I-1. (continued)
.sp
.nf
Message Meaning
.fi
.sp
.in 20
.ti -15
ERROR: CANNOT OPEN SOURCE, LOAD ADDRESS hhhh
.sp
LOAD. Cannot find source file. Check disk directory.
.sp 2
.ti -15
ERROR: DISK READ, LOAD ADDRESS hhhh
.sp
LOAD. Caused by an error code returned by a BDOS function call.
.sp 2
.ti -15
ERROR: DISK WRITE, LOAD ADDRESS hhhh
.sp
LOAD. Destination disk is full.
.sp 2
.ti -15
ERROR: INVERTED LOAD ADDRESS, LOAD ADDRESS hhhh
.sp
LOAD. The address of a record was too far from the address of
the previously-processed record. This is an internal limitation
of LOAD, but it can be circumvented. Use DDT to read the HEX
file into memory, then use a SAVE command to store the memory
image file on disk.
.sp 2
.ti -15
ERROR: NO MORE DIRECTORY SPACE, LOAD ADDRESS hhhh
.sp
LOAD. Disk directory is full.
.sp 2
.ti -15
Error on line nnn message
.sp
SUBMIT. The SUBMIT program displays its messages in the format
shown above, where nnn represents the line number of the SUBMIT
file. Refer to the message following the line number.
.sp 2
.ti -15
FILE ERROR
.sp
ED. Disk or directory is full, and ED cannot write anything more
on the disk. This is a fatal error, so make sure there is enough
space on the disk to hold a second copy of the file before
invoking ED.
.in 0
.bp
.sh
Table I-1. (continued)
.sp
.nf
Message Meaning
.fi
.sp
.in 20
.ti -15
FILE EXISTS
.sp
You have asked CP/M to create or rename a file using a file
specification that is already assigned to another file. Either
delete the existing file or use another file specification.
.sp
REN. The new name specified is the name of a file that already
exists. You cannot rename a file with the name of an existing
file. If you want to replace an existing file with a newer
version of the same file, either rename or erase the existing
file, or use the PIP utility.
.sp 2
.ti -15
File exists, erase it
.sp
ED. The destination filename already exists when you are placing
the destination file on a different disk than the source. It
should be erased or another disk selected to receive the output
file.
.sp 2
.ti -15
** FILE IS READ/ONLY **
.sp
ED. The file specified in the command to invoke ED has the
Read-Only attribute. Ed can read the file so that the user can
examine it, but ED cannot change a Read-Only file.
.sp 2
.mb 4
.fm 1
.ti -15
File Not Found
.sp
CP/M cannot find the specified file. Check that you have entered
the correct drive specification or that you have the correct disk
in the drive.
.sp
ED. ED cannot find the specified file. Check that you have
entered the correct drive specification or that you have the
correct disk in the drive.
.sp
STAT. STAT cannot find the specified file. The message might
appear if you omit the drive specification. Check to see if the
correct disk is in the drive.
.in 0
.bp
.sh
Table I-1. (continued)
.sp
.nf
Message Meaning
.fi
.sp
.in 20
.ti -15
FILE NOT FOUND--\\{filespec\\}
.sp
.mb 6
.fm 2
PIP. An input file that you have specified does not exist.
.sp 2
.ti -15
Filename required
.sp
ED. You typed the ED command without a filename. Reenter the ED
command followed by the name of the file you want to edit or
create.
.sp 2
.ti -15
hhhh??=dd
.sp
DDT. The ?? indicates DDT does not know how to represent the
hexadecimal value dd encountered at address hhhh in 8080 assembly
language. dd is not an 8080 machine instruction opcode.
.sp 2
.ti -15
Insufficient memory
.sp
DDT. There is not enough memory to load the file specified in an
R or E command.
.sp 2
.ti -15
Invalid Assignment
.sp
STAT. You specified an invalid drive or file assignment, or
misspelled a device name. This error message might be followed
by a list of the valid file assignments that can follow a
filename. If an invalid drive assignment was attempted the
message Use: d:=RO is displayed, showing the proper syntax for
drive assignments.
.in 0
.bp
.sh
Table I-1. (continued)
.sp
.nf
Message Meaning
.fi
.sp
.in 20
.ti -15
Invalid control character
.sp
SUBMIT. The only valid control characters in the SUBMIT files of
the type SUB are ^ A through ^ Z. Note that in a SUBMIT file the
control character is represented by typing the circumflex, ^, not
by pressing the control key.
.sp 2
.ti -15
INVALID DIGIT--\\{filespec\\}
.sp
PIP. An invalid HEX digit has been encountered while reading a
HEX file. The HEX file with the invalid HEX digit should be
corrected, probably by recreating the HEX file.
.sp 2
.ti -15
Invalid Disk Assignment
.sp
STAT. Might appear if you follow the drive specification with
anything except =R/O.
.sp 2
.ti -15
INVALID DISK SELECT
.sp
CP/M received a command line specifying a nonexistent drive, or
the disk in the drive is improperly formatted. CP/M terminates
the current program as soon as you press any key.
.sp 2
.ti -15
INVALID DRIVE NAME (Use A, B, C, or D)
.sp
SYSGEN. SYSGEN recognizes only drives A, B, C, and D as valid
destinations for system generation.
.sp 2
.ti -15
Invalid File Indicator
.sp
STAT. Appears if you do not specify RO, RW, DIR, or SYS.
.in 0
.bp
.sh
Table I-1. (continued)
.sp
.nf
Message Meaning
.fi
.sp
.in 20
.ti -15
INVALID FORMAT
.sp
PIP. The format of your PIP command is illegal. See the
description of the PIP command.
.sp 2
.nf
.in 5
INVALID HEX DIGIT
LOAD ADDRESS hhhh
ERROR ADDRESS hhhh
BYTES READ:
hhhh
.fi
.in 20
.sp
LOAD. File contains incorrect HEX digit.
.sp 2
.ti -15
INVALID MEMORY SIZE
.sp
MOVCPM. Specify a value less than 64K or your computer's actual
memory size.
.sp 2
.ti -15
INVALID SEPARATOR
.sp
PIP. You have placed an invalid character for a separator
between two input filenames.
.sp 2
.ti -15
INVALID USER NUMBER
.sp
PIP. You have specified a user number greater than 15. User
numbers are in the range 0 to 15.
.sp 2
.ti -15
n?
.sp
USER. You specified a number greater than fifteen for a user
area number. For example, if you type USER 18<cr>, the screen
displays 18?.
.in 0
.bp
.sh
Table I-1. (continued)
.sp
.nf
Message Meaning
.fi
.sp
.in 20
.ti -15
NO DIRECTORY SPACE
.sp
ASM. The disk directory is full. Erase some files to make room
for PRN and HEX files. The directory can usually hold only 64
filenames.
.sp 2
.ti -15
NO DIRECTORY SPACE--\\{filespec\\}
.sp
PIP. There is not enough directory space for the output file.
You should either erase some unnecessary files or get another
disk with more directory space and execute PIP again.
.sp 2
.ti -15
NO FILE--\\{filespec\\}
.sp
DIR, ERA, REN, PIP. CP/M cannot find the specified file, or no
files exist.
.sp
ASM. The indicated source or include file cannot be found on the
indicated drive.
.sp
DDT. The file specified in an R or E command cannot be found on
the disk.
.sp 2
.ti -15
NO INPUT FILE PRESENT ON DISK
.sp
DUMP. The file you requested does not exist.
.sp 2
.ti -15
No memory
.sp
There is not enough (buffer?) memory available for loading the
program specified.
.sp 2
.ti -15
NO SOURCE FILE ON DISK
.sp
SYSGEN. SYSGEN cannot find CP/M either in CPMxx.com form or on
the system tracks of the source disk.
.in 0
.bp
.sh
Table I-1. (continued)
.sp
.nf
Message Meaning
.fi
.sp
.in 20
.ti -15
NO SOURCE FILE PRESENT
.sp
ASM. The assembler cannot find the file you specified. Either
you mistyped the file specification in your command line, or the
filetype is not ASM.
.sp 2
.ti -15
NO SPACE
.sp
SAVE. Too many files are already on the disk, or no room is left
on the disk to save the information.
.sp 2
.ti -15
No SUB file present
.sp
SUBMIT. For SUBMIT to operate properly, you must create a file
with filetype of SUB. The SUB file contains usual CP/M commands.
Use one command per line.
.sp 2
.ti -15
NOT A CHARACTER SOURCE
.sp
PIP. The source specified in your PIP command is illegal. You
have probably specified an output device as a source.
.sp 2
.ti -15
** NOT DELETED **
.sp
PIP. PIP did not delete the file, which might have had the R/O
attribute.
.sp 2
.ti -15
NOT FOUND
.sp
PIP. PIP cannot find the specified file.
.sp 2
.ti -15
OUTPUT FILE WRITE ERROR
.sp
ASM. You specified a write-protected disk as the destination for
the PRN and HEX files, or the disk has no space left. Correct
the problem before assembling your program.
.in 0
.bp
.sh
Table I-1. (continued)
.sp
.nf
Message Meaning
.fi
.sp
.in 20
.ti -15
Parameter error
.sp
SUBMIT. Within the SUBMIT file of type sub, valid parameters are
$0 through $9.
.sp 2
.ti -15
PARAMETER ERROR, TYPE RETURN TO IGNORE
.sp
SYSGEN. If you press RETURN, SYSGEN proceeds without processing
the invalid parameter.
.sp 2
.ti -15
QUIT NOT FOUND
.sp
PIP. The string argument to a Q parameter was not found in your
input file.
.sp 2
.ti -15
Read error
.sp
TYPE. An error occurred when reading the file specified in the
type command. Check the disk and try again. The STAT filespec
command can diagnose trouble.
.sp 2
.ti -15
READER STOPPING
.sp
PIP. Reader operation interrupted.
.sp 2
.ti -15
Record Too Long
.sp
PIP. PIP cannot process a record longer than 128 bytes.
.sp 2
.ti -15
Requires CP/M 2.0 or later
.sp
XSUB. XSUB requires the facilities of CP/M 2.0 or newer version.
.in 0
.bp
.sh
Table I-1. (continued)
.sp
.nf
Message Meaning
.fi
.sp
.in 20
.ti -15
Requires CP/M 2.0 or new for operation
.sp
PIP. This version of PIP requires the facilities of CP/M 2.0 or
newer version.
.sp 2
.ti -15
START NOT FOUND
.sp
PIP. The string argument to an S parameter cannot be found in
the source file.
.sp 2
.ti -15
SOURCE FILE INCOMPLETE
.sp
SYSGEN. SYSGEN cannot use your CP/M source file.
.sp 2
.ti -15
SOURCE FILE NAME ERROR
.sp
ASM. When you assemble a file, you cannot use the wildcard
characters * and ? in the filename. Only one file can be
assembled at a time.
.sp 2
.ti -15
SOURCE FILE READ ERROR
.sp
ASM. The assembler cannot understand the information in the file
containing the assembly-language program. Portions of another
file might have been written over your assembly-language file, or
information was not properly saved on the disk. Use the TYPE
command to locate the error. Assembly-language files contain the
letters, symbols, and numbers that appear on your keyboard. If
your screen displays unrecognizable output or behaves strangely,
you have found where computer instructions have crept into your
file.
.sp 2
.ti -15
SYNCHRONIZATION ERROR
.sp
MOVCPM. The MOVCPM utility is being used with the wrong CP/M
system.
.in 0
.bp
.sh
Table I-1. (continued)
.sp
.nf
Message Meaning
.fi
.sp
.in 20
.ti -15
"SYSTEM" FILE NOT ACCESSIBLE
.sp
You tried to access a file set to SYS with the STAT command.
.sp 2
.ti -15
** TOO MANY FILES **
.sp
STAT. There is not enough memory for STAT to sort the files
specified, or more than 512 files were specified.
.sp 2
.ti -15
UNEXPECTED END OF HEX FILE--\\{filespec\\}
.sp
PIP. An end-of-file was encountered prior to a termination HEX
record. The HEX file without a termination record should be
corrected, probably by recreating the HEX file.
.sp 2
.ti -15
Unrecognized Destination
.sp
PIP. Check command line for valid destination.
.sp 2
.ti -15
Use: STAT d:=RO
.sp
STAT. An invalid STAT drive command was given. The only valid
drive assignment in STAT is STAT d:=RO.
.sp 2
.ti -15
VERIFY ERROR:--\\{filespec\\}
.sp
PIP. When copying with the V option, PIP found a difference when
rereading the data just written and comparing it to the data in
its memory buffer. Usually this indicates a failure of either
the destination disk or drive.
.sp 2
.ti -15
WRONG CP/M VERSION (REQUIRES 2.0)
.sp 2
.ti -15
XSUB ACTIVE
.sp
SUBMIT. XSUB has been invoked.
.in 0
.bp
.sh
Table I-1. (continued)
.sp
.nf
Message Meaning
.fi
.sp
.in 20
.ti -15
XSUB ALREADY PRESENT
.sp
SUBMIT. XSUB is already active in memory.
.sp
.ti -15
Your input?
.sp
If CP/M cannot find the command you specified, it returns the
command name you entered followed by a question mark. Check that
you have typed the command line correctly, or that the command
you requested exists as a .COM file on the default or specified
disk.
.in 0
.ll 65
.sp 2
.ce
End of Appendix I


BIN
Source/Doc/CPM 22 Manual - Testing/cpm22tex.zip

Binary file not shown.

670
Source/Doc/CPM 22 Manual - Testing/fivea.tex

@ -1,670 +0,0 @@
.bp 1
.op
.cs 5
.mt 5
.mb 6
.pl 66
.ll 65
.po 10
.hm 2
.fm 2
.he
.ft 5-%
.pc 1
.ce
.sh
Section 5
.qs
.sp
.ce
.sh
CP/M 2 System Interface
.qs
.tc 5 CP/M 2 System Interface
.sp 2
.he CP/M Operating System Manual 5.1 Introduction
.tc 5.1 Introduction
5.1 Introduction
.pp 5
This chapter describes CP/M (release 2) system organization including the
structure of memory and system entry points. This section provides
the information you need to write programs that operate under CP/M and
that use the peripheral and disk I/O facilities of the system.
.pp
CP/M is logically divided into four parts, called the Basic Input/Output
System (BIOS), the Basic Disk Operating System (BDOS), the Console Command
Processor (CCP), and the Transient Program Area (TPA). The BIOS is a
hardware-dependent module that defines the exact low level interface with a
particular computer system that is necessary for peripheral device I/O.
Although a standard BIOS is supplied by Digital Research, explicit
instructions are provided for field reconfiguration of the BIOS to match
nearly any hardware environment, see Section 6.
.pp
The BIOS and BDOS are
logically combined into a single module with a common entry point and
referred to as the FDOS. The CCP is a distinct program that uses the FDOS to
provide a human-oriented interface with the information that is cataloged on
the back-up storage device. The TPA is an area of memory,
not used by the FDOS and CCP, where various nonresident operating
system commands and user programs are executed. The lower portion of memory
is reserved for system information and is detailed in later sections. Memory
organization of the CP/M system is shown in Figure 5-1.
.sp 3
.nf
High
Memory FDOS (BDOS+BIOS)
FBASE:
CCP
CBASE:
TPA
TBASE:
System Parameters
BOOT:
.sp 2
.ce
.sh
Figure 5-1. CP/M Memory Organization
.qs
.fi
.sp 2
.pp
The exact memory addresses corresponding to BOOT, TBASE, CBASE, and FBASE
vary from version to version and are described fully in Section 6. All
standard CP/M versions assume BOOT=0000H, which is the base of
random access memory. The machine code found at location BOOT performs a
system warm start, which loads and initializes the programs and variables
necessary to return control to the CCP. Thus, transient programs need only
jump to location BOOT to return control to CP/M at the command level.
Further, the standard versions assume TBASE=BOOT+0100H, which is normally
location 0100H. The principal entry point to the FDOS is at location
BOOT+0005H (normally 0005H) where a jump to FBASE is found. The address
field at BOOT+0006H (normally 0006H) contains the value of FBASE and can be
used to determine the size of available memory, assuming that the CCP is
being overlaid by a transient program.
.pp
Transient programs are loaded into the TPA and executed as follows. The
operator communicates with the CCP by typing command lines following each
prompt. Each command line takes one of the following forms:
.sp
.nf
.in 8
command
command file1
command file1 file2
.fi
.in 0
.sp
where command is either a built-in function, such as DIR or TYPE, or the name
of a transient command or program. If the command is a built-in function of
CP/M, it is executed immediately. Otherwise, the CCP searches the currently
addressed disk for a file by the name
.sp
.ti 8
command.COM
.pp
If the file is found, it is assumed to be a memory image of a program that
executes in the TPA and thus implicity originates at TBASE in memory. The
CCP loads the COM file from the disk into memory starting at TBASE and can
extend up to CBASE.
.pp
If the command is followed by one or two file specifications, the CCP prepares
one or two File Control Block (FCB) names in the system
parameter area. These optional FCBs are in the form necessary to
access files through the FDOS and are described in Section 5.2.
.pp
The transient program receives control from the CCP and begins
execution, using the I/O facilities of the FDOS. The transient
program is called from the CCP. Thus, it can simply return to the CCP upon
completion of its processing, or can jump to BOOT to pass control back to
CP/M. In the first case, the transient program must not use memory above
CBASE, while in the latter case, memory up through FBASE-1 can be used.
.pp
The transient program can use the CP/M I/O facilities to communicate with the
operator's console and peripheral devices, including the disk subsystem. The
I/O system is accessed by passing a function number and an information address
to CP/M through the FDOS entry point at BOOT+0005H. In the case of a disk
read, for example, the transient program sends the number corresponding to a
disk read, along with the address of an FCB to the CP/M FDOS. The FDOS, in
turn, performs the operation and returns with either a disk read completion
indication or an error number indicating that the disk read was unsuccessful.
.sp 2
.tc 5.2 Operating System Call Conventions
.he CP/M Operating System Manual 5.2 Call Conventions
.sh
5.2 Operating System Call Conventions
.qs
.pp
This section provides detailed information for performing direct operating
system calls from user programs. Many of the functions listed below, however,
are accessed more simply through the I/O macro library provided with the
MAC macro assembler and listed in the Digital Research manual
entitled, \c
.ul
Programmer's Utilities Guide for the CP/M Family of Operating Systems.
.qu
.pp
CP/M facilities that are available for access by transient programs fall into
two general categories: simple device I/O and disk file I/O. The simple
device operations are
.sp
.nf
.in 5
.ti -2
o read a console character
.ti -2
o write a console character
.ti -2
o read a sequential character
.ti -2
o write a sequential character
.ti -2
o get or set I/O status
.ti -2
o print console buffer
.ti -2
o interrogate console ready
.sp
The following FDOS operations perform disk I/O:
.sp
.ti -2
o disk system reset
.ti -2
o drive selection
.ti -2
o file creation
.ti -2
o file close
.ti -2
o directory search
.ti -2
o file delete
.ti -2
o file rename
.ti -2
o random or sequential read
.ti -2
o random or sequential write
.ti -2
o interrogate available disks
.ti -2
o interrogate selected disk
.ti -2
o set DMA address
.ti -2
o set/reset file indicators.
.fi
.in 0
.pp
As mentioned above, access to the FDOS functions is accomplished by passing
a function number and information address through the primary point at
location BOOT+0005H. In general, the function number is passed in register C
with the information address in the double byte pair DE. Single byte values
are returned in register A, with double byte values returned in HL, a zero
value is returned when the function number is out of range. For reasons of
compatibility, register A = L and register B = H upon return in all cases.
Note that the register passing conventions of CP/M agree with
those of the Intel PL/M systems programming language. CP/M functions and
their numbers are listed below.
.bp
.nf
.in 5
O System Reset 19 Delete File
1 Console Input 20 Read Sequential
2 Console Output 21 Write Sequential
3 Reader Input 22 Make File
4 Punch Output 23 Rename File
5 List Output 24 Return Login Vector
6 Direct Console I/O 25 Return Current Disk
7 Get I/O Byte 26 Set DMA Address
8 Set I/O Byte 27 Get Addr(Alloc)
9 Print String 28 Write Protect Disk
10 Read Console Buffer 29 Get R/0 Vector
11 Get Console Status 30 Set File Attributes
12 Return Version Number 31 Get Addr(Disk Parms)
13 Reset Disk System 32 Set/Get User Code
14 Select Disk 33 Read Random
15 Open File 34 Write Random
16 Close File 35 Compute File Size
17 Search for First 36 Set Random Record
18 Search for Next 37 Reset Drive
40 Write Random with Zero Fill
.fi
.in 0
.sp
.pp
Functions 28 and 32 should be avoided in application programs to
maintain upward compatibility with CP/M.
.pp
Upon entry to a transient program, the CCP leaves the stack
pointer set to an eight-level stack area with the CCP return
address pushed onto the stack, leaving seven levels before
overflow occurs. Although this stack is usually not used by a
transient program (most transients return to the CCP
through a jump to location 0000H) it is large enough to
make CP/M system calls because the FDOS switches to a local stack
at system entry. For example, the assembly-language program segment below
reads characters continuously until an asterisk is
encountered, at which time control returns to the CCP, assuming a
standard CP/M system with BOOT = 0000H.
.sp 2
.nf
.in 8
BDOS EQU 0005H ;STANDARD CP/M ENTRY
CONIN EQU 1 ;CONSOLE INPUT FUNCTION
;
ORG 0100H ;BASE OF TPA
NEXTC: MVI C,CONIN ;READ NEXT CHARACTER
CALL BDOS ;RETURN CHARACTER IN <A>
CPI '*' ;END OF PROCESSING?
JNZ NEXTC ;LOOP IF NOT
RET ;RETURN TO CCP
END
.fi
.in 0
.sp
.pp
CP/M implements a named file structure on each disk, providing a
logical organization that allows any particular file to contain
any number of records from completely empty to the full capacity
of the drive. Each drive is logically distinct with a disk
directory and file data area. The disk filenames are in three
parts: the drive select code, the filename (consisting of one to
eight nonblank characters), and the filetype (consisting of zero
to three nonblank characters). The filetype names the generic
category of a particular file, while the filename distinguishes
individual files in each category. The filetypes listed in Table 5-1
name a few generic categories that have been established,
although they are somewhat arbitrary.
.sp 2
.sh
Table 5-1. CP/M Filetypes
.qs
.sp
.nf
Filetype Meaning
.sp
.in 30
.ti -11
ASM Assembler Source
.ti -11
PRN Printer Listing
.ti -11
HEX Hex Machine Code
.ti -11
BAS Basic Source File
.ti -11
INT Intermediate Code
.ti -11
COM Command File
.ti -11
PLI PL/I Source File
.ti -11
REL Relocatable Module
.ti -11
TEX TEX Formatter Source
.ti -11
BAK ED Source Backup
.ti -11
SYM SID Symbol File
.ti -11
$$$ Temporary File
.fi
.in 0
.sp
.pp
Source files are treated as a sequence of ASCII characters, where
each line of the source file is followed by a carriage return, and
line-feed sequence (0DH followed by 0AH). Thus, one 128-byte CP/M
record can contain several lines of source text. The end of an
ASCII file is denoted by a CTRL-Z character (1AH) or a real
end-of-file returned by the CP/M read operation. CTRL-Z characters embedded
within machine code files (for example, COM files) are ignored and
the end-of-file condition returned by CP/M is used to terminate
read operations.
.pp
Files in CP/M can be thought of as a sequence of up to 65536
records of 128 bytes each, numbered from 0 through 65535, thus
allowing a maximum of 8 megabytes per file. Note, however,
that although the records may be considered logically
contiguous, they may not be physically contiguous in the disk
data area. Internally, all files are divided into 16K byte
segments called logical extents, so that counters are easily
maintained as 8-bit values. The division into extents is
discussed in the paragraphs that follow: however, they are not
particularly significant for the programmer, because each extent is
automatically accessed in both sequential and random access
modes.
.pp
In the file operations starting with Function 15, DE
usually addresses a FCB. Transient programs
often use the default FCB area reserved by CP/M at
location BOOT+005CH (normally 005CH) for simple file operations.
The basic unit of file information is a 128-byte record used for
all file operations. Thus, a default location for disk I/O is
provided by CP/M at location BOOT+0080H (normally 0080H) which
is the initial default DMA address. See Function 26.
.pp
All directory operations take place in a reserved area that does not
affect write buffers as was the case in release 1, with the
exception of Search First and Search Next, where compatibility is
required.
.pp
The FCB data area consists of a sequence of 33 bytes for
sequential access and a series of 36 bytes in the case when the
file is accessed randomly. The default FCB, normally located at
005CH, can be used for random access files, because the three bytes
starting at BOOT+007DH are available for this purpose. Figure 5-2 shows
the FCB format with the following fields.
.sp 3
.nf
dr f1 f2 / / f8 t1 t2 t3 ex s1 s2 rc d0 / / dn cr r0 r1 r2
00 01 02 ... 08 09 10 11 12 13 14 15 16 ... 31 32 33 34 35
.fi
.sp 2
.sh
Figure 5-2. File Control Block Format
.sp 3
The following table lists and describes each of the fields in the File Control
Block figure.
.sp 2
.sh
Table 5-2. File Control Block Fields
.nf
.sp
Field Definition
.sp
dr drive code (0-16)
0 = use default drive for file
1 = auto disk select drive A,
2 = auto disk select drive B,
.
.
.
16= auto disk select drive P.
.sp
f1...f8 contain the filename in ASCII
upper-case, with high bit = 0
.sp
t1, t2, t3 contain the filetype in ASCII
upper-case, with high bit = 0
t1', t2', and t3' denote the
bit of these positions,
t1' = 1 =>Read-Only file,
t2' = 1 =>SYS file, no DIR list
.sp
ex contains the current extent
number, normally set to 00 by
the user, but in range 0-31
during file I/O
.bp
.sh
Table 5-2. (continued)
.qs
.sp
Field Definition
.sp
s1 reserved for internal system use
.sp
s2 reserved for internal system use,
set to zero on call to OPEN, MAKE,
SEARCH
.sp
rc record count for extent ex;
takes on values from 0-127
.sp
d0...dn filled in by CP/M; reserved for
system use
.sp
cr current record to read or write in
a sequential file operation;
normally set to zero by user
.sp
r0, r1, r2 optional random record number in
the range 0-65535, with overflow
to r2, r0, r1 constitute a 16-bit
value with low byte r0, and high
byte r1
.fi
.sp
.pp
Each file being accessed through CP/M must have a corresponding
FCB, which provides the name and allocation information for all
subsequent file operations. When accessing files, it is the
programmer's responsibility to fill the lower 16 bytes of the FCB
and initialize the cr field. Normally, bytes 1 through 11 are
set to the ASCII character values for the filename and filetype,
while all other fields are zero.
.pp
FCBs are stored in a directory area of the disk, and are brought
into central memory before the programmer proceeds with file
operations (see the OPEN and MAKE functions). The memory copy of
the FCB is updated as file operations take place and later
recorded permanently on disk at the termination of the file
operation, (see the CLOSE command).
.pp
The CCP constructs the first 16 bytes of two optional FCBs for a
transient by scanning the remainder of the line following the
transient name, denoted by file1 and file2 in the prototype
command line described above, with unspecified fields set to
ASCII blanks. The first FCB is constructed at location
BOOT+005CH and can be used as is for subsequent file operations.
The second FCB occupies the d0...dn portion of the first FCB and
must be moved to another area of memory before use. If, for
example, the following command line is typed:
.sp
.ti 8
PROGNAME B:X.ZOT Y.ZAP
.bp
the file PROGNAME.COM is loaded into the TPA, and the default FCB
at BOOT+005CH is initialized to drive code 2, filename X, and
filetype ZOT. The second drive code takes the default value 0,
which is placed at BOOT-006CH, with the filename Y placed into
location BOOT+006DH and filetype ZAP located 8 bytes later at
BOOT+0075H. All remaining fields through cr are set to zero.
Note again that it is the programmer's
responsibility to move this second filename and filetype to another
area, usually a separate file control block, before opening the
file that begins at BOOT+005CH, because the open operation
overwrites the second name and type.
.pp
If no filenames are specified in the original command, the
fields beginning at BOOT+005DH and BOOT+006DH contain blanks. In
all cases, the CCP translates lower-case alphabetics to upper-case
to be consistent with the CP/M file naming conventions.
.pp
As an added convenience, the default buffer area at location
BOOT+0080H is initialized to the command line tail typed by the
operator following the program name. The first position contains
the number of characters, with the characters themselves
following the character count. Given the above command line, the
area beginning at BOOT+0080H is initialized as follows:
.sp 2
.nf
.in 5
BOOT+0080H:
.sp
+00 +01 +02 +03 +04 +05 +06 +07 +08 +09 +A +B +C +D +E
E '' 'B' ':' 'X' '.' 'Z' 'O' 'T' '' 'Y' '.' 'Z' 'A' 'P'
.fi
.in 0
.sp 2
where the characters are translated to upper-case ASCII with
uninitialized memory following the last valid character. Again,
it is the responsibility of the programmer to extract the
information from this buffer before any file operations are
performed, unless the default DMA address is explicitly changed.
.pp
Individual functions are described in detail in the pages that
follow.
.bp
.sp 4
.nf
FUNCTION 0: SYSTEM RESET
.sp
Entry Parameters:
Register C: 00H
.fi
.sp 2
.pp
The System Reset function returns control to the CP/M operating
system at the CCP level. The CCP reinitializes the disk
subsystem by selecting and logging-in disk drive A. This
function has exactly the same effect as a jump to location BOOT.
.sp 6
.nf
FUNCTION 1: CONSOLE INPUT
.sp
Entry Parameters:
Register C: 01H
.sp
Returned Value:
Register A: ASCII Character
.fi
.sp 2
.pp
The Console Input function reads the next console character to
register A. Graphic characters, along with carriage return, line-feed,
and back space (CTRL-H) are echoed to the console. Tab
characters, CTRL-I, move the cursor to the next tab stop. A check
is made for start/stop scroll, CTRL-S, and start/stop printer echo,
CTRL-P. The FDOS does not return to the calling program until a
character has been typed, thus suspending execution if a
character is not ready.
.bp
.sp 4
.nf
FUNCTION 2: CONSOLE OUTPUT
.sp
Entry Parameters
Register C: 02H
Register E: ASCII Character
.fi
.sp 2
.pp
The ASCII character from register E is sent to the console
device. As in Function 1, tabs are expanded and checks are made
for start/stop scroll and printer echo.
.sp 6
.nf
FUNCTION 3: READER INPUT
.sp
Entry Parameters:
Register C: 03H
.sp
Returned Value:
Register A: ASCII Character
.fi
.sp 2
.pp
The Reader Input function reads the next character from the
logical reader into register A. See the IOBYTE definition in
Chapter 6. Control does not return until the character has been
read.
.bp
.sp 4
.nf
FUNCTION 4: PUNCH OUTPUT
.sp
Entry Parameters:
Register C: 04H
register E: ASCII Character
.fi
.sp 2
.pp
The Punch Output function sends the character from register E to
the logical punch device.
.sp 6
.nf
FUNCTION 5: LIST OUTPUT
.sp
Entry Parameters:
Register C: 05H
Register E: ASCII Character
.fi
.sp 2
.pp
The List Output function sends the ASCII character in register E
to the logical listing device.
.bp
.sp 4
.nf
FUNCTION 6: DIRECT CONSOLE I/O
.sp
Entry Parameters:
Register C: 06H
Register E: 0FFH (input) or
char (output)
.sp
Returned Value:
Register A: char or status
.fi
.sp 2
.pp
Direct Console I/O is supported under CP/M for those specialized
applications where basic console input and output are required.
Use of this function should, in general, be avoided since it
bypasses all of the CP/M normal control character functions (for example,
CTRL-S and CTRL-P). Programs that perform direct I/O
through the BIOS under previous releases of CP/M, however, should
be changed to use direct I/O under BDOS so that they can be fully
supported under future releases of MP/M \ and CP/M.
.pp
Upon entry to Function 6, register E either contains hexadecimal
FF, denoting a console input request, or an ASCII character. If
the input value is FF, Function 6 returns A = 00 if no character
is ready, otherwise A contains the next console input character.
.pp
If the input value in E is not FF, Function 6 assumes that E
contains a valid ASCII character that is sent to the console.
.pp
Function 6 must not be used in conjunction with other console I/O
functions.
.sp 6
.nf
FUNCTION 7: GET I/O BYTE
.sp
Entry Parameters:
Register C: 07H
.sp
Returned Value:
Register A: I/O Byte Value
.fi
.sp 2
.pp
The Get I/O Byte function returns the current value of IOBYTE in
register A. See Chapter 6 for IOBYTE definition.
.bp
.sp 4
.nf
FUNCTION 8: SET I/O BYTE
.sp
Entry Parameters:
Register C: 08H
Register E: I/O Byte Value
.fi
.sp 2
.pp
The SET I/O Byte function changes the IOBYTE value to that given
in register E.
.sp 6
.nf
FUNCTION 9: PRINT STRING
.sp
Entry Parameters:
Register C: 09H
Registers DE: String Address
.fi
.sp 2
.pp
The Print String function sends the character string stored in
memory at the location given by DE to the console device, until a
$ is encountered in the string. Tabs are expanded as in Function
2, and checks are made for start/stop scroll and printer echo.
.nx fiveb.tex


806
Source/Doc/CPM 22 Manual - Testing/fiveb.tex

@ -1,806 +0,0 @@
.cs 5
.mt 5
.mb 6
.pl 66
.ll 65
.po 10
.hm 2
.fm 2
.bp
.sp 4
.nf
FUNCTION 10: READ CONSOLE BUFFER
.sp
Entry Parameters:
Register C: 0AH
Registers DE: Buffer Address
.sp
Returned Value:
Console Characters in Buffer
.fi
.sp 2
.pp
The Read Buffer functions reads a line of edited console input
into a buffer addressed by registers DE. Console input is
terminated when either input buffer overflows or a carriage return
or line-feed is typed. The Read Buffer takes the form:
.sp
.nf
.in 8
DE:+0 +1 +2 +3 +4 +5 +6 +7 +8 . . .+n
.sp
mx nc c1 c2 c3 c4 c5 c6 c7 ... ??
.fi
.in 0
.sp
where mx is the maximum number of characters that the buffer will
hold, 1 to 255, and nc is the number of characters read (set by
FDOS upon return) followed by the characters read from the
console. If nc < mx, then uninitialized positions follow the
last character, denoted by ?? in the above figure. A number of
control functions, summarized in Table 5-3, are recognized during
line editing.
.sp 2
.sh
Table 5-3. Edit Control Characters
.sp
.nf
Character Edit Control Function
.sp
.fi
.in 8
rub/del removes and echoes the last character
.sp
CTRL-C reboots when at the beginning of line
.sp
CTRL-E causes physical end of line
.sp
CTRL-H backspaces one character position
.sp
CTRL-J (line feed) terminates input line
.sp
CTRL-M (return) terminates input line
.sp
CTRL-R retypes the current line after new line
.sp
CTRL-U removes current line
.sp
CTRL-X same as CTRL-U
.in 0
.sp 2
The user should also note that certain functions that return the
carriage to the leftmost position (for example, CTRL-X) do so only to the
column position where the prompt ended. In earlier releases, the
carriage returned to the extreme left margin. This convention
makes operator data input and line correction more legible.
.bp
.sp 4
.nf
FUNCTION 11: GET CONSOLE STATUS
.sp
Entry Parameters:
Register C: 0BH
.sp
Returned Value:
Register A: Console Status
.fi
.sp 2
.pp
The Console Status function checks to see if a character has been
typed at the console. If a character is ready, the value 0FFH is
returned in register A. Otherwise a 00H value is returned.
.sp 6
.nf
FUNCTION 12: RETURN VERSION NUMBER
.sp
Entry Parameters:
Register C: 0CH
.sp
Returned Value:
Registers HL: Version Number
.fi
.sp 2
.pp
Function 12 provides information that allows version independent
programming. A two-byte value is returned, with H = 00
designating the CP/M release (H = 01 for MP/M) and L = 00 for
all releases previous to 2.0. CP/M 2.0 returns a hexadecimal 20
in register L, with subsequent version 2 releases in the
hexadecimal range 21,22, through 2F. Using Function 12, for
example, the user can write application programs that provide
both sequential and random access functions.
.bp
.sp 4
.nf
FUNCTION 13: RESET DISK SYSTEM
.sp
Entry Parameters:
Register C: 0DH
.fi
.sp 2
.pp
The Reset Disk function is used to programmatically restore the
file system to a reset state where all disks are set to
Read-Write. See functions 28 and 29, only disk drive A is
selected, and the default DMA address is reset to BOOT+0080H.
This function can be used, for example, by an application program
that requires a disk change without a system reboot.
.sp 6
.nf
FUNCTION 14: SELECT DISK
.sp
Entry Parameters:
Register C: 0EH
Register E: Selected Disk
.fi
.sp 2
.pp
The Select Disk function designates the disk drive named in register
E as the default disk for subsequent file operations, with E = O
for drive A, 1 for drive B, and so on through 15, corresponding to drive
P in a full 16 drive system. The drive is placed in an on-line
status, which activates its directory until the next cold start,
warm start, or disk system reset operation. If the disk medium
is changed while it is on-line, the drive automatically goes to
a Read-Only status in a standard CP/M environment, see Function
28. FCBs that specify drive code zero (dr = 00H) automatically
reference the currently selected default drive. Drive code
values between 1 and 16 ignore the selected default
drive and directly reference drives A through P.
.bp
.sp 4
.nf
FUNCTION 15: OPEN FILE
.sp
Entry Parameters:
Register C: 0FH
Registers DE: FCB Address
.sp
Returned Value:
Register A: Directory Code
.fi
.sp 2
.pp
The Open File operation is used to activate a file that currently
exists in the disk directory for the currently active user
number. The FDOS scans the referenced disk directory for a match
in positions 1 through 14 of the FCB referenced by DE (byte s1 is
automatically zeroed) where an ASCII question mark (3FH) matches
any directory character in any of these positions. Normally, no
question marks are included, and bytes ex and s2 of the FCB are
zero.
.pp
If a directory element is matched, the relevant directory
information is copied into bytes d0 through dn of FCB, thus
allowing access to the files through subsequent read and write
operations. The user should note that an existing file must not
be accessed until a successful open operation is completed. Upon
return, the open function returns a directory code with the value
0 through 3 if the open was successful or 0FFH (255 decimal) if
the file cannot be found. If question marks occur in the FCB,
the first matching FCB is activated. Note that the current
record, (cr) must be zeroed by the program if the file is to be
accessed sequentially from the first record.
.bp
.sp 4
.nf
FUNCTION 16: CLOSE FILE
.sp
Entry Parameters:
Register C: 10H
Registers DE: FCB Address
.sp
Returned Value:
Register A: Directory Code
.fi
.sp 2
.pp
The Close File function performs the inverse of the Open File
function. Given that the FCB addressed by DE has been previously
activated through an open or make function, the close function
permanently records the new FCB in the reference disk directory
see functions 15 and 22. The FCB matching process for the close
is identical to the open function. The directory code returned
for a successful close operation is 0, 1, 2, or 3, while a 0FFH
(255 decimal) is returned if the filename cannot be found in the
directory. A file need not be closed if only read operations
have taken place. If write operations have occurred, the close
operation is necessary to record the new directory information
permanently.
.bp
.sp 4
.nf
FUNCTION 17: SEARCH FOR FIRST
.sp
Entry Parameters:
Register C: 11H
Registers DE: FCB Address
.sp
Returned Value:
Register A: Directory Code
.fi
.sp 2
.pp
Search First scans the directory for a match with the file given
by the FCB addressed by DE. The value 255 (hexadecimal FF) is
returned if the file is not found; otherwise, 0, 1, 2, or 3 is
returned indicating the file is present. When the file is found,
the current DMA address is filled with the record containing the
directory entry, and the relative starting position is A *32
(that is, rotate the A register left 5 bits, or ADD A five times).
Although not normally required for application programs, the
directory information can be extracted from the buffer at this
position.
.pp
An ASCII question mark (63 decimal, 3F hexadecimal) in any
position from f1 through ex matches the corresponding field of
any directory entry on the default or auto-selected disk drive.
If the dr field contains an ASCII question mark, the auto disk
select function is disabled and the default disk is searched,
with the search function returning any matched entry, allocated
or free, belonging to any user number. This latter function is
not normally used by application programs, but it allows complete
flexibility to scan all current directory values. If the dr
field is not a question mark, the s2 byte is automatically
zeroed.
.bp
.sp 4
.nf
FUNCTION 18: SEARCH FOR NEXT
.sp
Entry Parameters:
Register C: 12H
.sp
Returned Value:
Register A: Directory Code
.fi
.sp 2
.pp
The Search Next function is similar to the Search First function, except
that the directory scan continues from the last matched entry.
Similar to Function 17, Function 18 returns the decimal value 255
in A when no more directory items match.
.sp 6
.nf
FUNCTION 19: DELETE FILE
.sp
Entry Parameters:
Register C: 13H
Registers DE: FCB Address
.sp
Returned Value:
Register A: Directory Code
.fi
.sp 2
.pp
The Delete File function removes files that match the FCB
addressed by DE. The filename and type may contain ambiguous
references (that is, question marks in various positions), but the
drive select code cannot be ambiguous, as in the Search and
Search Next functions.
.pp
Function 19 returns a decimal 255 if the referenced file or files
cannot be found; otherwise, a value in the range 0 to 3 returned.
.bp
.sp 4
.nf
FUNCTION 20: READ SEQUENTIAL
.sp
Entry Parameters:
Register C: 14H
Registers DE: FCB Address
.sp
Returned Value:
Register A: Directory Code
.fi
.sp 2
.pp
Given that the FCB addressed by DE has been activated through an
Open or Make function, the Read Sequential function reads the
next 128-byte record from the file into memory at the current DMA
address. The record is read from position cr of the extent, and
the cr field is automatically incremented to the next record
position. If the cr field overflows, the next logical extent is
automatically opened and the cr field is reset to zero in
preparation for the next read operation. The value 00H is
returned in the A register if the read operation was successful,
while a nonzero value is returned if no data exist at the next
record position (for example, end-of-file occurs).
.sp 6
.nf
FUNCTION 21: WRITE SEQUENTAIL
.sp
Entry Parameters:
Register C: 15H
Registers DE: FCB Address
.sp
Returned Value:
Register A: Directory Code
.fi
.sp 2
.pp
Given that the FCB addressed by DE has been activated through an
Open or Make function, the Write Sequential
function writes the 128-byte data record at the current DMA
address to the file named by the FCB. The record is placed at
position cr of the file, and the cr field is automatically
incremented to the next record position. If the cr field
overflows, the next logical extent is automatically opened and
the cr field is reset to zero in preparation for the next write
operation. Write operations can take place into an existing
file, in which case, newly written records overlay those that
already exist in the file. Register A = 00H upon return from a
successful write operation, while a nonzero value indicates an
unsuccessful write caused by a full disk.
.bp
.sp 4
.nf
FUNCTION 22: MAKE FILE
.sp
Entry Parameters:
Register C: 16H
Registers DE: FCB Address
.sp
Returned Value:
Register A: Directory Code
.fi
.sp 2
.pp
The Make File operation is similar to the Open File operation
except that the FCB must name a file that does not exist in the
currently referenced disk directory (that is, the one named
explicitly by a nonzero dr code or the default disk if dr is
zero). The FDOS creates the file and initializes both the
directory and main memory value to an empty file. The programmer
must ensure that no duplicate filenames occur, and a preceding
delete operation is sufficient if there is any possibility of
duplication. Upon return, register A = 0, 1, 2, or 3 if the
operation was successful and 0FFH (255 decimal) if no more
directory space is available. The Make function has the side
effect of activating the FCB and thus a subsequent open is not
necessary.
.sp 6
.nf
FUNCTION 23: RENAME FILE
.sp
Entry Parameters:
Register C: 17H
Registers DE: FCB Address
.sp
Returned Value:
Register A: Directory Code
.fi
.sp 2
.pp
The Rename function uses the FCB addressed by DE to change all
occurrences of the file named in the first 16 bytes to the file
named in the second 16 bytes. The drive code dr at postion 0 is
used to select the drive, while the drive code for the new
filename at position 16 of the FCB is assumed to be zero. Upon
return, register A is set to a value between 0 and 3 if the
rename was successful and 0FFH (255 decimal) if the first
filename could not be found in the directory scan.
.bp
.sp 4
.nf
FUNCTION 24: RETURN LOG-IN VECTOR
.sp
Entry Parameters:
Register C: 18H
.sp
Returned Value:
Registers HL: Log-in Vector
.fi
.sp 2
.pp
The log-in vector value returned by CP/M is a 16-bit value in HL, where the
least significant bit of L corresponds to the first drive A and
the high-order bit of H corresponds to the sixteenth drive,
labeled P. A 0 bit indicates that the drive is not on-line,
while a 1 bit marks a drive that is actively on-line as a result
of an explicit disk drive selection or an implicit drive select
caused by a file operation that specified a nonzero dr field.
The user should note that compatibility is maintained with
earlier releases, because registers A and L contain the same values
upon return.
.sp 6
.nf
FUNCTION 25: RETURN CURRENT DISK
.sp
Entry Parameters:
Register C: 19H
.sp
Returned Value:
Register A: Current Disk
.fi
.sp 2
.pp
Function 25 returns the currently selected default disk number in
register A. The disk numbers range from 0 through 15
corresponding to drives A through P.
.bp
.sp 4
.nf
FUNCTION 26: SET DMA ADDRESS
.sp
Entry Parameters:
Register C: 1AH
Registers DE: DMA Address
.fi
.sp 2
.pp
DMA is an acronym for Direct Memory Address, which is often used
in connection with disk controllers that directly access the
memory of the mainframe computer to transfer data to and from the
disk subsystem. Although many computer systems use non-DMA
access (that is, the data is transferred through programmed I/O
operations), the DMA address has, in CP/M, come to mean the
address at which the 128-byte data record resides before a disk
write and after a disk read. Upon cold start, warm start, or
disk system reset, the DMA address is automatically set to
BOOT+0080H. The Set DMA function can be used to change
this default value to address another area of memory where the
data records reside. Thus, the DMA address becomes the value
specified by DE until it is changed by a subsequent Set DMA
function, cold start, warm start, or disk system reset.
.sp 6
.nf
FUNCTION 27: GET ADDR (ALLOC)
.sp
Entry Parameters:
Register C: 1BH
.sp
Returned Value:
Registers HL: ALLOC Address
.fi
.sp 2
.pp
An allocation vector is maintained in main memory for each on-
line disk drive. Various system programs use the information
provided by the allocation vector to determine the amount of
remaining storage (see the STAT program). Function 27 returns
the base address of the allocation vector for the currently
selected disk drive. However, the allocation information might be
invalid if the selected disk has been marked Read-Only. Although
this function is not normally used by application programs,
additional details of the allocation vector are found in Chapter
6.
.bp
.sp 4
.nf
FUNCTION 28: WRITE PROTECT DISK
.sp
Entry Parameters:
Register C: 1CH
.fi
.sp 2
.pp
The Write Protect Disk function provides temporary write
protection for the currently selected disk. Any attempt to write
to the disk before the next cold or warm start operation produces
the message:
.sp
.ti 8
BDOS ERR on d:R/O
.sp 6
.nf
FUNCTION 29: GET READ-ONLY VECTOR
.sp
Entry Parameters:
Register C: 1DH
.sp
Returned Value:
Registers HL: R/O Vector Value
.fi
.sp 2
.pp
Function 29 returns a bit vector in register pair HL, which
indicates drives that have the temporary Read-Only bit set. As
in Function 24, the least significant bit corresponds to drive A,
while the most significant bit corresponds to drive P. The R/O
bit is set either by an explicit call to Function 28 or by the
automatic software mechanisms within CP/M that detect changed
disks.
.bp
.sp 4
.nf
FUNCTION 30: SET FILE ATTRIBUTES
.sp
Entry Parameters:
Register C: 1EH
Registers DE: FCB Address
.sp
Returned Value:
Register A: Directory Code
.fi
.sp 2
.pp
The Set File Attributes function allows programmatic manipulation
of permanent indicators attached to files. In particular, the R/O
and System attributes (t1' and t2') can be set or reset. The DE
pair addresses an unambiguous filename with the appropriate
attributes set or reset. Function 30 searches for a match and
changes the matched directory entry to contain the selected
indicators. Indicators f1' through f4' are not currently used,
but may be useful for applications programs, since they are not
involved in the matching process during file open and close
operations. Indicators f5' through f8' and t3' are reserved for
future system expansion.
.sp 6
.nf
FUNCTION 31: GET ADDR (DISK PARMS)
.sp
Entry Parameters:
Register C: 1FH
.sp
Returned Value:
Registers HL: DPB Address
.fi
.sp 2
.pp
The address of the BIOS resident disk parameter block is returned
in HL as a result of this function call. This address can be
used for either of two purposes. First, the disk parameter
values can be extracted for display and space computation
purposes, or transient programs can dynamically change the values
of current disk parameters when the disk environment changes, if
required. Normally, application programs will not require this
facility.
.bp
.sp 4
.nf
FUNCTION 32: SET/GET USER CODE
.sp
Entry Parameters:
Register C: 20H
Register E: OFFH (get) or
User Code (set)
.sp
Returned Value:
Register A: Current Code or
(no value)
.fi
.sp 2
.pp
An application program can change or interrogate the currently
active user number by calling Function 32. If register E = 0FFH,
the value of the current user number is returned in register A,
where the value is in the range of 0 to 15. If register E is not
0FFH, the current user number is changed to the value of E,
modulo 16.
.bp
.sp 4
.nf
FUNCTION 33: READ RANDOM
.sp
Entry Parameters:
Register C: 21H
.sp
Returned Value:
Register A: Return Code
.fi
.sp 2
.pp
The Read Random function is similar to the sequential file read
operation of previous releases, except that the read operation
takes place at a particular record number, selected by the 24-bit
value constructed from the 3-byte field following the FCB (byte
positions r0 at 33, r1 at 34, and r2 at 35). The user should
note that the sequence of 24 bits is stored with least
significant byte first (r0), middle byte next (r1), and high byte
last (r2). CP/M does not reference byte r2, except in computing
the size of a file (Function 35). Byte r2 must be zero, however,
since a nonzero value indicates overflow past the end of file.
.pp
Thus, the r0, r1 byte pair is treated as a double-byte, or word
value, that contains the record to read. This value ranges from
0 to 65535, providing access to any particular record of the 8-
megabyte file. To process a file using random access, the base
extent (extent 0) must first be opened. Although the base extent
might or might not contain any allocated data, this ensures that the
file is properly recorded in the directory and is visible in DIR
requests. The selected record number is then stored in the
random record field (r0, r1), and the BDOS is called to read the
record.
.pp
Upon return from the call, register A either contains an error
code, as listed below, or the value 00, indicating the operation
was successful. In the latter case, the current DMA address
contains the randomly accessed record. Note that
contrary to the sequential read operation, the record number is
not advanced. Thus, subsequent random read operations continue
to read the same record.
.pp
Upon each random read operation, the logical extent and current
record values are automatically set. Thus, the file can be
sequentially read or written, starting from the current randomly
accessed position. However, note that, in this
case, the last randomly read record will be reread as one
switches from random mode to sequential read and the last record
will be rewritten as one switches to a sequential write operation.
The user can simply advance the random record
position following each random read or write to obtain the effect
of sequential I/O operation.
.bp
.pp
Error codes returned in register A following a random read are
listed below.
.sp 2
.nf
.in 8
01 reading unwritten data
.sp
02 (not returned in random mode)
.sp
03 cannot close current extent
.sp
04 seek to unwritten extent
.sp
05 (not returned in read mode)
.sp
06 seek past physical end of disk
.fi
.in 0
.sp
.pp
Error codes 01 and 04 occur when a random read operation accesses
a data block that has not been previously written or an extent
that has not been created, which are equivalent conditions.
Error code 03 does not normally occur under proper system
operation. If it does, it can be cleared by simply rereading or
reopening extent zero as long as the disk is not physically write
protected. Error code 06 occurs whenever byte r2 is nonzero
under the current 2.0 release. Normally, nonzero return codes
can be treated as missing data, with zero return codes indicating
operation complete.
.bp
.sp 4
.nf
FUNCTION 34: WRITE RANDOM
.sp
Entry Parameters:
Register C: 22H
Registers DE: FCB Address
.sp
Returned Value:
Register A: Return Code
.fi
.sp 2
.pp
The Write Random operation is initiated similarly to the Read
Random call, except that data is written to the disk from the
current DMA address. Further, if the disk extent or data block
that is the target of the write has not yet been allocated, the
allocation is performed before the write operation continues. As
in the Read Random operation, the random record number is not
changed as a result of the write. The logical extent number and
current record positions of the FCB are set to correspond to the
random record that is being written. Again, sequential read or
write operations can begin following a random write, with the
notation that the currently addressed record is either read or
rewritten again as the sequential operation begins. You can
also simply advance the random record position following each
write to get the effect of a sequential write operation.
Note that reading or writing the last record of an extent in
random mode does not cause an automatic extent switch as it does
in sequential mode.
.pp
The error codes returned by a random write are identical to the
random read operation with the addition of error code 05, which
indicates that a new extent cannot be created as a result of
directory overflow.
.bp
.sp 4
.nf
FUNCTION 35: COMPUTE FILE SIZE
.sp
Entry Parameters:
Register C: 23H
Registers DE: FCB Address
.sp
Returned Value:
Random Record Field Set
.fi
.sp 2
.pp
When computing the size of a file, the DE register pair addresses
an FCB in random mode format (bytes r0, r1, and r2 are present).
The FCB contains an unambiguous filename that is used in the
directory scan. Upon return, the random record bytes contain the
virtual file size, which is, in effect, the record address of
the record following the end of the file. Following a call to
Function 35, if the high record byte r2 is 01, the file contains
the maximum record count 65536. Otherwise, bytes r0 and r1
constitute a 16-bit value as before (r0 is the least significant byte),
which is the file size.
.pp
Data can be appended to the end of an existing file by simply
calling Function 35 to set the random record position to the end
of file and then performing a sequence of random writes starting
at the preset record address.
.pp
The virtual size of a file corresponds to the physical size when
the file is written sequentially. If the file was created in
random mode and holes exist in the allocation, the file might
contain fewer records than the size indicates. For example,
if only the last record of an 8-megabyte file is written in
random mode (that is, record number 65535), the virtual size is
65536 records, although only one block of data is actually
allocated.
.bp
.sp 4
.nf
FUNCTION 36: SET RANDOM RECORD
.sp
Entry Parameters:
Register C: 24H
Registers DE: FCB Address
.sp
Returned Value:
Random Record Field Set
.fi
.sp 2
.pp
The Set Random Record function causes the BDOS automatically
to produce the random record position from a file that has been
read or written sequentially to a particular point. The function
can be useful in two ways.
.pp
First, it is often necessary initially to read and scan a
sequential file to extract the positions of various key fields.
As each key is encountered, Function 36 is called to compute the
random record position for the data corresponding to this key. If
the data unit size is 128 bytes, the resulting record position is
placed into a table with the key for later retrieval. After
scanning the entire file and tabulating the keys and their record
numbers, the user can move instantly to a particular keyed record
by performing a random read, using the corresponding random
record number that was saved earlier. The scheme is easily
generalized for variable record lengths, because the program need
only store the buffer-relative byte position along with the key
and record number to find the exact starting position of the
keyed data at a later time.
.pp
A second use of Function 36 occurs when switching from a
sequential read or write over to random read or write. A file is
sequentially accessed to a particular point in the file, Function
36 is called, which sets the record number, and subsequent random
read and write operations continue from the selected point in the
file.
.bp
.sp 4
.nf
FUNCTION 37: RESET DRIVE
.sp
Entry Parameters:
Register C: 25H
Registers DE: Drive Vector
.sp
Returned Value:
Register A: 00H
.fi
.sp 2
.pp
The Reset Drive function allows resetting of specified drives.
The passed parameter is a 16-bit vector of drives to be reset;
the least significant bit is drive A:.
.pp
To maintain compatibility with MP/M, CP/M returns a zero value.
.sp 6
.nf
FUNCTION 40: WRITE RANDOM WITH ZERO FILL
.sp
Entry Parameters:
Register C: 28H
Registers DE: FCB Address
.sp
Returned Value:
Register A: Return Code
.fi
.sp 2
.pp
The Write With Zero Fill operation is similar to Function 34,
with the exception that a previously unallocated block is filled
with zeros before the data is written.
.nx fivec


444
Source/Doc/CPM 22 Manual - Testing/fivec.tex

@ -1,444 +0,0 @@
.cs 5
.mt 5
.mb 6
.pl 66
.ll 65
.po 10
.hm 2
.fm 2
.he
.bp
.tc 5.3 A Sample File-to-File Copy Program
.he CP/M Operating System Manual 5.3 A Sample Copy Program
.sh
5.3 A Sample File-to-File Copy Program
.qs
.pp
The following program provides a relatively simple example of file
operations. The program source file is created as COPY.ASM using
the CP/M ED program and then assembled using ASM or MAC, resulting
in a HEX file. The LOAD program is used to produce a COPY.COM
file that executes directly under the CCP. The program begins
by setting the stack pointer to a local area and proceeds to move
the second name from the default area at 006CH to a 33-byte File
Control Block called DFCB. The DFCB is then prepared for file
operations by clearing the current record field. At this point,
the source and destination FCBs are ready for processing, because
the SFCB at 005CH is properly set up by the CCP upon entry to the
COPY program. That is, the first name is placed into the default
FCB, with the proper fields zeroed, including the current record
field at 007CH. The program continues by opening the source
file, deleting any existing destination file, and creating the destination
file. If all this is successful, the program loops at the label
COPY until each record is read from the source file and placed into the
destination file. Upon completion of the data transfer, the
destination file is closed and the program returns to the
CCP command level by jumping to BOOT.
.ll 75
.sp 3
.nf
; sample file-to-file copy program
;
; at the ccp level, the command
;
; copy a:x.y b:u.v
;
; copies the file named x.y from drive
; a to a file named u.v. on drive b.
;
0000 = boot equ 0000h ;system reboot
0005 = bdos equ 0005h ;bdos entry point
005c = fcbl equ 005ch ;first file name
005c = sfcb equ fcbl ;source fcb
006c = fcb2 equ 006ch ;second file name
0080 = dbuff equ 0080h ;default buffer
0100 = tpa equ 0100h ;beginning of tpa
;
0009 = printf equ 9 ;print buffer func#
000f = openf equ 15 ;open file func#
0010 = closef equ 16 ;close file func#
0013 = deletef equ 19 ;delete file func#
0014 = readf equ 20 ;sequential read
0015 = writef equ 21 ;sequential write
0016 = makef equ 22 ;make file func#
;
0100 org tpa ;beginning of tpa
0100 311b02 lxi sp,stack ;local stack
;
; move second file name to dfcb
0103 0e10 mvi c,16 ;half an fcb
0105 116c00 lxi d,fcb2 ;source of move
0108 21da01 lxi h,dfcb ;destination fcb
010b 1a mfcb: Idax d ;source fcb
010c 13 inx d ;ready next
010d 77 mov m,a ;dest fcb
010e 23 inx h ;ready next
010f 0d dcr c ;count 16...0
0110 c10b01 jnz mfcb ;loop 16 times
;
; name has been removed, zero cr
0113 af xra a ;a = 00h
0114 32fa01 sta dfcbcr ;current rec = 0
;
; source and destination fcb's ready
;
0117 115c00 lxi d,sfcb ;source file
011a cd6901 call open ;error if 255
011d 118701 lxi d,nofile ;ready message
0120 3c inr a ;255 becomes 0
0121 cc6101 cz finis ;done if no file
;
; source file open, prep destination
0124 11da01 lxi d,dfcb ;destination
0127 cd7301 call delete ;remove if present
;
012a 11da01 lxi d,dfcb ;destination
012d cd8201 call make ;create the file
0130 119601 lxi d,nodir ;ready message
0133 3c inr a ;255 becomes 0
0134 cc6101 cz finis ;done if no dir space
;
; source file open, dest file open
; copy until end of file on source
;
0137 115c00 copy: lxi d,sfcb ;source
013a cd7801 call read ;read next record
013d b7 ora a ;end of file?
013e c25101 jnz eofile ;skip write if so
;
; not end of file, write the record
0141 11da01 lix d,dfcb ;destination
0144 cd7d01 call write ;write record
0147 11a901 lxi d,space ;ready message
014a b7 ora a ;00 if write ok
014b c46101 cnz finis ;end if so
014e c33701 jmp copy ;loop until eof
;
eofile: ;end of file, close destination
0151 11da01 lxi d,dfcb ;destination
0154 cd6e01 call close ;255 if error
0157 21bb01 lxi h,wrprot ;ready message
015a 3c inr a ;255 becomes 00
015b cc6101 cz finis ;shouldn't happen
;
; copy operation complete, end
015e 11cc01 lxi d,normal ;ready message
;
finis ;write message given by de, reboot
0161 0e09 mvi c,printf
0163 cd0500 call bdos ;write message
0166 c30000 jmp boot ;reboot system
;
; system interface subroutines
; (all return directly from bdos)
;
0169 0e0f open: mvi c,openf
016b c30500 jmp bdos
;
016e 0e10 close: mvi c,closef
0170 c30500 jmp bdos
;
0173 0e13 delete mvi c,deletef
0175 c30500 jmp bdos
;
0178 0e14 read: mvi c,readf
017a c30500 jmp bdos
;
017d 0e15 write: mvi c,writef
017f c30500 jmp bdos
;
0182 0e16 make: mvi c,makef
0184 c30500 jmp bdos
;
; console messages
0187 6e6f20f nofile: db 'no source file$'
0196 6e6f209 nodir: db 'no directory space$'
01a9 6f7574f space: db 'out of dat space$'
01bb 7772695 wrprot: db 'write protected?$'
01cc 636f700 normal: db 'copy complete$'
;
; data areas
01da dfcb: ds 33 ;destination fcb
01fa dfcbcr equ dfcb+32 ;current record
;
01fb ds 32 ;16 level stack
stack:
021b end
.ll 65
.fi
.in 0
.sp 2
.pp
Note that there are several simplifications in this
particular program. First, there are no checks for invalid filenames
that could contain ambiguous references. This
situation could be detected by scanning the 32-byte default area
starting at location 005CH for ASCII question marks. A check
should also be make to ensure that the filenames have
been included (check locations 005DH and 006DH for nonblank ASCII
characters). Finally, a check should be made to ensure that the
source and destination filenames are different. An improvement
in speed could be obtained by buffering more data on each read
operation. One could, for example, determine the size of memory
by fetching FBASE from location 0006H and using the entire
remaining portion of memory for a data buffer. In this case, the
programmer simply resets the DMA address to the next successive
128-byte area before each read. Upon writing to the destination
file, the DMA address is reset to the beginning of the buffer and
incremented by 128 bytes to the end as each record is
transferred to the destination file.
.sp 2
.he CP/M Operating System Manual 5.4 A Sample File Dump Utility
.tc 5.4 A Sample File Dump Utility
.sh
5.4 A Sample File Dump Utility
.qs
.pp
The following file dump program is slightly more complex than
the simple copy program given in the previous section. The dump
program reads an input file, specified in the CCP command line,
and displays the content of each record in hexadecimal format at
the console. Note that the dump program saves the CCP's stack
upon entry, resets the stack to a local area, and restores the
CCP's stack before returning directly to the CCP. Thus, the
dump program does not perform and warm start at the end of
processing.
.ll 75
.sp 3
.nf
x.in 5
;DUMP program reads input file and displays
hex data
;
0100 org 100h
0005 = bdos equ 0005h = ;bdos entry point
0001 = cons equ 1 ;read console
0002 = typef equ 2 ;type function
0009 = printf equ 9 ;buffer print entry
000b = brkf equ 11 ;break key function
;(true if char
000f = openf equ 15 ;file open
0014 = readf equ 20 ;read function
;
005c = fcb equ 5ch ;file control block
;address
0080 = buff equ 80h ;input disk buffer
;address
;
; non graphic characters
000d = cr equ 0dh ;carriage return
000a = If equ 0ah ;line feed
;
; file control block definitions
005c = fcbdn equ fcb+0 ;disk name
005d = fcbfn equ fcb+1 ;file name
0065 = fcbft equ fcb+9 ;disk file type (3
;characters)
0068 = fcbrl equ fcb+12 ;file's current reel
;number
006b = fcbrc equ fcb+15 ;file's record count (0 to
;128)128)
007c = fcbcr' equ fcb+32 ;current (next) record
;number (0
007d = fcbin equ fcb+33 ;fcb length
;
; set up stack
0100 210000 lxi h,0
0103 39 dad sp
; entry stack pointer in hl from the ccp
0104 221502 shld oldsp
; set sp to local stack area (restored at
; finis)
0107 315702 lxi sp,stktop
; read and print successive buffers
010a cdc101 call setup ;set up input file
010d feff cpi 255 ;255 if file not present
010f c21b01 jnz openok ;skip if open is ok
;
; file not there, give error message and
; return
0112 11f301 lxi d,opnmsg
0115 cd9c01 call err
0118 c35101 jmp finis ;to return
;
openok: ;open operation ok, set buffer index to
;end
011b 3e80 mvi a,80h
011d 321302 sta ibp ;set buffer pointer to 80h
; hl contains next address to print
0120 210000 lxi h,0 ;start with 0000
;
gloop:
0123 e5 push h ;save line position
0124 cda201 call gnb
0127 e1 pop h ;recall line position
0138 da5101 jc finis ;carry set by gnb if end
;file
012b 47 mov b,a
; print hex values
; check for line fold
012c 7d
mov a,l
012d e60f ani 0fh ;check low 4 bits
012f c24401 jnz nonum
; print line number
0132 cd7201 call crlf
;
; check for break key
0135 cd5901 call break
; accum lsb = 1 if character ready
0138 0f rrc ;into carry
0139 da5101 jc finis ;don't print any more
;
013c 7c mov a,h
013d cd8f01 call phex
0140 7d mov a,l
0141 cd8f01 call phex
nonum
0144 23 inx h ;to next line number
0145 3e20 mvi a,''
0147 cd6501 call pchar
014a 78 mov a,b
014b cd8f01 call phex
014e c32301 jmp gloop
;
finis
; end of dump, return to cco
; (note that a jmp to 0000h reboots)
0151 cd7201 call crif
0154 2a1502 lhld oldsp
0157 f9 sphl
; stack pointer contains ccp's stack
; location
0158 c9 ret ;to the ccp
;
;
; subroutines
;
break: ;check break key (actually any key will
;do)
0159 e5d5c5 push h! push d! push b; environment
;saved
015c 0e0b mvi c,brkf
015e cd0500 call bdos
0161 c1d1e1 pop b! pop d! pop h; environment
restored
0164 c9 ret
;
pchar: ;print a character
0165 e5d5c5 push h! push d! push b; saved
0168 0e02 mvi c, typef
016a 5f mov e,a
016b cd0500 call bdos
016e c1d1e1 pop b! pop d! pop h; restored
0171 c9 ret
;
crlf
0172 3e0d mvi a,cr
0174 cd6501 call pchar
0177 3e0a mvi a,lf
0179 cd6501 call pchar
017c c9 ret
;
;
pnib: ;print nibble in reg a
017d e60f ani ofh ;low 4 bits
017f fe0a cpi 10
0181 d28901 jnc p10
; less than or equal to 9
0184 c630 adi '0'
0186 c38b01 jmp prn
;
; greater or equal to 10
0189 c637 p10: adi 'a' - 10
018b cd6501 prn: call pchar
018e c9 ret
;
phex ;print hex char in reg a
018f f5 pushpsw
0190 0f rrc
0191 0f rrc
0192 0f rrc
0193 0f rrc
0194 cd7d01 call pnib ;print nibble
0197 f1 pop psw
0198 cd7d01 call pnip
019b c9 ret
;
err: ;print error message
; d,e addresses message ending with "$"
019c 0e09 mvi c,printf ;print buffer
;function
019e cd0500 call bdos
01a1 c9 ret
;
;
gnb: ;get next byte
01a2 3a1302 lda ibp
01a5 fe80 cpi 80h
01a7 c2b301 jnz g0
; read another buffer
;
;
01aa cdce01 call diskr
01ad b7 ora a ;zero value if read ok
01ae cab301 jz g0 ;for another byte
; end of data, return with carry set for eof
01b1 37 stc
01b2 c9 ret
;
g0: ;read the byte at buff+reg a
01b3 5f mov e,a ;Is byte of buffer index
01b4 1600 mvi d,0 ;double precision
;index to de
01b6 3c inr a ;index=index+1
01b7 321302 sta ibp ;back to memory
; pointer is incremented
; save the current file address
01ba 218000 lxi h,buff
01bd 19 dad d
; absolute character address is in hl
01be 7e mov a,m
; byte is in the accumulator
01bf b7 ora a ;reset carry bit
01c0 c9 ret
;
setup: ;set up file
; open the file for input
01c1 af xra a ;zero to accum
01c2 327c00 sta fcbcr ;clear current record
;
01c5 115c00 lxi d,fcb
01c8 0e0f mvi c,openf
01ca cd0500 call bdos
; 255 in accum if open error
01cd c9 ret
;
diskr: ;read disk file record
01ce e5d5c5 push h! push d! push b
01d1 115c00 lxi d,fcb
01d4 0e14 mvi c,readf
01d6 cd0500 call bdos
01d9 c1d1e1 pop b! pop d! pop h
01dc c9 ret
;
; fixed message area
01dd 46494c0 signon: db 'file dump version 2.0$'
01f3 0d0a4e0 opnmsg: db cr,lf,'no input file present on
disk$'
; variable area
0213 ibp: ds 2 ;input buffer pointer
0215 oldsp: ds 2 ;entry sp value from ccp
;
; stack area
0217 ; ds 64 ;reserve 32 level stack
stktop:
;
0257 end
.ll 65
.fi
.in 0
.nx fived


497
Source/Doc/CPM 22 Manual - Testing/fived.tex

@ -1,497 +0,0 @@
.cs 5
.mt 5
.mb 6
.pl 66
.ll 65
.po 10
.hm 2
.fm 2
.sp 3
.he CP/M Operating System Manual 5.5 Sample Random Access Program
.sh
5.5 A Sample Random Access Program
.qs
.tc 5.5 A Sample Random Access Program
.pp
This chapter concludes with an extensive example of random access operation.
The program listed below performs the simple function of reading or writing
random records upon command from the terminal. When a
program has been created, assembled, and placed into a file
labeled RANDOM.COM, the CCP level command
.sp
.ti 8
RANDOM X.DAT
.sp
starts the test program. The program looks for a file by the
name X.DAT and, if found, proceeds to prompt the console for
input. If not found, the file is created before the prompt is
given. Each prompt takes the form
.sp
.ti 8
next command?
.sp
and is followed by operator input, followed by a carriage
return. The input commands take the form
.sp
.ti 8
nW nR Q
.sp
where n is an integer value in the range 0 to 65535, and W, R,
and Q are simple command characters corresponding to random
write, random read, and quit processing, respectively. If the W
command is issued, the RANDOM program issues the prompt
.sp
.ti 8
type data:
.sp
The operator then responds by typing up to 127 characters,
followed by a carriage return. RANDOM then writes the character
string into the X.DAT file at record n. If the R command is
issued, RANDOM reads record number n and displays the string
value at the console, If the Q command is issued, the X.DAT file
is closed, and the program returns to the CCP. In the interest
of brevity, the only error message is
.sp
.ti 8
error, try again.
.pp
The program begins with an initialization section where the input
file is opened or created, followed by a continuous loop at the
label ready where the individual commands are interpreted. The
DFBC at 005CH and the default buffer at 0080H are used in all
disk operations. The utility subroutines then follow, which
contain the principal input line processor, called readc. This
particular program shows the elements of random access
processing, and can be used as the basis for further program
development.
.ll 75
.sp 3
.nf
.sh
Sample Random Access Program for CP/M 2.0
.qs
0100 org 100h ;base of tpa
;
0000 = reboot equ 0000h ;system reboot
0005 = bdos equ 0005h ;bdos entry point
;
0001 = coninp equ 1 ;console input function
0002 = conout equ 2 ;console output function
0009 = pstring equ 9 ;print string until '$'
000a = rstring equ 10 ;read console buffer
000c = version equ 12 ;return version number
000f = openf equ 15 ;file open function
0010 = closef equ 16 ;close function
0016 = makef equ 22 ;make file function
0021 = readr equ 33 ;read random
0022 = writer equ 34 ;write random
;
005c = fcb equ 005ch ;default file control
;block
007d = ranrec equ fcb+33 ;random record position
007f = ranovf equ fcb+35 ;high order (overflow)
;byte
0080 = buff equ 0080h ;buffer address
;
000d = cr equ 0dh ;carriage return
000a = lf equ 0ah ;line feed
;
.sh
Load SP, Set-Up File for Random Access
.qs
0100 31bc00 lxi sp,stack
;
; version 2.0
0103 0e0c mvi c,version
0105 cd0500 call bdos
0108 fe20 cpi 20h ;version 2.0 or better?
010a d21600 jnc versok
; bad version, message and go back
010d 111b00 lxi d,badver
0110 cdda00 call print
0113 c30000 jmp reboot
;
versok:
; correct versionm for random access
0116 0e0f mvi c,openf ;open default fcb
0118 115c00 lxi d,fcb
011b cd 0500 call bdos
011e 3c inr a ;err 255 becomes zero
011f c23700 jnz ready
;
; connot open file, so create it
0122 0e16 mvi c,makef
0124 115c00 lxi d,fcb
0127 cd0500 call bdos
012a 3c inr a ;err 255 becomes zero
012b c23700 jnz ready
;
; cannot create file, directory full
012e 113a00 lxi d,nospace
0131 cdda00 call print
0134 c30000 jmp reboot ;back to ccp
.sp 2
.sh
Loop Back to Ready After Each Command
.qs
.sp
;
ready:
; file is ready for processing
;
0137 cde500 call readcom ;read next command
013a 227d00 shld ranrec ;store input record#
013d 217f00 lxi h,ranovf
0140 3600 mvi m,0 ;clear high byte if set
0142 fe51 cpi 'Q' ;quit?
0144 c25600 jnz notq
;
; quit processing, close file
0147 0e10 mvi c,closef
0149 115c00 lxi d,fcb
014c cd0500 call bdos
014f 3c inr a ;err 255 becomes 0
0150 cab900 jz error ;error message, retry
0153 c30000 jmp reboot ;back to ccp
;
.sp 2
.sh
End of Quit Command, Process Write
.qs
.sp
notq:
; not the quit command, random write?
0156 fe57 cpi 'W'
0158 c28900 jnz notw
;
; this is a random write, fill buffer untill cr
015b 114d00 lxi d,datmsg
015e cdda00 call print ;data prompt
0161 0e7f mvi c,127 ;up to 127 characters
0163 218000 lxi h,buff ;destination
rloop: ;read next character to buff
0166 c5 push b ;save counter
0167 e5 push h ;next destination
0168 cdc200 call getchr ;character to a
016b e1 pop h ;restore counter
016c c1 pop b ;restore next to fill
016d fe0d cpi cr ;end of line?
016f ca7800 jz erloop
; not end, store character
0172 77 mov m,a
0173 23 inx h ;next to fill
0174 0d dcr c ;counter goes down
0175 c26600 jnz rloop ;end of buffer?
erloop:
; end of read loop, store 00
0178 3600 mvi m,0
;
; write the record to selected record number
017a 0e22 mvi c,writer
017c 115c00 lxi d,fcb
017c cd0500 call bdos
0182 b7 ora a ;erro code zero?
0183 c2b900 jnz error ;message if not
0186 c33700 jmp ready ;for another record
;
.sp 2
.sh
End of Write Command, Process Read
.qs
.sp
notw:
; not a write command, read record?
0189 fe52 cpi 'R'
018b c2b900 jnz error ;skip if not
;
; read random record
018e 0e21 mvi c,readr
0190 115c00 lxi d,fcb
0193 cd0500 call bdos
0196 b7 ora a ;return code 00?
0197 c2b900 jnz error
;
; read was successful, write to console
019a cdcf00 call crlf ;new line
019d 0e80 mvi c,128 ;max 128 characters
019f 218000 lxi h,buff ;next to get
wloop:
01a2 7e mov a,m ;next character
01a3 23 inx h ;next to get
01a4 e67f ani 7fh ;mask parity
01a6 ca3700 jz ready ;for another command
;if 00
01a9 c5 push b ;save counter
01aa e5 push h ;save next to get
01ab fe20 cpi '' ;graphic?
01ad d4c800 cnc putchr ;skip output if not
01b0 e1 pop h
01b1 c1 pop b
01b2 0d dcr c ;count=count-1
01b3 c2a200 jnz wloop
01b6 c33700 jmp ready
.bp
.sh
End of Read Command, All Errors End Up Here
.qs
.sp
;
error:
01b9 115900 lxi d,errmsg
01bc cdda00 call print
01bf c33700 jmp ready
;
.sp 2
.sh
Utility Subroutines for Console I/O
.qs
.sp
getchr:
;read next console character to a
01c2 0e01 mvi c,coninp
01c4 cd0500 call bdos
01c7 c9 ret
;
putchr:
;write character from a to console
01c8 0e02 mvi c,conout
01ca 5f mov e,a ;character to send
01cb cd0500 call bdos ;send character
01ce c9 ret
;
crlf:
;send carriage return line feed
01cf 3e0d mvi a,cr ;carriage return
01d1 cdc800 call putchr
01d4 3e0a mvi a,lf ;line feed
01d6 cdc800 call putchr
01d9 c9 ret
;
print:
;print the buffer addressed by de untill $
01da d5 push d
01db cdcf00 call crlf
01de d1 pop d ;new line
01df 0e09 mvi c,pstring
01e0 cd0500 call bdos ;print the string
01e4 c9 ret
;
readcom:
;read the next command line to the conbuf
01e5 116b00 lxi d,prompt
01e8 cdda00 call print ;command?
01eb 0e0a mvi c,rstring
01ed 117a00 lxi d,conbuf
01f0 cd0500 call bdos ;read command line
; command line is present, scan it
01f3 210000 lxi h,0 ;start with 0000
01f6 117c00 lxi d,conlin ;command line
01f9 1a readc: ldax d ;next command
;character
01fa 13 inx d ;to next command
;position
01fb b7 ora a ;cannot be end of
;command
01fc c8 rz
; not zero, numeric?
01fd d630 sui '0'
01ff fe0a cpi 10 ;carry if numeric
0201 d21300 jnc endrd
; add-in next digit
0204 29 dad h ;*2
0205 4d mov c,l
0206 44 mov b,h ;bc = value * 2
0207 29 dad h ;*4
0208 29 dad h ;*8
0209 09 dad b ;*2 + *8 = *10
020a 85 add l ;*digit
020b 6f mov l,a
020c d2f900 jnc readc ;for another char
020f24 inr h ;overflow
0210 c3f900 jmp readc ;for another char
endrd:
; end of read, restore value in a
0213 c630 adi '0' ;command
0215 fe61 cpi 'a' ;translate case?
0217 d8 rc
; lower case, mask lower case bits
0218 e65f ani 101$1111b
021a c9 ret
;
.sp 2
.sh
String Data Area for Console Messages
.qs
.sp
badver:
021b 536f79 db 'sorry, you need cp/m version 2$'
nospace:
023a 4e6f29 db 'no directory space$'
datmsg:
024d 547970 db 'type data: $'
errmsg:
0259 457272 db 'error, try again.$'
prompt:
026b 4e6570 db 'next command? $'
;
.sp 2
.mb 5
.fm 1
.sh
Fixed and Variable Data Area
.qs
.sp
027a 21 conbuf: db conlen ;length of console buffer
027b consiz: ds 1 ;resulting size after read
027c conlin: ds 32 ;length 32 buffer
0021 = conlen equ $-consiz
;
029c ds 32 ;16 level stack
stack:
02bc end
.ll 65
.fi
.pp
Major improvements could be made to this particular program to enhance
its operation. In fact, with some work, this program could
evolve into a simple data base management system. One could, for
example, assume a standard record size of 128 bytes, consisting
to arbitrary fields within the record. A program, called GETKEY,
could be developed that first reads a sequential file and
extracts a specific field defined by the operator. For example,
the command
.mb 6
.fm 2
.sp
.ti 8
GETKEY NAMES.DAT LASTNAME 10 20
.sp
would cause GETKEY to read the data base file NAMES.DAT and
extract the LAST-NAME field from each record, starting in
position 10 and ending at character 20. GETKEY builds a table in
memory consisting of each particular LASTNAME field, along with
its 16-bit record number location within the file. The GETKEY
program then sorts this list and writes a new file, called
LASTNAME.KEY, which is an alphabetical list of LASTNAME fields
with their corresponding record numbers. This list is called an
inverted index in information retrieval parlance.
.pp
If the programmer were to rename the program shown above as QUERY
and modify it so that it reads a sorted key file into memory,
the command line might appear as
.sp
.ti 8
QUERY NAMES.DAT LASTNAME.KEY
.sp
Instead of reading a number, the QUERY program reads an
alphanumeric string that is a particular key to find in the
NAMES.DAT data base. Because the LASTNAME.KEY list is sorted, one
can find a particular entry rapidly by performing a binary
search, similar to looking up a name in the telephone book.
Starting at both ends of the list, one examines the
entry halfway in between and, if not matched, splits either the
upper half or the lower half for the next search. You will
quickly reach the item you are looking for and find the
corresponding record number. You should fetch and display
this record at the console, just as was done in the program shown
above.
.pp
With some more work, you can allow a fixed grouping size
that differs from the 128-byte record shown above. This is
accomplished by keeping track of the record number and the
byte offset within the record. Knowing the group size, you
randomly access the record containing the proper group, offset
to the beginning of the group within the record read sequentially
until the group size has been exhausted.
.pp
Finally, you can improve QUERY considerably by allowing boolean
expressions, which compute the set of records that satisfy
several relationships, such as a LASTNAME between HARDY and
LAUREL and an AGE lower than 45. Display all the records that
fit this description. Finally, if your lists are getting
too big to fit into memory, randomly access key
files from the disk as well.
.bp
.tc 5.6 System Function Summary
.he CP/M Operating System Manual 5.6 System Function Summary
.sh
5.6 System Function Summary
.qs
.sp
.nf
Function Function Input Output
Number Name
.sp
Decimal Hex
.sp
0 0 System Reset C = 00H none
1 1 Console Input C = 01H A = ASCII char
2 2 Console Output E = char none
3 3 Reader Input A = ASCII char
4 4 Punch Output E = char none
5 5 List Output E = char none
6 6 Direct Console I/O C = 06H A = char or status
E = 0FFH (input) or (no value)
0FEH (status) or
char (output)
7 7 Get I/O Byte none A = I/O byte
Value
8 8 Set I/O Byte E = I/O Byte none
9 9 Print String DE = Buffer Address none
10 A Read Console Buffer DE = Buffer Console
Characters
in Buffer
11 B Get Console Status none A = 00/non zero
12 C Return Version Number none HL: Version
Number
13 D Reset Disk System none none
14 E Select Disk E = Disk Number none
15 F Open File DE = FCB Address FF if not found
16 10 Close File DE = FCB Address FF if not found
17 11 Search For First DE = FCB Address A = Directory
Code
18 12 Search For Next none A = Directory
Code
19 13 Delete File DE = FCB Address A = none
20 14 Read Sequential DE = FCB Address A = Error Code
21 15 Write Sequential DE = FCB Address A = Error Code
22 16 Make File DE = FCB Address A = FF if no DIR
Space
23 17 Rename File DE = FCB Address A = FF in not
found
24 18 Return Login Vector none HL = Login
Vector*
25 19 Return Current Disk none A = Current Disk
Number
26 1A Set DMA Address DE = DMA Address none
27 1B Get ADDR (ALLOC) none HL = ALLOC
Address*
28 1C Write Protect Disk none none
29 1D Get Read/only Vector none HL = R/O
Vector Value*
30 1E Set File Attributes DE = FCB Address A = none
31 1F Get ADDR (Disk Parms) none HL = DPB
Address
32 20 Set/Get User Code E = 0FFH for Get User Number
E = 00 to 0FH for Set
33 21 Read Random DE = FCB Address A = Error Code
34 22 Write Random DE = FCB Address A = Error Code
35 23 Compute File Size DE = FCB Address r0, r1, r2
36 24 Set Random Record DE = FCB Address r0, r1, r2
37 25 Reset Drive DE = Drive Vector A = 0
38 26 Access Drive not supported
39 27 Free Drive not supported
40 28 Write Random with Fill DE = FCB A = Error Code
.fi
.sp 4
*Note that A = L, and B = H upon return.
.sp 2
.ce
End of Section 5
.nx sixa


693
Source/Doc/CPM 22 Manual - Testing/foura.tex

@ -1,693 +0,0 @@
.bp 1
.op
.cs 5
.mt 5
.mb 6
.pl 66
.ll 65
.po 10
.hm 2
.fm 2
.he
.ft 4-%
.pc 1
.tc 4 CP/M Dynamic Debugging Tool
.nf
.sh
Section 4
.sp
.sh
CP/M Dynamic Debugging Tool
.qs
.fi
.sp 3
.tc 4.1 Introduction
.he CP/M Operating System Manual 4.1 Introduction
.sh
4.1 Introduction
.pp 5
The DDT program allows dynamic interactive testing and debugging of
programs generated in the CP/M environment. Invoke the debugger with
a command of one of the following forms:
.sp
.in 8
.nf
DDT
DDT filename.HEX
DDT filename.COM
.fi
.in 0
.sp
where filename is the name of the program to be loaded and
tested. In both cases, the DDT program is brought into main
memory in place of the Console Command Processor (CCP) and resides
directly below the Basic Disk Operating System (BDOS)
portion of CP/M. Refer to Section 5 for standard memory
organization. The BDOS
starting address, located in the address field of the
JMP instruction at location 5H, is altered to reflect the
reduced Transient Program Area (TPA) size.
.pp
The second and third forms of the DDT command perform the same
actions as the first, except there is a subsequent automatic load
of the specified HEX or COM file. The action is identical to the
following sequence of commands:
.sp
.in 8
.nf
DDT
Ifilename.HEX or Ifilename.COM
R
.fi
.in 0
.sp
where the I and R commands set up and read the specified program
to test. See the explanation of the I and R
commands below for exact details.
.pp
Upon initiation, DDT prints a sign-on message in the form:
.sp
.ti 8
DDT VER m.m
.sp
where m.m is the revision number.
.pp
Following the sign-on message, DDT prompts you with the
hyphen character, -, and waits for input commands from the
console. You can type any of several single-character commands,
followed by a carriage return to execute the command. Each
line of input can be line-edited using the following standard
CP/M controls:
.bp
.ce
.sh
Table 4-1. Line-editing Controls
.ll 60
.sp
.in 5
.nf
Control Result
.sp
rubout removes the last character typed
CTRL-U removes the entire line, ready for retyping
CTRL-C reboots system
.fi
.in 0
.ll 65
.sp
.pp
Any command can be up to 32 characters in length. An automatic
carriage return is inserted as character 33, where the
first character determines the command type. Table 4-2 describes DDT
commands.
.sp 2
.sh
Table 4-2. DDT Commands
.sp
.nf
Command Result
Character
.fi
.sp
.ll 57
.in 16
.ti -9
A enters assembly-language mnemonics with operands.
.sp
.ti -9
D displays memory in hexadecimal and ASCII.
.sp
.ti -9
F fills memory with constant data.
.sp
.ti -9
G begins execution with optional breakpoints.
.sp
.ti -9
I sets up a standard input File Control Block.
.sp
.ti -9
L lists memory using assembler mnemonics.
.sp
.ti -9
M moves a memory segment from source to destination.
.sp
.ti -9
R reads a program for subsequent testing.
.sp
.ti -9
S substitutes memory values.
.sp
.ti -9
T traces program execution.
.sp
.ti -9
U untraced program monitoring.
.sp
.ti -9
X examines and optionally alters the CPU state.
.in 0
.ll 65
.mb 4
.fm 1
.sp 2
The command character, in some cases, is followed by zero, one,
two, or three hexadecimal values, which are separated by commas
or single blank characters. All DDT numeric output is in
hexadecimal form. The commands are not execution until the
carriage return is typed at the end of the command.
.pp
At any point in the debug run, you can stop execution of
DDT by using either a CTRL-C or G0 (jump to location 0000H) and
save the current memory image by using a SAVE command of the form:
.sp
.ti 8
SAVE n filename. COM
.sp
where n is the number of pages (256 byte blocks) to be saved on
disk. The number of blocks is determined by taking the high-order
byte of the address in the TPA and converting this number to
decimal. For example, if the highest address in the TPA is 134H,
the number of pages is 12H or 18 in decimal. You could type a
CTRL-C during the debug run, returning to the CCP level, followed
by
.mb 6
.fm 2
.sp
.ti 8
SAVE 18 X.COM
.sp
The memory image is saved as X.COM on the disk and can be
directly executed by typing the name X. If further testing is
required, the memory image can be recalled by typing
.sp
.ti 8
DDT X.COM
.sp
which reloads the previously saved program from location 100H
through page 18, 23FFH. The CPU state is not a part of the COM
file; thus, the program must be restarted from the beginning to
test it properly.
.sp 2
.tc 4.2 DDT Commands
.he CP/M Operating System Manual 4.2 DDT Commands
.sh
4.2 DDT Commands
.pp
The individual commands are detailed below. In each case, the
operator must wait for the hyphen prompt character before entering
the command. If control is passed to a program under test, and
the program has not reached a breakpoint, control can be returned
to DDT by executing a RST 7 from the front panel. In the
explanation of each command, the command letter is shown in some
cases with numbers separated by commas, the the numbers are
represented by lower-case letters. These numbers are always
assumed to be in a hexadecimal radix and from one to four digits
in length. Longer numbers are automatically truncated on the
right.
.pp
Many of the commands operate upon a CPU state that corresponds
to the program under test. The CPU state holds the registers of
the program being debugged and initially contains zeros for all
registers and flags except for the program counter, P, and stack
pointer, S, which default to 100H. The program counter is
subsequently set to the starting address given in the last record
of a HEX file if a file of this form is loaded, see the I and R
commands.
.sp 2
.tc 4.2.1 The A (Assembly) Command
.sh
4.2.1 The A (Assembly) Command
.pp
DDT allows in-line assembly language to be inserted into the
current memory image using the A command, which takes the form:
.sp
.ti 8
As
.sp
where s is the hexadecimal starting address for the in-line
assembly. DDT prompts the console with the address of the next
instruction to fill and reads the console, looking for assembly-language
mnemonics followed by register references and operands in
absolute hexadecimal form. See the \c
.ul
Intel 8080 Assembly Language Reference Card \c
.qu
for a list of mnemonics. Each
successive load address is printed before reading the console.
The A command terminates when the first empty line is input from
the console.
.pp
Upon completion of assembly language input, you can
review the memory segment using the DDT disassembler (see the L
command).
.pp
Note that the assembler/disassembler portion of
DDT can be overlaid by the transient program being tested, in
which case the DDT program responds with an error condition when
the A and L commands are used.
.sp 2
.tc 4.2.2 The D (Display) Command
.sh
4.2.2 The D (Display) Command
.pp
The D command allows you to view the contents of memory
in hexadecimal and ASCII formats. The D command takes the forms:
.sp
.in 8
.nf
D
Ds
Ds,f
.fi
.in 0
.pp
In the first form, memory is displayed from the current display
address, initially 100H, and continues for 16 display lines.
Each display line takes the followng form:
.sp
.nf
aaaa bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb cccccccccccccccc
.fi
.sp
where aaaa is the display address in hexadecimal and bb
represents data present in memory starting at aaaa. The ASCII
characters starting at aaaa are to the right (represented by the
sequence of character c) where nongraphic characters are printed as a
period. You should note that both upper- and lower-case
alphabetics are displayed, and will appear as upper-case symbols
on a console device that supports only upper-case. Each display
line gives the values of 16 bytes of data, with the first line
truncated so that the next line begins at an address that is a
multiple of 16.
.pp
The second form of the D command is similar to the first, except
that the display address is first set to address s.
.pp
The third form causes the display to continue from address s
through address f. In all cases, the display address is set to
the first address not displayed in this command, so that a
continuing display can be accomplished by issuing successive D
commands with no explicit addresses.
.pp
Excessively long displays can be aborted by pressing the return key.
.sp 2
.tc 4.2.3 The F (Fill) Command
.sh
4.2.3 The F (Fill) Command
.pp
The F command takes the form:
.sp
.ti 8
Fs,f,c,
.sp
where s is the starting address, f is the final address, and c is
a hexadecimal byte constant. DDT stores the constant c at
address s, increments the value of s and test against f. If s
exceeds f, the operation terminates, otherwise the operation is
repeated. Thus, the fill command can be used to set a memory
block to a specific constant value.
.sp 2
.tc 4.2.4 The G (Go) Command
.sh
4.2.4 The G (Go) Command
.pp
A program is executed using the G command, with up to two
optional breakpoint addresses. The G command takes the forms:
.sp 2
.in 8
.nf
G
Gs
Gs,b
Gs,b,c
G,b
G,b,c
.fi
.in 0
.sp
.pp
The first form executes the program at the current value of the
program counter in the current machine state, with no breakpoints
set. The only way to regain control in DDT is through a RST 7
execution. The current program counter can be viewed by typing
an X or XP command.
.pp
The second form is similar to the first, except that the program
counter in the current machine state is set to address s before
execution begins.
.pp
The third form is the same as the second, except that program
execution stops when address b is encountered (b must be in the
area of the program under test). The instruction at location b is
not executed when the breakpoint is encountered.
.pp
The fourth form is identical to the third, except that two
breakpoints are specified, one at b and the other at c.
Encountering either breakpoint causes execution to stop, and both
breakpoints are cleared. The last two forms take the program
counter from the current machine state and set one and two
breakpoints, respectively.
.pp
Execution continues from the starting address in real-time to the
next breakpoint. There is no intervention between the starting
address and the break address by DDT. If the program under test
does not reach a breakpoint, control cannot return to DDT without
executing a RST 7 instruction. Upon encountering a breakpoint,
DDT stops execution and types
.sp
.ti 8
*d
.sp
where d is the stop address. The machine state can be examined
at this point using the X (Examine) command. You must
specify breakpoints that differ from the program counter address
at the beginning of the G command. Thus, if the current program
counter is 1234H, then the following commands:
.sp
.nf
.in 8
G,1234
G400,400
.fi
.in 0
.sp
both produce an immediate breakpoint without executing any
instructions.
.sp 2
.tc 4.2.5 The I (Input) Command
.sh
4.2.5 The I (Input) Command
.pp
The I command allows you to insert a filename into the default
File Control Block (FCB) at 5CH. The FCB created by CP/M for
transient programs is placed at this location (see Section 5).
The default FCB can be used by the program under test as if it
had been passed by the CP/M Console Processor. Note that this
filename is also used by DDT for reading additional HEX and COM
files. The I command takes the forms:
.sp
.nf
.in 8
Ifilename
Ifilename.typ
.fi
.in 0
.pp
If the second form is used and the filetype is either HEX or COM,
subsequent R commands can be used to read the pure binary or hex
format machine code. Section 4.2.8 gives further details.
.sp 2
.tc 4.2.6 The L (List) Command
.sh
4.2.6 The L (List) Command
.pp
The L command is used to list assembly-language mnemonics in a
particular program region. The L command takes the forms:
.sp
.in 8
.nf
L
Ls
Ls,f
.fi
.in 0
.pp
The first form lists twelve lines of disassembled machine code
from the current list address. The second form sets the list
address to s and then lists twelve lines of code. The last form
lists disassembled code from s through address f. In all three
cases, the list address is set to the next unlisted location in
preparation for a subsequent L command. Upon encountering an
execution breakpoint, the list address is set to the current
value of the program counter (G and T commands). Again, long
typeouts can be aborted by pressing RETURN during the list
process.
.sp 2
.tc 4.2.7 The M (Move) Command
.sh
4.2.7 The M (Move) Command
.pp
The M command allows block movement of program or data areas from
one location to another in memory. The M command takes the form:
.sp
.ti 8
Ms,f,d
.sp
where s is the start address of the move, f is the final address,
and d is the destination address. Data is first removed from s
to d, and both addresses are incremented. If s exceeds f, the
move operation stops; otherwise, the move operation is repeated.
.sp 2
.tc 4.2.8 The R (Read) Command
.sh
4.2.8 The R (Read) Command
.pp
The R command is used in conjunction with the I command to read
COM and HEX files from the disk into the transient program
area in preparation for the debug run. The R command takes the forms:
.sp
.in 8
.nf
R
RB
.fi
.in 0
.sp
where b is an optional bias address that is added to each program
or data address as it is loaded. The load operation must not
overwrite any of the system parameters from 000H through 0FFH
(that is, the first page of memory). If b is omitted, then
b=0000 is assumed. The R command requires a previous I command,
specifying the name of a HEX or COM file. The load address for
each record is obtained from each individual HEX record, while an
assumed load address of 100H is used for COM files. Note that
any number of R commands can be issued following the I command to
reread the program under test, assuming the tested program does
not destroy the default area at 5CH. Any file specified with the
filetype COM is assumed to contain machine code in pure binary
form (created with the LOAD or SAVE command), and all others are
assumed to contain machine code in Intel hex format (produced,
for example, with the ASM command).
.pp
Recall that the command,
.sp
.ti 8
DDT filename.filetype
.sp
which initiates the DDT program, equals to the following commands:
.sp
.in 8
.nf
DDT
-Ifilename.filetype
-R
.fi
.in 0
.bp
.pp
Whenever the R command is issued, DDT responds with either the
error indicator ? (file cannot be opened, or a checksum error
occurred in a HEX file) or with a load message. The load message
takes the form:
.sp
.in 8
.nf
NEXT PC
nnnn pppp
.fi
.in 0
.sp
where nnnn is the next address following the loaded program and
pppp is the assumed program counter (100H for COM files, or
taken from the last record if a HEX file is specified).
.sp 2
.tc 4.2.9 The S (Set) Command
.sh
4.2.9 The S (Set) Command
.pp
The S command allows memory locations to be examined and
optionally altered. The S command takes the form:
.sp
.ti 8
Ss
.sp
where s is the hexadecimal starting address for examination and
alteration of memory. DDT responds with a numeric prompt, giving
the memory location, along with the data currently held in
memory. If you type a carriage return, the data is
not altered. If a byte value is typed, the value is stored at
the prompted address. In either case, DDT continues to prompt
with successive addresses and values until you type either a period
or an invalid input value is detected.
.sp 2
.tc 4.2.10 The T (Trace) Command
.sh
4.2.10 The T (Trace) Command
.pp
The T command allows selective tracing of program execution for 1
to 65535 program steps. The T command takes the forms:
.sp
.in 8
.nf
T
Tn
.fi
.in 0
.mb 4
.fm 1
.pp
In the first form, the CPU state is displayed and the next
program step is executed. The program terminates immediately,
with the termination address displayed as
.sp
.ti 8
*hhhh
.sp
where hhhh is the next address to execute. The display address
(used in the D command) is set to the value of H and L, and the
list address (used in the L command) is set to hhhh. The CPU
state at program termination can then be examined using the X
command.
.pp
The second form of the T command is similar to the first, except
that execution is traced for n steps (n is a hexadecimal value)
before a program breakpoint occurs. A breakpoint can be forced
in the trace mode by typing a rubout character. The CPU state is
displayed before each program step is taken in trace mode. The
format of the display is the same as described in the X command.
.mb 6
.fm 2
.pp
You should note that program tracing is discontinued at the
CP/M interface and resumes after return from CP/M to the program
under test. Thus, CP/M functions that access I/O devices, such
as the disk drive, run in real-time, avoiding I/O timing
problems. Programs running in trace mode execute approximately
500 times slower than real-time because DDT gets control after each
user instruction is executed. Interrupt processing routines can
be traced, but commands that use the breakpoint facility (G, T,
and U) accomplish the break using an RST 7 instruction, which
means that the tested program cannot use this interrupt location.
Further, the trace mode always runs the tested program with
interrupts enabled, which may cause problems if asynchronous
interrupts are received during tracing.
.pp
To get control back to DDT during trace, press RETURN rather than
executing an RST 7. This ensures that the trace for current
instruction is completed before interruption.
.sp 2
.tc 4.2.11 The U (Untrace) Command
.sh
4.2.11 The U (Untrace) Command
.pp
The U command is identical to the T command, except that
intermediate program steps are not displayed. The untrace mode
allows from 1 to 65535, (0FFFFH) steps to be executed in monitored
mode and is used principally to retain control of an executing
program while it reaches steady state conditions. All conditions
of the T command apply to the U command.
.sp 2
.tc 4.2.12 The X (Examine) Command
.sh
4.2.12 The X (Examine) Command
.pp
The X command allows selective display and alteration of the
current CPU state for the program under test. The X command
takes the forms:
.sp
.in 8
.nf
X
Xr
.fi
.in 0
.sp
where r is one of the 8080 CPU registers listed in the following table.
.sp 2
.sh
Table 4-3. CPU Registers
.sp
.nf
Register Meaning Value
.sp
C Carry flag (0/1)
Z Zero flag (0/1)
M Minus flag (0/1)
E Even parity flag (0/1)
I Interdigit carry (0/1)
A Accumulator (0-FF)
B BC register pair (0-FFFF)
D DE register pair (0-FFFF)
.bp
.sh
Table 4-3. (continued)
.sp
.nf
Register Meaning Value
.sp
H HL register pair (0-FFFF)
S Stack pointer (0-FFFF)
P Program counter (0-FFFF)
.fi
.sp 2
In the first case, the CPU register state is displayed in the
format:
.sp
.ti 8
CfZfMfEflf A=bb B=dddd D=dddd H=dddd S=dddd P=dddd inst
.sp
where f is a 0 or 1 flag value, bb is a byte value, and dddd is a
double-byte quantity corresponding to the register pair. The
inst field contains the disassembled instruction, that occurs at
the location addressed by the CPU state's program counter.
.pp
The second form allows display and optional alteration of
register values, where r is one of the registers given above (C,
Z, M, E, I, A, B, D, H, S, or P). In each case, the flag or
register value is first displayed at the console. The DDT
program then accepts input from the console. If a carriage
return is typed, the flag or register value is not altered. If
a value in the proper range is typed, the flag or register value
is altered. You should note that BC, DE, and HL are
displayed as register pairs. Thus, you must type the entire
register pair when B, C, or the BC pair is altered.
.sp 2
.tc 4.3 Implementation Notes
.he CP/M Operating System Manual 4.3 Implementation Notes
.sh
4.3 Implementation Notes
.pp
The organization of DDT allows certain nonessential portions to
be overlaid to gain a larger transient program area for debugging
large programs. The DDT program consists of two parts: the DDT
nucleus and the assembler/disassembler module. The DDT nucleus
is loaded over the CCP and, although loaded with the DDT nucleus,
the assembler/disassembler is overlayable unless used to assemble
or disassemble.
.pp
In particular, the BDOS address at location 6H (address field of
the JMP instruction at location 5H) is modified by DDT to address
the base location of the DDT nucleus, which, in turn, contains a
JMP instruction to the BDOS. Thus, programs that use this
address field to size memory see the logical end of memory at the
base of the DDT nucleus rather than the base of the BDOS.
.pp
The assembler/disassembler module resides directly below the DDT
nucleus in the transient program area. If the A, L, T, or X
commands are used during the debugging process, the DDT program
again alters the address field at 6H to include this module,
further reducing the logical end of memory. If a program loads
beyond the beginning of the assembler/disassembler module, the A
and L commands are lost (their use produces a ? in response)
and the trace and display (T and X) commands list the inst field
of the display in hexadecimal, rather than as a decoded
instruction.
.nx fourb


583
Source/Doc/CPM 22 Manual - Testing/fourb.tex

@ -1,583 +0,0 @@
.sp 2
.tc 4.4 A Sample Program
.he CP/M Operating System Manual 4.4 A Sample Program
.sh
4.4 A Sample Program
.pp
The following example shows an edit, assemble, and debug for a
simple program that reads a set of data values and determines the
largest value in the set. The largest value is taken from the
vector and stored into LARGE at the termination of the program.
.ll 75
.sp 2
.nf
A>\c
.sh
ED SCAN.ASM \c
.qs
Create source program;
" " represents carriage return.
*I
ORG 1-00H ;START OF TRANSIENT
;AREA
MVI B, LEN ;LENGTH OF VECTOR TO SCAN
MVI C, 0 ;LARGER_RST VALUE SO FAR
LOOP LXI H, VECT ;BASE OF VECTOR
LOOP: MOV A, M ;GET VALUE
SUB C ;LARGER VALUE IN C?
JNC NFOUND ;JUMP IF LARGER VALUE NOT
;FOUND
; NEW LARGEST VALUE, STORE IT TO C
MOV C, A
NFOUND INX H ;TO NEXT ELEMENT
DCR B ;MORE TO SCAN?
JNZ LOOP ;FOR ANOTHER
;
; END OF SCAN, STORE C
MOV A, C ;GET LARGEST VALUE
STA LARGE
JMP 0 ;REBOOT
;
; TEST DATA
VECT: DB 2,0,4,3,5,6,1,5
LEN EQU $-VECT ;LENGTH
LARGE: DS 1 ;LARGEST VALUE ON EXIT
END
.bp
^-Z
*B0P
ORG 100H ;START OF TRANSIENT AREA
MVI B,LEN ;LENGTH OF VECTOR TO SCAN
MVI C,0 ;LARGEST VALUE SO FAR
LXI H,VECT ;BASE OF VECTOR
LOOP: MOV A,M ;GET VALUE
SUB C ;LARGER VALUE IN C?
JNC NFOUND ;JUMP IF LARGER VALUE NOT
;FOUND
; NEW LARGEST VALUE, STORE IT TO C
MOV C,A
NFOUND: INX H ;TO NEXT ELEMENT
DCR B ;MORE TO SCAN?
JNZ LOOP ;FOR ANOTHER
; END OF SCAN, STORE C
MOV A,C ;GET LARGEST VALUE
STA LARGE
JMP 0 ;REBOOT
;
; TEST DATA
VECT: DB 2,0,4,3,5,6,1,5
LEN EQU $-VECT ;LENGTH
LARGE: DS 1 ;LARGEST VALUE ON EXIT
END
*E <--End of edit
A>\c
.sh
ASM SCAN \c
.qs
Start Assembler
CP/M ASSEMBLER - VER 1.0
0122
002H USE FACTOR
END OF ASSEMBLY Assembly complete; lock at program listing
A>\c
.sh
TYPE SCAN.PRN
.qs
Code address Source program
0100 ORG 100H ;START OF TRANSIENT AREA
0100 0608 MVI B,LEN ;LENGTH OF VECTOR TO SCAN
0102 0E00 Machine code MVI C,0 ;LARGEST VALUE SO FAR
0104 211901 LXI H,VECT. ;BASE OF VECTOR
0107 7E LOOP: MOV A,M ;GET VALUE
0108 91 SUB C ;LARGER VALUE IN C?
0109 D20D01 JNC NFOUND ;JUMP IF LARGER VALUE NOT
;FOUND
; NEW LARGEST VALUE, STORE IT TO C
010C 4F MOV C,A
.bp
010D 23 NFOUND: INX H ;TO NEXT ELEMENT
010E 05 DCR B ;MORE TO SCAN?
010F C20701 JNZ LOOP ;FOR ANOTHER
;
; END OF SCAN, STORE C
0112 79 MOV A,C ;GET LARGEST VALUE
0113 322101 STA LARGE
0116 C30000 JMP 0 ;REBOOT
Code--data listing;
truncated ; TEST DATA
0119 0200040305 VECT: DB 2,0,4,3,5,6,1,5
0008 = Value of LEN EQU $-VECT ;LENGTH
0121 equate LARGE: DS 1 ;LARGEST VALUE ON EXIT
0122 END
A>\c
.sh
DDT SCAN.HEX \c
.qs
Start debugger using hex format machine code
DDT VER 1.0
NEXT PC Next instruction
0121 0000 to execute at
-X Last load address + 1 PC=0
C0Z0M0E0I0 A=00 B=0000 D=0000 H=0000 S=0100 P=0000 OUT 7F
-XP Examine registers before debug run
P=0000 100 Change PC to 100
-X Look at registers again
C0Z0M0E0I0 A=00 B=0000 D=0000 H=0000 S=0100 P=0100 MVI B,08
-L100
PC changed Next instruction
to execute at PC=100
0100 MVI B,08
0102 MVI C,00
0104 LXI H,0119
0107 MOV A,M
0108 SUB C Disassembled machine
0109 JNC 010D code at 100H
010C MOV C,A (see source listing
010D INX H for comparison)
010E DCR B
010F JNZ 0107
0112 MOV A,C
-L
.bp
0113 STA 0121
0116 JMP 0000
0119 STAX B
011A NOP A little more machine
011B INR B code. Note that pro-
011C INX B gram ends at location
011D DCR B 116 with a JMP to
011E MVI B,01 0000. Remainder of
0120 DCR B listing is assembly of
0121 LXI D,2200 data.
0124 LXI H,0200
-A116 Enter in-line assembly mode to change the JMP to 0000 into a RST 7,
which will cause the program under test to return to DDT if 116H is
ever executed.
0116 RST 7
0117 (Single carriage return stops assemble mode)
-L113 List code at 113H to check that RST 7 was properly inserted
0113 STA 0121
0116 RST 07 in place of JMP
0117 NOP
0118 NOP
0119 STAX B
011A NOP
011B INR B
011C INX B
-
-X Look at registers
C0Z0M0E0I0 A=00 B=0000 D=0000 H=0000 S=0100 P=0100 MVI B,08
-T
Execute Program for one stop. Initial CPU state, before is executed
C0Z0M0E0I0 A=00 B=0000 D=0000 H=0000 S=0100 P=0100 MVI B,08*0102
Automatic breakpoint
Trace one step again (note O8H in B)
C0Z0M0E0I0 A=00 B=0800 D=0000 H=0000 S=0100 P=0102 MVI C,00*0104
-T
Trace again (Register C is cleared)
C0Z0M0E0I0 A=00 B=0800 D=0000 H=0000 S=0100 P=0104 LXI H,0119*0107
-T3 Trace three steps
C0Z0M0E0I0 A=00 B=0800 D=0000 H=0119 S=0100 P=0107 MOV A,M
C0Z0M0E0I0 A=02 B=0800 D=0000 H=0119 S=0100 P=0108 SUB C
C0Z0M0E0I1 A=02 B=0800 D=0000 H=0119 S=0100 P=0109 JNC 010D*010D
-D119
Display memory starting at 119H. Automatic breakpoint at 10DH
0119 02 00 04 03 05 06 01.Program data Lower-case x
0120 05 11 00 22 21 00 02 7E EB 77 13 23 EB 0B 78 B1 ..."!.. . W .#..X.
0130 C2 27 01 C3 03 29 00 00 00 00 00 00 00 00 00 00 ...' ...).........
0140 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ..................
0150 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ..................
0160 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 Data are displayed
0170 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 in ASCI with a "."
0180 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 in the position of
0190 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 nongraphic........
01A0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 characters........
01B0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ..................
01C0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ..................
-X
Current CPU state
C0Z0M0E0I1 A=02 B=0800 D=0000 H=0119 S=0100 P=010D INX H
-T5
Trace 5 steps from current CPU state
C0Z0M0E0I1 A=02 B=0800 D=0000 H=0119 S=0100 P=010D INX H
C0Z0M0E0I1 A=02 B=0800 D=0000 H=011A S=0100 P=010E DCR B
C0Z0M0E0I1 A=02 B=0700 D=0000 H=011A S=0100 P=010F JNZ 0107
C0Z0M0E0I1 A=02 B=0700 D=0000 H=011A S=0100 P=0107 MOV A,M
C0Z0M0E0I1 A=00 B=0700 D=0000 H=011A S=0100 P=0108 SUB C*0109
U5
Automatic breakpoint
Trace without listing intermediate states
C0Z1M0E1I1 A=00 B=0700 D=0000 H=011A S=0100 P=0109 JNC 010D*0108
-X
CPU state at end of U5
C0Z0M0E1I1 A=04 B=0600 D=0000 H=011B S=0100 P=0108 SUB C
-G Run program from current PC until completion (in real-time)
*0116 breakpoint at 116H, caused by executing RST 7 in machine code.
-X
CPU state at end of program
C0Z1M0E1I1 A=00 B=0000 D=0000 H=0121 S=0100 P=0116 RST 07
-XP
Examine and change program counter
P=0116 100
-X
C0Z1M0E1I1 A=00 B=0000 D=0000 H=0121 S=0100 P=0100 MVI B,08
-T10
First data element
Current largest value
Subtract for comparison C
Trace 10 (hexadecimal) steps
C0Z1M0E1I1 A=00 B=0800 D=0000 H=0121 S=0100 P=0100 MVI B,08
C0Z1M0E1I1 A=00 B=0000 D=0000 H=0121 S=0100 P=0102 MVI C,00
C0Z1M0E1I1 A=00 B=0800 D=0000 H=0121 S=0100 P=0104 LXI H,0119
C0Z1M0E1I1 A=00 B=0800 D=0000 H=0119 S=0100 P=0107 MOV A,M
C0Z1M0E1I1 A=02 B=0800 D=0000 H=0119 S=0100 P=0108 SUB C
C0Z0M0E0I1 A=02 B=0800 D=0000 H=0119 S=0100 P=0109 JNC 010D
C0Z0M0E0I1 A=02 B=0800 D=0000 H=0119 S=0100 P=010D INX H
C0Z0M0E0I1 A=02 B=0800 D=0000 H=011A S=0100 P=010E DCR B
C0Z0M0E0I1 A=02 B=0700 D=0000 H=011A S=0100 P=010F JNZ 0107
C0Z0M0E0I1 A=02 B=0700 D=0000 H=011A S=0100 P=0107 MOV A,M
C0Z0M0E0I1 A=00 B=0700 D=0000 H=011A S=0100 P=0108 SUB C
C0Z1M0E1I1 A=00 B=0700 D=0000 H=011A S=0100 P=0109 JNC 010D
C0Z1M0E1I1 A=00 B=0700 D=0000 H=011A S=0100 P=010D INX H
C0Z1M0E1I1 A=00 B=0700 D=0000 H=011B S=0100 P=010E DCR B
C0Z0M0E1I1 A=00 B=0600 D=0000 H=011B S=0100 P=010F JNZ 0107
C0Z0M0E1I1 A=00 B=0600 D=0000 H=011B S=0100 P=0107 MOV A,M*0108
-A109
Insert a "hot patch" into Program should have moved the
the machine code value from A into C since A>C.
0109 JC 10D to change the Since this code was not executed,
JNC to JC it appears that the JNC should
010C have been a JC instruction
Stop DDT so that a version of
-G0 the patched program can be saved
A>\c
.sh
SAVE 1 SCAN.COM \c
.qs
Program resides on first
page, so save 1 page.
A>\c
.sh
DDT SCAN.COM
.qs
Restart DDT with the save memory
DDT VER 1.0 image to continue testing
NEXT PC
0200 0100
-L100 List some code
0100 MVI B,08
0102 MVI C,00
0104 LXI H,0119
0107 MOV A,M
0108 SUB C
0109 JC 010D Previous patch is present in X.COM
010C MOV C,A
010D INX H
010E DCR B
010F JNZ 0107
0112 MOV A,C
-XP
P=0100
-T10
Trace to see how patched version operates Data is moved from A to C
C0Z0M0E0I0 A=00 B=0000 D=0000 H=0000 S=0100 P=0100 MVI B,08
C0Z0M0E0I0 A=00 B=0800 D=0000 H=0000 S=0100 P=0102 MVI C,00
C0Z0M0E0I0 A=00 B=0800 D=0000 H=0000 S=0100 P=0104 LXI H,0119
C0Z0M0E0I0 A=00 B=0800 D=0000 H=0119 S=0100 P=0107 MOV A,M
C0Z0M0E0I0 A=02 B=0800 D=0000 H=0119 S=0100 P=0108 SUB C
C0Z0M0E0I1 A=02 B=0800 D=0000 H=0119 S=0100 P=0109 JC 010D
C0Z0M0E0I1 A=02 B=0800 D=0000 H=0119 S=0100 P=010C MOV C,A
C0Z0M0E0I1 A=02 B=0802 D=0000 H=0119 S=0100 P=010D INX H
C0Z0M0E0I1 A=02 B=0802 D=0000 H=011A S=0100 P=010E DCR B
C0Z0M0E0I1 A=02 B=0702 D=0000 H=011A S=0100 P=010F JNZ 0107
C0Z0M0E0I1 A=02 B=0702 D=0000 H=011A S=0100 P=0107 MOV A,M
C0Z0M0E0I1 A=00 B=0702 D=0000 H=011A S=0100 P=0108 SUB C
C1Z0M1E0I0 A=FE B=0702 D=0000 H=011A S=0100 P=0109 JC 010D
C1Z0M1E0I0 A=FE B=0702 D=0000 H=011A S=0100 P=010D INX H
C1Z0M1E0I0 A=FE B=0702 D=0000 H=011B S=0100 P=010E DCR B
C1Z0M0E1I1 A=FE B=0602 D=0000 H=011B S=0100 P=010F JNZ 0107*0107
-X Breakpoint after 16 steps
C1Z0M0E1I1 A=FE B=0602 D=0000 H=011B S=0100 P=0107 MOV A,M
-G,108 Run from current PC and breakpoint at 108H
*0108
-X
Next data item
C1Z0M0E1I1 A=04 B=0602 D=0000 H=011B S=0100 P=0108 SUB C
-T
Single step for a few cycles
C1Z0M0E1I1 A=04 B=0602 D=0000 H=011B S=0100 P=0108 SUB C*0109
-T
C0Z0M0E0I1 A=02 B=0602 D=0000 H=011B S=0100 P=0109 JC 010D*010C
-X
C0Z0M0E0I1 A=02 B=0602 D=0000 H=011B S=0100 P=010C MOV C,A
-G Run to completion
*0116
-X
C0Z1M0E1I1 A=03 B=0003 D=0000 H=0121 S=0100 P=0116 RST 07
-S121 Look at the value of "LARGE"
0121 03 Wrong value!
0122 00
0123 22
0124 21
0125 00
0126 02
0127 7E _\b. End of the S command
-L100
0100 MVI B,08
0102 MVI C,00
0104 LXI H,0119
0107 MOV A,M
0108 SUB C
0109 JC 010D
010C MOV C,A
010D INX H
010E DCR B
010F JNZ 0107
0112 MOV A,C
-L Review the code
0113 STA 0121
0116 RST 07
0117 NOP
0118 NOP
0119 STAX B
011A NOP
011B INR B
011C INX B
011D DCR B
011E MVI B,01
0120 DCR B
-XP
P=0116 100 Reset the PC
-T
Single step, and watch data values
C0Z1M0E1I1 A=03 B=0003 D=0000 H=0121 S=0100 P=0100 MVI B,08*0102
-T
C0Z1M0E1I1 A=03 B=0803 D=0000 H=0121 S=0100 P=0102 MVI C,00*0104
-T
Count set Largest set
C0Z1M0E1I1 A=03 B=0800 D=0000 H=0121 S=0100 P=0104 LXI H,0119*0107
-T
Base address of data set
C0Z1M0E1I1 A=03 B=0800 D=0000 H=0119 S=0100 P=0107 MOV A,M*0108
-T
First data item brought to A
C0Z1M0E1I1 A=02 B=0800 D=0000 H=0119 S=0100 P=0108 SUB C*0109
-T
C0Z0M0E0I1 A=02 B=0800 D=0000 H=0119 S=0100 P=0109 JC 010D*010C
-T
C0Z0M0E0I1 A=02 B=0800 D=0000 H=0119 S=0100 P=010C MOV C,A*010D
-T
First data item moved to C correctly
C0Z0M0E0I1 A=02 B=0802 D=0000 H=0119 S=0100 P=010D INX H*010E
-T
C0Z0M0E0I1 A=02 B=0802 D=0000 H=011A S=0100 P=010E DCR B*010F
-T
C0Z0M0E0I1 A=02 B=0702 D=0000 H=011A S=0100 P=010F JNZ 0107*0107
-T
C0Z0M0E0I1 A=02 B=0702 D=0000 H=011A S=0100 P=0107 MOV A,M*0108
-T
Second data item brought to A
C0Z0M0E0I1 A=00 B=0702 D=0000 H=011A S=0100 P=0108 SUB C*0109
-T
Subtract destroys data value that was loaded!
C1Z0M1E0I0 A=FE B=0702 D=0000 H=011A S=0100 P=0109 JC 010D*010D
-T
C1Z0M1E0I0 A=FE B=0702 D=0000 H=011A S=0100 P=010D INX H*010E
-L100
0100 MVI B,08
0102 MVI C,00
0104 LXI H,0119
0107 MOV A,M
0108 SUB C This should have been a CMP so that register A
0109 JC 010D would not be destroyed.
010C MOV C,A
010D INX H
010E DCR B
010F JNZ 0107
0112 MOV A,C
-A108
0108 CMP C Hot patch at 108H changes SUB to CMP
0109
-G0 Stop DDT for SAVE
A>\c
.sh
SAVE 1 SCAN.COM \c
.qs
Save memory image
A>\c
.sh
DDT SCAN.COM \c
.qs
Restart DDT
DDT VER 1.0
NEXT PC
0200 0100
-XP
P=0100
-L116
.mb 5
.fm 1
0116 RST 07
0117 NOP
0118 NOP Look at code to see if it was properly loaded
0119 STAX B (long typeout aborted with rubout)
011A NOP
-
-G,116 Run from 100H to completion
*0116
-XC Look at carry (accidental typo)
C1
-X Look at CPU state
.mb 6
.fm 2
C1Z1M0E1I1 A=06 B=0006 D=0000 H=0121 S=0100 P=0116 RST 07
-S121 Look at "large"--it appears to be correct.
0121 06
0122 00
0123 22
-G0 Stop DDT
A>\c
.sh
ED SCAN.ASM \c
.qs
Re-edit the source program, and make both changes
*NSUB
*0LT
CTRL-Z SUB C ;LARGER VALUE IN C?
*SSUB^\b|ZCMP^\b|Z0LT
CMP D ;LARGER VALUE IN C?
*
JNC NFOUND ;JUMP IF LARGER VALUE NOT FOUND
*SNC^\b|ZC^\b|Z0LT
JC NFOUND ;JUMP IF LARGER VALUE NOT FOUND
*E
Reassemble, selecting source from disk A
A>\c
.sh
ASM SCAN.AAZ \c
.qs
<--- Hex to disk A
Print to Z (selects no print file)
CP/M ASSEMBLER VER 1.0
0122
002H USE FACTOR
END OF ASSEMBLY
A>\c
.sh
DDT SCAN.HEX \c
.qs
Rerun debugger to check changes
DDT VER 1.0
NEXT PC
0121 0000
-L116
0116 JMP 0000 Check to ensure end is still at 116H
0119 STAX B
011A NOP
011B INR B
-(rubout)
-G100,116 Go from beginning with breakpoint at end
*0116 Breakpoint reached
-D121 Look at "LARGE"
Correct value computed
0121 06 00 22 21 00 02 7E EB 77 13 23 EB 0B 78 B1 .. '!... W .#..X.
0130 C2 27 01 C3 03 29 00 00 00 00 00 00 00 00 00 00 .'...)........
0140 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ..............
-(rubout) Aborts long typeout
G0 Stop DDT, debug session complete.
.ll 65
.sp 2
.ce
End of Section 4
.nx fivea


453
Source/Doc/CPM 22 Manual - Testing/front.tex

@ -1,453 +0,0 @@
.op
.sp 15
.ce 100
.sh
CP/M
.qs
.sp
.sh
Operating System
.qs
.sp
.sh
Manual
.qs
.cs 5
.sp 10
Copyright (c) 1982
.sp
Digital Research
P.O. Box 579
160 Central Avenue
Pacific Grove, CA 93950
(408) 649-3896
TWX 910 360 5001
.sp 4
All Rights Reserved
.ce 0
.bp
.po 17
.ll 50
.ce
COPYRIGHT
.sp
Copyright (c) 1976, 1977, 1978, 1979, 1982, 1983, and 1984 by
Digital Research Inc. All rights reserved. No part of this
publication may be reproduced, transmitted, transcribed, stored
in a retrieval system, or translated into any language or
computer language, in any form or by any means, electronic, mechanical,
magnetic, optical, chemical, manual or otherwise, without the prior
written permission of Digital Research Inc., Post Office Box 579,
Pacific Grove, California, 93950.
.sp
Thus, readers are granted permission to include the example
programs, either in whole or in part, in their own programs.
.sp 2
.ce
DISCLAIMER
.sp
Digital Research Inc. makes no representations or warranties with
respect to the contents hereof and specifically disclaims
any implied warranties of merchantability or fitness for
any particular purpose. Further, Digital Research Inc. reserves the
right to revise this publication and to make changes from
time to time in the content hereof without obligation of
Digital Research Inc. to notify any person of such revision or
changes.
.sp 2
.ce
TRADEMARKS
.sp
CP/M, CP/NET, and Digital Research and its logo are registered
trademarks of Digital Research. ASM, DESPOOL, DDT, LINK-80, MAC,
MP/M, PL/I-80 and SID are trademarks of Digital Research. IBM is
a registered trademark of International Business Machines. Intel
is a registered trademark of Intel Corporation. TI Silent 700 is
a trademark of Texas Instruments Incorporated. Zilog and Z80 are
registered trademarks of Zilog, Inc.
.mb 4
.fm 1
.sp 3
The \c
.ul
CP/M Operating System Manual \c
.qu
was prepared using the Digital Research TEX Text Formatter and printed
in the United States of America.
.sp 2
.ce 6
*********************************
* First Edition: 1976 *
* Second Edition: July 1982 *
* Third Edition: March 1983 *
* Fourth Edition: March 1984 *
*********************************
.po 10
.ll 65
.in 0
.bp
.cs 5
.mt 5
.mb 6
.pl 66
.ll 65
.po 10
.hm 2
.fm 2
.he
.ft iii
.bp
.ce
.sh
Table of Contents
.qs
.sp 3
.nf
.sh
1 CP/M Features and Facilities
.qs
.sp
1.1 Introduction . . . . . . . . . . . . . . . . . . . 1-1
.sp
1.2 Functional Description . . . . . . . . . . . . . . 1-3
.sp
1.2.1 General Command Structure . . . . . . . . . 1-3
1.2.2 File References . . . . . . . . . . . . . . 1-3
.sp
1.3 Switching Disks . . . . . . . . . . . . . . . . . . 1-5
1.4 Built-in Commands . . . . . . . . . . . . . . . . . 1-6
.sp
1.4.1 ERA Command . . . . . . . . . . . . . . . . 1-6
1.4.2 DIR Command . . . . . . . . . . . . . . . . 1-7
1.4.3 REN Command . . . . . . . . . . . . . . . . 1-8
1.4.4 SAVE Command . . . . . . . . . . . . . . . . 1-8
1.4.5 TYPE Command . . . . . . . . . . . . . . . . 1-9
1.4.6 USER Command . . . . . . . . . . . . . . . . 1-9
.sp
1.5 Line Editing and Output Control . . . . . . . . . . 1-10
.sp
1.6 Transient Commands . . . . . . . . . . . . . . . . 1-11
.sp
1.6.1 STAT Command . . . . . . . . . . . . . . . . 1-12
1.6.2 ASM Command . . . . . . . . . . . . . . . . 1-18
1.6.3 LOAD Command . . . . . . . . . . . . . . . . 1-19
1.6.4 PIP . . . . . . . . . . . . . . . . . . . . 1-20
1.6.5 ED Command . . . . . . . . . . . . . . . . . 1-29
1.6.6 SYSGEN Command . . . . . . . . . . . . . . . 1-31
1.6.7 SUBMIT Command . . . . . . . . . . . . . . . 1-33
1.6.8 DUMP Command . . . . . . . . . . . . . . . . 1-35
1.6.9 MOVCPM Command . . . . . . . . . . . . . . . 1-35
.sp
1.7 BDOS Error Messages . . . . . . . . . . . . . . . . 1-37
.sp
1.8 CP/M Operation on the Model 800 . . . . . . . . . . 1-38
.sp 2
.sh
2 The CP/M Editor
.qs
.sp
2.1 Introduction to ED . . . . . . . . . . . . . . . . 2-1
.sp
2.1.1 ED Operation . . . . . . . . . . . . . . . . 2-1
2.1.2 Text Transfer Functions . . . . . . . . . . 2-3
2.1.3 Memory Buffer Organization . . . . . . . . . 2-4
2.1.4 Line Numbers and ED Start-up . . . . . . . . 2-5
2.1.5 Memory Buffer Operation . . . . . . . . . . 2-6
2.1.6 Command Strings . . . . . . . . . . . . . . 2-7
2.1.7 Text Search and Alteration . . . . . . . . . 2-10
2.1.8 Source Libraries . . . . . . . . . . . . . . 2-13
2.1.9 Repetitive Command Execution . . . . . . . . 2-14
.bp
.ft iv
.ce
.sh
Table of Contents
.qs
.sp
.ce
.sh
(continued)
.qs
.sp 3
2.2 ED Error Conditions . . . . . . . . . . . . . . . . 2-14
.sp
2.3 Control Characters and Commands . . . . . . . . . . 2-16
.sp 2
.sh
3 CP/M Assembler
.qs
.sp
3.1 Introduction . . . . . . . . . . . . . . . . . . . 3-1
.sp
3.2 Program Format . . . . . . . . . . . . . . . . . . 3-3
.sp
3.3 Forming the Operand . . . . . . . . . . . . . . . . 3-4
.sp
3.3.1 Labels . . . . . . . . . . . . . . . . . . . 3-4
3.3.2 Numeric Constants . . . . . . . . . . . . . 3-5
3.3.3 Reserved Words . . . . . . . . . . . . . . . 3-5
3.3.4 String Constants . . . . . . . . . . . . . . 3-6
3.3.5 Arithmetic and Logical Operators . . . . . . 3-7
3.3.6 Precedence of Operators . . . . . . . . . . 3-8
.sp
3.4 Assembler Directives . . . . . . . . . . . . . . . 3-9
.sp
3.4.1 The ORG Directive . . . . . . . . . . . . . 3-10
3.4.2 The END Directive . . . . . . . . . . . . . 3-10
3.4.3 The EQU Directive . . . . . . . . . . . . . 3-11
3.4.4 The SET Directive . . . . . . . . . . . . . 3-11
3.4.5 The IF and ENDIF Directives . . . . . . . . 3-12
3.4.6 The DB Directive . . . . . . . . . . . . . . 3-13
3.4.7 The DW Directive . . . . . . . . . . . . . . 3-14
3.4.8 The DS Directive . . . . . . . . . . . . . . 3-14
.sp
3.5 Operation Codes . . . . . . . . . . . . . . . . . . 3-15
.sp
3.5.1 Jumps, Calls, and Returns . . . . . . . . . 3-15
3.5.2 Immediate Operand Instructions . . . . . . . 3-17
3.5.3 Increment and Decrement Instructions . . . . 3-17
3.5.4 Data Movement Instructions . . . . . . . . . 3-18
3.5.5 Arithmetic Logic Unit Operations . . . . . . 3-19
3.5.6 Control Instructions . . . . . . . . . . . . 3-21
.sp
3.6 Error Messages . . . . . . . . . . . . . . . . . . 3-21
.sp
3.7 A Sample Session . . . . . . . . . . . . . . . . . 3-23
.bp
.ft v
.ce
.sh
Table of Contents
.qs
.sp
.ce
.sh
(continued)
.qs
.sp 3
.sh
4 CP/M Dynamic Debugging Tool
.qs
.sp
4.1 Introduction . . . . . . . . . . . . . . . . . . . 4-1
.sp
4.2 DDT Commands . . . . . . . . . . . . . . . . . . . 4-3
.sp
4.2.1 The A (Assembly) Command . . . . . . . . . . 4-3
4.2.2 The D (Display) Command . . . . . . . . . . 4-4
4.2.3 The F (Fill) Command . . . . . . . . . . . . 4-5
4.2.4 The G (Go) Command . . . . . . . . . . . . . 4-5
4.2.5 The I (Input) Command . . . . . . . . . . . 4-6
4.2.6 The L (List) Command . . . . . . . . . . . . 4-6
4.2.7 The M (Move) Command . . . . . . . . . . . . 4-7
4.2.8 The R (Read) Command . . . . . . . . . . . . 4-7
4.2.9 The S (Set) Command . . . . . . . . . . . . 4-8
4.2.1- The T (Trace) Command . . . . . . . . . . . 4-8
4.2.11 The U (Untrace) Command . . . . . . . . . . 4-9
4.2.12 The X (Examine) Command . . . . . . . . . . 4-9
.sp
4.3 Implementation Notes . . . . . . . . . . . . . . . 4-10
.sp
4.4 A Sample Program . . . . . . . . . . . . . . . . . 4-11
.sp 2
.sh
5 CP/M 2 System Interface
.qs
.sp
5.1 Introduction . . . . . . . . . . . . . . . . . . . 5-1
.sp
5.2 Operating System Call Conventions . . . . . . . . . 5-3
.sp
5.3 A Sample File-to-File Copy Program . . . . . . . . 5-35
.sp
5.4 A Sample File Dump Utility . . . . . . . . . . . . 5-38
.sp
5.5 A Sample Random Access Program . . . . . . . . . . 5-42
.sp
5.6 System Function Summary . . . . . . . . . . . . . . 5-50
.sp 2
.sh
6 CP/M 2 Alteration
.qs
.sp
6.1 Introduction . . . . . . . . . . . . . . . . . . . 6-1
.sp
6.2 First-level System Regeneration . . . . . . . . . . 6-2
.sp
6.3 Second-level System Generation . . . . . . . . . . 6-5
.sp
6.4 Sample GETSYS and PUTSYS Programs . . . . . . . . . 6-9
.bp
.ft vi
.ce
.sh
Table of Contents
.qs
.sp
.ce
.sh
(continued)
.qs
.sp 3
6.5 Disk Organization . . . . . . . . . . . . . . . . . 6-11
.sp
6.6 The BIOS Entry Points . . . . . . . . . . . . . . . 6-13
.sp
6.7 A Sample BIOS . . . . . . . . . . . . . . . . . . . 6-21
.sp
6.8 A Sample Cold Start Loader . . . . . . . . . . . . 6-21
.sp
6.9 Reserved Locations in Page Zero . . . . . . . . . . 6-22
.sp
6.10 Disk Parameter Tables . . . . . . . . . . . . . . 6-23
.sp
6.11 The DISKDEF Macro Library . . . . . . . . . . . . 6-28
.sp
6.12 Sector Blocking and Deblocking . . . . . . . . . . 6-32
.bp
.ft vii
.ce
.sh
Appendixes
.qs
.sp 3
.sh
A \c
.qs
Basic Input/Output System (BIOS) . . . . . . . . . . . A-1
.sp 2
.sh
B \c
.qs
A Skeletal CBIOS . . . . . . . . . . . . . . . . . . . B-1
.sp 2
.sh
C \c
.qs
A Skeletal GETSYS/PUTSYS Program . . . . . . . . . . . C-1
.sp 2
.sh
D \c
.qs
The Model 800 Cold Start Loader for CP/M 2 . . . . . . D-1
.sp 2
.sh
E \c
.qs
A Skeletal Cold Start Loader . . . . . . . . . . . . . E-1
.sp 2
.sh
F \c
.qs
CP/M Disk Definition Library . . . . . . . . . . . . . F-1
.sp 2
.sh
G \c
.qs
Blocking and Deblocking Algorithms . . . . . . . . . . G-1
.sp 2
.sh
H \c
.qs
Glossary . . . . . . . . . . . . . . . . . . . . . . . H-1
.sp 2
.sh
I \c
.qs
CP/M Error Messages . . . . . . . . . . . . . . . . . . I-1
.bp
.ft viii
.ce
.sh
Tables, Figures, and Listings
.qs
.sp 3
.sh
Tables
.qs
.sp
1-1. Line-editing Control Characters . . . . . . . . 1-10
1-2. CP/M Transient Commands . . . . . . . . . . . . 1-11
1-3. Physical Devices . . . . . . . . . . . . . . . 1-14
1-4. PIP Parameters . . . . . . . . . . . . . . . . 1-24
.sp
2-1. ED Text Transfer Commands . . . . . . . . . . . 2-3
2-2. Editing Commands . . . . . . . . . . . . . . . 2-6
2-3. Line-editing Controls . . . . . . . . . . . . . 2-7
2-4. Error Message Symbols . . . . . . . . . . . . . 2-13
2-5. ED Control Characters . . . . . . . . . . . . . 2-14
2-6. ED Commands . . . . . . . . . . . . . . . . . . 2-15
.sp
3-1. Reserved Characters . . . . . . . . . . . . . . 3-6
3-2. Arithmetic and Logical Operators . . . . . . . 3-7
3-3. Assembler Directives . . . . . . . . . . . . . 3-9
3-4. Jumps, Calls, and Returns . . . . . . . . . . . 3-15
3-5. Immediate Operand Instructions . . . . . . . . 3-16
3-6. Increment and Decrement Instructions . . . . . 3-17
3-7. Data Movement Instructions . . . . . . . . . . 3-17
3-8. Arithmetic Logic Unit Operations . . . . . . . 3-18
3-9. Error Codes . . . . . . . . . . . . . . . . . . 3-20
3-10. Error Messages . . . . . . . . . . . . . . . . 3-21
.sp
4-1. Line-editing Controls . . . . . . . . . . . . . 4-2
4-2. DDT Commands . . . . . . . . . . . . . . . . . 4-2
4-3. CPU Registers . . . . . . . . . . . . . . . . . 4-9
.sp
5-1. CP/M Filetypes . . . . . . . . . . . . . . . . 5-6
5-2. File Control Block Fields . . . . . . . . . . . 5-7
5-3. Edit Control Characters . . . . . . . . . . . . 5-20
.sp
6-1. Standard Memory Size Values . . . . . . . . . . 6-2
6-2. Common Values for CP/M Systems . . . . . . . . 6-7
6-3. CP/M Disk Sector Allocation . . . . . . . . . . 6-11
6-4. IOBYTE Field Values . . . . . . . . . . . . . . 6-15
6-5. BIOS Entry Points . . . . . . . . . . . . . . . 6-16
6-6. Reserved Locations in Page Zero . . . . . . . . 6-21
6-7. Disk Parameter Headers . . . . . . . . . . . . 6-23
6-8. BSH and BLM Values . . . . . . . . . . . . . . 6-25
6-9. EXM Values . . . . . . . . . . . . . . . . . . 6-25
6-10. BLS Tabluation . . . . . . . . . . . . . . . . 6-26
.sp
I-1. CP/M Error Messages . . . . . . . . . . . . . . I-1
.sp 2
.sh
Figures
.qs
.sp
2-1. Overall ED Operation . . . . . . . . . . . . . 2-2
2-2. Memory Buffer Organization . . . . . . . . . . 2-2
.bp
.ft ix
.ce
.sh
Tables, Figures, and Listings
.qs
.sp
.ce
.sh
(continued)
.qs
.sp 3
.sh
Figures
.qs
.sp
2-3. Logical Organization of Memory Buffer . . . . . 2-4
.sp
5-1. CP/M Memory Organization . . . . . . . . . . . 5-1
5-2. File Control Block Format . . . . . . . . . . . 5-7
.sp
6-1. IOBYTE Fields . . . . . . . . . . . . . . . . . 6-15
6-2. Disk Parameter Header Format . . . . . . . . . 6-22
6-3. Disk Parameter Header Table . . . . . . . . . . 6-23
6-4. Disk Parameter Block Format . . . . . . . . . . 6-24
6-5. AL0 and AL1 . . . . . . . . . . . . . . . . . . 6-25
.sp 2
.sh
Listings
.qs
.sp
6-1. GETSYS Program . . . . . . . . . . . . . . . . 6-9
6-2. BIOS Entry Points . . . . . . . . . . . . . . . 6-13
.nx onea


468
Source/Doc/CPM 22 Manual - Testing/index.tex

@ -1,468 +0,0 @@
.bp 1
.op
.cs 5
.mt 5
.mb 6
.pl 66
.ll 65
.po 10
.hm 2
.fm 2
.he
.ft Index-%
.nf
.ce
.sh
Index
.qs
.sp 3
.sh
A
.qs
Absolute line number, 36
Access mode, 13
afn (ambiguous file
reference), 3, 4, 6
Allocation vector, 105
Ambiguous file reference
(afn), 3, 4, 6
ASM, 15, 47
Assembler, 15, 47
Assembler/disassembler module
(DDT), 77
Assembler errors, 62
Assembly language mnemonics
in DDT, 71, 74
Assembly language program, 49
Assembly language statement, 49
Automatic command
processing, 25
.sp
.sh
B
.qs
.sp
Base, 50
Basic Disk Operating System
(BDOS), 2, 89, 127
Basic I/O System (BIOS),
2, 89, 127
BDOS (Basic Disk Operating
System), 2, 89, 127
Binary constants, 50
BIOS (Basic I/O System),
2, 89, 127
BIOS disk definition, 137, 148
subroutines
Block move command, 74
bls parameter, 149
BOOT, 90, 136, 140
entry point
Break point, 71, 73
Built-in commands, 3
.sp
.sh
C
.qs
.sp
Case translation, 5, 6, 20,
37, 39, 44, 45, 51, 95
CCP (Console Command
Processor), 2, 69, 89, 127
CCP Stack, 92
Character pointer, 35
CKS parameter, 149
Close File function, 101
Code and data areas, 144
Cold start loader, 136,
140, 143
Combine files, 17
Command, 3
Command line, 90
Comment field, 49
Compute File Size
function, 108
Condition flags, 58, 77
Conditional assembly, 56
CONIN, 140
CONOUT, 141
CONSOLE, 138
Console Command Processor
(CCP), 2, 69, 89, 127
Console Input function, 95
Console Output function, 96
CONST, 140
Constant, 50
Control characters, 9,
Control functions, 9
CTRL-Z character, 93
Copy files, 17
CPU state, 71
cr (carriage return), 39
Create files, 23
Create system disk, 24
Creating COM files, 16
Currently logged disk,
3, 5, 10, 17, 25
.sp
.sh
D
.qs
.sp
Data allocation size, 147
Data block number, 147
DB statement, 57
DDT commands, 70, 133
DDT nucleus, 77
DDT prompt, 70
DDT sign-on message, 69
Decimal constant, 50
Default FCB, 73
Delete File function, 102
DESPOOL, 138
Device assignment, 11
DIR, 6
DIR attribute, 14
dir parameter, 149
Direct console I/O
function, 97
Direct Memory Address, 104
Directory, 6
Directory code, 100, 101,
102, 103
Disassembler, 71, 77
Disk attributes, 11
Disk drive name, 5
Disk I/O functions, 99-110
Disk parameter block, 146
Disk parameter header, 145
Disk parameter table, 145
Disk statistics, 10
Disk-to-disk copy, 18
DISKDEF macro, 149
Diskette format, 31
DISKS macro, 150, 186
Display file contents, 8
dks parameter, 149
DMA, 104
DMA address, 93
dn parameter, 149
DPBASE, 146
Drive characteristics, 14
Drive select code, 94
Drive specification, 5
DS statement, 57
DUMP, 27, 113
DW statement, 57
.sp
.sh
E
.qs
.sp
ED, 23, 33-45, 131
ED commands, 38, 44
ED errors, 43
Edit command line, 9
8080 CPU registers, 76
8080 registers, 51
end-of-file, 19, 93
END statement, 49, 54
EMDEF macro, 150
ENDIF statement, 56
EQU statement, 55
ERA, 6
Erase files, 6
Error messages, 29, 43,
62, 153
Expression, 49
Extents, 13
.sp
.sh
F
.qs
.sp
FBASE, 89
FCB, 93, 94
FCB format, 93, 94
FDOS (operations), 89, 91
File attributes, 14
File compatibility, 23
File control block (FCB),
93, 94
File expansion, 128
File extent, 93
File indicators, 14
File names, 3
File reference, 3
File statistics, 10, 13
Filetype, 93
Find command, 39
fsc parameter, 149
.sp
.sh
G
.qs
.sp
Get ADDR (Alloc) function,
105
Get ADDR (Disk Parms)
function, 106
Get Console Status, 99
Get I/O Byte function, 97
Get Read/Only Vector
function, 105
GETSYS, 128, 134
.sp
.sh
H
.qs
.sp
Hexadecimal, 49, 50
Hex files, 16, 19, 20, 47
HOME subroutine, 139, 141
.sp
.sh
I
.qs
.sp
Identifier, 49, 50
IF statement, 56
Initialized storage areas, 57
In-line assembly language, 71
Insert mode, 37
Insert String, 40
IOBYTE function, 138, 139
.sp
.sh
J
.qs
.sp
Jump vector, 137
Juxtaposition command,41
.sp
.sh
K
.qs
.sp
Key fields, 109
.sp
.sh
L
.qs
.sp
Label field, 49
Labels, 48, 49, 58
Library read command, 42
Line-editing control
characters, 38, 70, 98
Line-editing functions, 9
Line numbers, 36
LIST, 138, 141
List Output function, 96
LISTST, 142
LOAD, 16
Logged in, 3
Logical devices, 11, 18, 138
Logical extents, 93
Logical-physical assignments,
12, 139
Logical to physical device
mapping, 138
Logical to physical sector
translation, 143, 149
Isc parameter, 149
.sp
.sh
M
.qs
.sp
Machine executable code, 16
Macro command, 42
Make File function, 103
Memory buffer, 33, 34, 35, 37
Memory image, 71, 131, 132
Memory image file, 16
Memory size, 27, 128, 132
MOVCPM, 27, 131, 132
Multiple command
processing, 25
.sp
.sh
N
.qs
.sp
{o} parameter, 149
Octal constant, 50
ofs parameter, 150
On-line status, 100
Open File function, 100
Operand field, 49-51
Operation field, 49-58
Operators, 52, 53, 58
ORG directive, 54
.sp
.sh
P
.qs
.sp
Page zero, 144
Patching the CP/M system, 128
Peripheral devices, 138
Physical devices, 12, 18, 139
Physical file size, 109
Physical to logical device
assignment, 12, 139
PIP, 17
PIP devices, 19
PIP parameters, 20
Print String function, 98
PRN file, 47
Program counter, 71, 73, 76
Program tracing, 75
Prompt, 3
Pseudo-operation, 53
PUNCH, 138, 141
Punch Output function, 96
PUTSYS, 129, 135
.sp
.sh
R
.qs
.sp
Radix indicators, 50
Random access, 107, 108, 117
Random record number, 108
READ, 142
Read Console Buffer
function, 98
Read only, 14
Read/only status, 14
Read random error codes, 107
Read Random function, 107
READ routine, 139
Read Sequential function, 102
Read/write, 14
READER, 138, 141
Reader Input function, 96
REN, 7
Rename file function, 104
Reset Disk function, 99
Reset Drive function, 109
Reset state, 99
Return Current Disk
function, 104
Return Log-in Vector
function, 104
Return Version Number
function, 99
R/O, 14
R/O, attribute, 106
R/O bit, 105
R/W, 14
.sp
.sh
S
.qs
.sp
SAVE, 7
SAVE command, 70
Search for First function, 101
Search for Next function, 102
Search strings, 39
Sector allocation, 136
SECTRAN, 143
SELDSK, 139, 141, 146
Select Disk function, 100
Sequential access, 93
Set DMA address function, 104
Set File Attributes
function, 106
Set/GET User Code
function, 106
Set I/O Byte function, 97
Set Random Record
function, 109
SET statement, 55
SETDMA, 142
SETSEC, 142
SETTRK, 141
Simple character I/O, 138
Size in records, 13
skf parameter, 149, 150
Source files, 93
Stack pointer, 92
STAT, 10, 139, 151
Stop console output, 9
String substitutions, 40
SUBMIT, 25
SYS attribute, 14
SYSGEN, 24, 134
System attribute, 44, 106
System parameters, 140
System (re)initialization, 138
System Reset function, 95
.sp
.sh
T
.qs
.sp
Testing and debugging of
programs, 69
Text transfer commands, 35
TPA (Transient Program Area),
2, 89
Trace mode, 76
Transient commands, 3, 9
Transient Program Area
(TPA), 2, 89
Translate table, 150
Translation vectors, 146
TYPE, 8
.sp
.sh
U
.qs
.sp
ufn, 3, 6
Unambiguous file reference,
3, 6
Uninitialized memory, 57
Untrace mode, 76
USER, 8
USER numbers, 8, 15, 106
.sp
.sh
V
.qs
.sp
Verify line numbers command,
37, 45
Version independent
programming, 99
Virtual file size, 108
.sp
.sh
W
.qs
.sp
Warm start, 90, 140
WBOOT entry point, 140
WRITE, 142
Write Protect Disk
function, 105
Write random error codes, 108
Write Random function, 108
Write Random with Zero Fill
function, 110
Write routine, 142
Write Sequential function, 103
.sp
.sh
X
.qs
.sp
XSOB, 26
.fi


993
Source/Doc/CPM 22 Manual - Testing/onea.tex

@ -1,993 +0,0 @@
.bp 1
.op
.cs 5
.mt 5
.mb 6
.pl 66
.ll 65
.po 10
.hm 2
.fm 2
.he
.ft 1-%
.pc 1
.tc 1 CP/M Features and Facilities
.ce 2
.sh
Section 1
.qs
.sp
.sh
CP/M Features and Facilities
.qs
.sp 3
.he CP/M Operating System Manual 1.1 Introduction
.tc 1.1 Introduction
.sh
1.1 Introduction
.qs
.fi
.pp 5
CP/M \ is a monitor control program for microcomputer system development that
uses floppy disks or Winchester hard disks for backup storage. Using a
computer system based on the Intel \ 8080 microcomputer, CP/M provides an
environment for program construction, storage, and editing, along
with assembly and program check-out facilities. CP/M can be easily
altered to execute with any computer
configuration that uses a Zilog \ Z80 \ or an Intel 8080 Central Processing
Unit (CPU) and has at least 20K bytes of main memory with up to 16 disk
drives. A detailed discussion of the modifications required for any
particular hardware environment is given in Section 6. Although the
standard Digital Research version operates on a single-density
Intel Model 800, microcomputer development system several different
hardware manufacturers support their own input-output (I/O) drivers for CP/M.
.pp
The CP/M monitor provides rapid access to programs through a comprehensive
file management package. The file subsystem supports a named file structure,
allowing dynamic allocation of file space as well as sequential and random
file access. Using this file system, a large number of programs can be
stored in both source and machine-executable form.
.pp
CP/M 2 is a high-performance, single console operating system that uses
table-driven techniques to allow field reconfiguration to match a wide
variety of disk capacities. All fundamental file restrictions are removed,
maintaining upward compatibility from previous versions of release 1.
.pp
Features of CP/M 2 include field specification of one to sixteen logical
drives, each containing up to eight megabytes. Any particular file can
reach the full drive size with the capability of expanding to thirty-two
megabytes in future releases. The directory size can be field-configured to
contain any reasonable number of entries, and each file is optionally tagged
with Read-Only and system attributes. Users of CP/M 2 are physically
separated by user numbers, with facilities for file copy operations from one
user area to another. Powerful relative-record random access functions are
present in CP/M 2 that provide direct access to any of the 65536 records of
an eight-megabyte file.
.pp
CP/M also supports ED, a powerful context editor, ASM , an Intel-compatible
assembler, and DDT , debugger subsystems. Optional software includes a
powerful
Intel-compatible macro assembler, symbolic debugger, along with various
high-level languages. When coupled with CP/M's Console Command
Processor (CCP),
the resulting facilities equal or exceed similar large computer facilities.
.pp
CP/M is logically divided into several distinct parts:
.sp
.in 3
.nf
o BIOS (Basic I/O System), hardware-dependent
o BDOS (Basic Disk Operating System)
o CCP (Console Command Processor)
o TPA (Transient Program Area)
.fi
.in 0
.pp
The BIOS provides the primitive operations necessary to access the disk
drives and to interface standard peripherals: teletype, CRT, paper tape
reader/punch, and user-defined peripherals. You can tailor
peripherals for any particular hardware environment by patching this
portion of
CP/M. The BDOS provides disk management by controlling one or more disk
drives containing independent file directories. The BDOS implements disk
allocation strategies that provide fully dynamic file construction while
minimizing head movement across the disk during access. The BDOS has entry
points that include the following primitive operations, which the
program accesses:
.sp
.in 5
.ti -2
o SEARCH looks for a particular disk file by name.
.ti -2
o OPEN opens a file for further operations.
.ti -2
o CLOSE closes a file after processing.
.ti -2
o RENAME changes the name of a particular file.
.ti -2
o READ reads a record from a particular file.
.ti -2
o WRITE writes a record to a particular file.
.ti -2
o SELECT selects a particular disk drive for further operations.
.in 0
.pp
The CCP provides a symbolic interface between your console and the
remainder of the CP/M system. The CCP reads the console device and
processes commands, which include listing the file directory, printing the
contents of files, and controlling the operation of transient programs, such
as assemblers, editors, and debuggers. The standard commands that are
available in the CCP are listed in Section 1.2.1.
.pp
The last segment of CP/M is the area called the Transient Program
Area (TPA). The TPA holds programs that are loaded from the disk under
command of the CCP. During program editing, for example, the TPA holds
the CP/M text editor machine code and data areas. Similarly, programs
created under CP/M can be checked out by loading and executing these
programs in the TPA.
.pp
Any or all of the CP/M component subsystems can be overlaid by an
executing program. That is, once a user's program is loaded into the TPA,
the CCP, BDOS, and BIOS areas can be used as the program's data area.
A bootstrap loader is programmatically accessible whenever the BIOS portion
is not overlaid; thus, the user program need only branch to the bootstrap
loader at the end of execution and the complete CP/M monitor is reloaded
from disk.
.pp
The CP/M operating system is partitioned into distinct modules, including
the BIOS portion that defines the hardware environment in which CP/M is
executing. Thus, the standard system is easily modified to any nonstandard
environment by changing the peripheral drivers to handle the custom system.
.bp
.tc 1.2 Functional Description
.he CP/M Operating System Manual 1.2 Functional Description
.sh
1.2 Functional Description
.qs
.pp
You interact with CP/M primarily through the CCP, which reads and
interprets commands entered through the console. In general, the CCP
addresses one of several disks that are on-line. The standard system
addresses up to sixteen different disk drives. These disk drives are
labeled A through P. A disk is logged-in if the CCP is currently
addressing the disk. To clearly indicate which disk is the currently logged
disk, the CCP always prompts the operator with the disk name followed by the
symbol >, indicating that the CCP is ready for another command. Upon
initial start-up, the CP/M system is loaded from disk A, and the CCP
displays the following message:
.sp
.ti 8
CP/M VER x.x
.sp
where x.x is the CP/M version number. All CP/M systems are initially set
to operate in a 20K memory space, but can be easily reconfigured to fit any
memory size on the host system (see Section 1.6.9). Following system
sign-on, CP/M automatically logs in disk A, prompts you with the
symbol A>, indicating that CP/M is currently addressing disk A, and
waits for a command. The commands are implemented at two levels: built-in
commands and transient commands.
.sp 2
.tc 1.2.1 General Command Structure
.sh
1.2.1 General Command Structure
.qs
.pp
Built-in commands are a part of the CCP program, while transient
commands are loaded into the TPA from disk and executed. The
following are built-in commands:
.sp
.in 3
.nf
o ERA erases specified files.
o DIR lists filenames in the directory.
o REN renames the specified file.
o SAVE saves memory contents in a file.
o TYPE types the contents of a file on the logged disk.
.in 0
.fi
.sp
Most of the commands reference a particular file or group of files. The
form of a file reference is specified in Section 1.2.2.
.sp 2
.tc 1.2.2 File References
.sh
1.2.2 File References
.qs
.pp
A file reference identifies a particular file or group of files on a
particular disk attached to CP/M. These file references are
either unambiguous (ufn) or ambiguous (afn). An unambiguous file
reference uniquely identifies a single file, while an ambiguous file
reference is satisfied by a number of different files.
.mb 5
.fm 1
.pp
File references consist of two parts: the primary filename and the
filetype. Although the filetype is optional, it usually is
generic. For example, the filetype ASM is used to denote that the file is an
assembly language source file, while the primary filename distinguishes each
particular source file. The two names are separated by a period, as shown
in the following example:
.bp
.ti 8
filename.typ
.sp
.mb 6
.fm 2
In this example, filename is the primary filename of eight characters or
less, and typ
is the filetype of no more than three characters. As mentioned above, the
name
.sp
.ti 8
filename
.sp
is also allowed and is equivalent to a filetype consisting of
three blanks. The characters used in specifying an unambiguous
file reference cannot contain any of the following special
characters:
.sp
.ti 8
< > . , ; : = ? * [ ] _ % | ( ) / \\textbackslash
.sp
while all alphanumerics and remaining special characters are allowed.
.pp
An ambiguous file reference is used for directory search and pattern
matching. The form of an ambiguous file reference is similar to an
unambiguous reference, except the symbol ? can be interspersed throughout
the primary and secondary names. In various commands throughout CP/M,
the ? symbol matches any character of a filename in the ? position.
Thus, the ambiguous reference
.sp
.ti 8
X?Z.C?M
.sp
matches the following unambiguous filenames
.sp
.ti 8
XYZ.COM
.sp
and
.sp
.ti 8
X3Z.CAM
.sp
The * wildcard character can also be used in an ambiguous file
reference. The * character replaces all or part of a filename or
filetype. Note that
.sp
.ti 8
*.*
.sp
equals the ambiguous file reference
.sp
.ti 8
????????.???
.sp
while
.sp
.ti 8
filename.*
.sp
and
.sp
.ti 8
*.typ
.sp
are abbreviations for
.sp
.ti 8
filename.???
.sp
and
.sp
.ti 8
????????.typ
.sp
respectively. As an example,
.sp
.ti 8
A>\c
.sh
DIR *.*
.qs
.sp
is interpreted by the CCP as a command to list the names of all disk files
in the directory. The following example searches only for a file
by the name X.Y:
.sp
.ti 8
A>\c
.sh
DIR X,Y
.qs
.sp
Similarly, the command
.sp
.ti 8
A>\c
.sh
DIR X?Y.C?M
.qs
.sp
causes a search for all unambiguous filenames on the disk that satisfy
this ambiguous reference.
.pp
The following file references are valid unambiguous file references:
.sp
.nf
.in 8
X
X.Y
XYZ
XYZ.COM
GAMMA
GAMMA.1
.fi
.in 0
.pp
As an added convenience, the programmer can generally specify the disk drive
name along with the filename. In this case, the drive name is given as a
letter A through P followed by a colon (:). The specified drive is
then logged-in before the file operation occurs. Thus, the following are
valid file references with disk name prefixes:
.sp
.nf
.in 8
A:X.Y
P:XYZ.COM
B:XYZ
B:X.A?M
C:GAMMA
C:*.ASM
.fi
.in 0
.sp
All alphabetic lower-case letters in file and drive names are translated to
upper-case when they are processed by the CCP.
.sp 2
.tc 1.3 Switching Disks
.he CP/M Operating System Manual 1.3 Switching Disks
.sh
1.3 Switching Disks
.qs
.mb 5
.fm 1
.pp
The operator can switch the currently logged disk by typing the disk drive
name, A through P, followed by a colon when the CCP is waiting for
console input. The following sequence of prompts and commands
can occur after the CP/M system is loaded from disk A:
.sp
.nf
.in 8
CP/M VER 2.2
A>\c
.sh
DIR \c
.qs
List all files on disk A.
A:SAMPLE ASM SAMPLE PRN
A>\c
.sh
B: \c
.qs
Switch to disk B.
B>\c
.sh
DIR *.ASM \c
.qs
List all ASM files on B.
B:DUMP ASM FILES ASM
b>\c
.sh
A: \c
.qs
Switch back to A.
.in 0
.fi
.mb 6
.fm 2
.sp 2
.tc 1.4 Built-in Commands
.he CP/M Operating System Manual 1.4 Built-in Commands
.sh
1.4 Built-in Commands
.qs
.pp
The file and device reference forms described can now be used to fully
specify the structure of the built-in commands. Assume the following
abbreviations in the description below:
.sp
.in 8
.nf
ufn unambiguous file reference
afn ambiguous file reference
.fi
.in 0
.sp
Recall that the CCP always translates lower-case characters to upper-case
characters internally. Thus, lower-case alphabetics are treated as if they
are upper-case in command names and file references.
.sp 2
.tc 1.4.1 ERA Command
.sh
1.4.1 ERA Command
.qs
.sp
.ul
Syntax:
.qu
.sp
.ti 8
ERA afn
.pp
The ERA (erase) command removes files from the currently logged-in
disk, for example, the disk name currently prompted by CP/M preceding the >.
The files that are erased are those that satisfy the ambiguous file
reference afn. The following examples illustrate the use of ERA:
.sp 2
.in 24
.ti -16
ERA X.Y The file named X.Y on the currently logged disk is removed
from the disk directory and the space is returned.
.sp
.ti -16
ERA X.* All files with primary name X are removed from the current
disk.
.sp
.ti -16
ERA *.ASM All files with secondary name ASM are removed from the
current disk.
.sp
.ti -16
ERA X?Y.C?M All files on the current disk that satisfy the ambiguous
reference X?Y.C?M are deleted.
.bp
.ti -16
ERA *.* Erase all files on the current disk. In this
case, the CCP prompts the console with the message
.sp
.nf
ALL FILES (Y/N)?
.fi
.sp
which requires a Y response before files are actually removed.
.sp
.ti -16
ERA b:*.PRN All files on drive B that satisfy the ambiguous
reference ????????.PRN are deleted, independently of the currently
logged disk.
.in 0
.sp 3
.tc 1.4.2 DIR Command
.sh
1.4.2 DIR Command
.qs
.sp
.ul
Syntax:
.qu
.sp
.ti 8
DIR afn
.pp
The DIR (directory) command causes the names of all files that satisfy the
ambiguous filename afn to be listed at the console device. As a special
case, the command
.sp
.ti 8
DIR
.sp
lists the files on the currently logged disk (the command DIR is
equivalent to the command DIR *.*). The following are valid DIR
commands:
.sp
.nf
.in 8
DIR X.Y
DIR X?Z.C?M
DIR ??.Y
.in 0
.fi
.pp
Similar to other CCP commands, the afn can be preceded by a drive name.
The following DIR commands cause the selected drive to be addressed before
the directory search takes place:
.sp
.in 8
.nf
DIR B:
DIR B:X.Y
DIR B:*.A?M
.fi
.in 0
.pp
If no files on the selected disk satisfy the directory request, the
message NO FILE appears at the console.
.bp
.tc 1.4.3 REN Command
.sh
1.4.3 REN Command
.qs
.sp
.ul
Syntax:
.qu
.sp
.ti 8
REN ufn1=ufn2
.pp
The REN (rename) command allows you to change the names of files on
disk. The file satisfying ufn2 is changed to ufn1. The currently logged
disk is assumed to contain the file to rename (ufn2). You can also
type a left-directed arrow instead of the equal sign if the console supports
this graphic character. The following are examples of the REN
command:
.sp 2
.in 31
.ti -23
REN X.Y=Q.R The file Q.R is changed to X.Y.
.ti -23
.sp
REN XYZ.COM=XYZ.XXX The file XYZ.XXX is changed to XYZ.COM.
.in 0
.fi
.sp
.pp
The operator precedes either ufn1 or ufn2 (or both) by an optional drive
address. If ufn1 is preceded by a drive name, then ufn2 is assumed to exist
on the same drive. Similarly, if ufn2 is preceded by a drive name, then
ufn1 is assumed to exist on the drive as well. The same drive must be
specified in both cases if both ufn1 and ufn2 are preceded by drive names.
The following REN commands illustrate this format:
.sp 2
.in 31
.ti -23
REN A:X.ASM=Y.ASM The file Y.ASM is changed to X.ASM on drive A.
.sp
.ti -23
REN B:ZAP.BAS=ZOT.BAS The file ZOT.BAS is changed to ZAP.BAS on drive B.
.sp
.ti -23
REN B:A.ASM=B:A.BAK The file A.BAK is renamed to A.ASM on drive B.
.in 0
.sp
.pp
If ufn1 is already present, the REN command responds with the
error FILE EXISTS and not perform the change. If ufn2 does not exist on
the specified disk, the message NO FILE is printed at the console.
.sp 2
.tc 1.4.4 SAVE Command
.sh
1.4.4 SAVE Command
.qs
.sp
.ul
Syntax:
.qu
.sp
.ti 8
SAVE n ufn
.pp
The SAVE command places n pages (256-byte blocks) onto disk from the TPA
and names this file ufn. In the CP/M distribution system, the TPA starts
at 100H (hexadecimal) which is the second page of memory. The SAVE command
must specify 2 pages of memory if the user's program occupies the area
from 100H through 2FFH. The machine code file can be subsequently loaded
and executed. The following are examples of the SAVE command:
.sp 2
.in 31
.ti -23
SAVE 3X.COM Copies 100H through 3FFH to X.COM.
.sp
.ti -23
SAVE 40 Q Copies 100H through 28FFH to Q. Note that 28 is the
page count in 28FFH, and that 28H = 2*16+8=40 decimal.
.sp
.ti -23
SAVE 4 X.Y Copies 100H through 4FFH to X.Y.
.in 0
.sp 2
The SAVE command can also specify a disk drive in the ufn portion of the
command, as shown in the following example:
.sp
.in 31
.ti -23
SAVE 10 B:ZOT.COM Copies 10 pages, 100H through 0AFFH, to the
file ZOT.COM on drive B.
.in 0
.sp 3
.tc 1.4.5 TYPE Command
.sh
1.4.5 TYPE Command
.qs
.sp
.ul
Syntax:
.qu
.sp
.ti 8
TYPE ufn
.pp
The TYPE command displays the content of the ASCII source file ufn on the
currently logged disk at the console device. The following are valid
TYPE commands:
.sp
.in 8
.nf
TYPE X.Y
TYPE X.PLM
TYPE XXX
.in 0
.fi
.pp
The TYPE command expands tabs, CTRL-I characters, assuming tab positions are
set at every eighth column. The ufn can also reference a drive name.
.sp
.in 24
.ti -16
TYPE B:X.PRN The file X.PRN from drive B is displayed.
.in 0
.sp 2
.tc 1.4.6 USER Command
.sh
1.4.6 USER Command
.qs
.sp
.ul
Syntax:
.qu
.sp
.ti 8
USER n
.pp
The USER command allows maintenance of separate files in the same
directory. In the syntax line, n is an integer value in the range 0 to
15. On cold start, the operator is automatically logged into user
area number 0, which is
compatible with standard CP/M 1 directories. You can issue the
USER command at any time to move to another logical area within the same
directory. Drives that are logged-in while addressing one user number are
automatically active when the operator moves to another. A user number is
simply a prefix that accesses particular directory entries on the active
disks.
.pp
The active user number is maintained until changed by a subsequent USER
command, or until a cold start when user 0 is again assumed.
.sp 2
.tc 1.5 Line Editing and Output Control
.he CP/M Operating System Manual 1.5 Line Editing and Output Control
.sh
1.5 Line Editing and Output Control
.qs
.pp
The CCP allows certain line-editing functions while typing command lines.
The CTRL-key sequences are obtained by pressing the control and letter keys
simultaneously. Further, CCP command lines are generally up to 255
characters in length; they are not acted upon until the carriage return key
is pressed.
.sp 2
.ce
.sh
Table 1-1. Line-editing Control Characters
.qs
.sp
.ll 60
.in 5
.nf
Character Meaning
.fi
.sp
.in 18
.ti -12
CTRL-C Reboots CP/M system when pressed at start of line.
.sp
.ti -12
CTRL-E Physical end of line; carriage is returned, but line is not sent
until the carriage return key is pressed.
.sp
.ti -12
CTRL-H Backspaces one character position.
.sp
.ti -12
CTRL-J Terminates current input (line feed).
.sp
.ti -12
CTRL-M Terminates current input (carriage return).
.sp
.ti -12
CTRL-P Copies all subsequent console output to the currently
assigned list device (see Section 1.6.1). Output is sent to the list device
and the console device until the next CTRL-P is pressed.
.sp
.ti -12
CTRL-R Retypes current command line; types a clean line following
character deletion with rubouts.
.sp
.ti -12
CTRL-S Stops the console output temporarily. Program execution and
output continue when you press any character at the console, for
example another CTRL-S. This feature stops output on high speed consoles,
such as CRTs, in order to view a segment of output before continuing.
.bp
.ll 65
.in 0
.ce
.sh
Table 1-1. (continued)
.qs
.sp
.ll 60
.in 5
.nf
Character Meaning
.fi
.sp
.in 18
.ti-12
CTRL-U Deletes the entire line typed at the console.
.sp
.ti -12
CTRL-X Same as CTRL-U.
.sp
.ti -12
CTRL-Z Ends input from the console (used in PIP and ED).
.sp
.ti -12
RUB/DEL Deletes and echoes the last character typed at the console.
.in 0
.ll 65
.sp 2
.tc 1.6 Transient Commands
.he CP/M Operating System Manual 1.6 Transient Commands
.sh
1.6 Transient Commands
.qs
.pp
Transient commands are loaded from the currently logged disk and executed in
the TPA. The transient commands for execution under the CCP are below.
Additional functions are easily defined by the user (see Section 1.6.3).
.sp 2
.ce
.sh
Table 1-2. CP/M Transient Commands
.qs
.sp
.ll 60
.in 5
.nf
Command Function
.fi
.sp
.in 16
.ti -11
STAT Lists the number of bytes of storage remaining on the currently
logged disk, provides statistical information about particular files, and
displays or alters device assignment.
.sp
.ti -11
ASM Loads the CP/M assembler and assembles the specified program from
disk.
.sp
.ti -11
LOAD Loads the file in Intel HEX machine code format and produces a
file in machine executable form which can be loaded into the TPA. This loaded
program becomes a new command under the CCP.
.sp
.ti -11
DDT Loads the CP/M debugger into TPA and starts execution.
.sp
.ti -11
PIP Loads the Peripheral Interchange Program for subsequent disk file
and peripheral transfer operations.
.sp
.ti-11
ED Loads and executes the CP/M text editor program.
.sp
.ti -11
SYSGEN Creates a new CP/M system disk.
.bp
.ll 65
.in 0
.ce
.sh
Table 1-2. (continued)
.qs
.sp
.ll 60
.in 5
.nf
Command Function
.fi
.sp
.in 16
.ti -11
SUBMIT Submits a file of commands for batch processing.
.sp
.ti -11
DUMP Dumps the contents of a file in hex.
.sp
.ti -11
MOVCPM Regenerates the CP/M system for a particular memory size.
.sp
.ll 65
.in 0
.pp
Transient commands are specified in the same manner as built-in commands, and
additional commands are easily defined by the user. For convenience, the
transient command can be preceded by a drive name which causes the transient
to be loaded from the specified drive into the TPA for execution. Thus, the
command
.sp
.ti 8
B:STAT
.sp
causes CP/M to temporarily log in drive B for the source of the STAT
transient, and then return to the original logged disk for subsequent
processing.
.sp 2
.tc 1.6.1 STAT Command
.sh
1.6.1 STAT Command
.qs
.sp
.ul
Syntax:
.qu
.sp
.in 8
.nf
STAT
STAT "command line"
.fi
.in 0
.pp
The STAT command provides general statistical information about file storage
and device assignment. Special forms of the command line allow the current
device assignment to be
examined and altered. The various command lines that can be specified are
shown with an explanation of each form to the right.
.sp 2
.in 24
.ti -16
STAT If you type an empty command line, the STAT transient
calculates the storage remaining on all active drives, and prints
one of the following messages:
.sp
.nf
d: R/W, SPACE: nnnK
.sp
d: R/O, SPACE: nnnK
.fi
.sp
for each active drive d:, where R/W indicates the drive can be read or
written, and R/O indicates the drive is Read-Only (a drive becomes R/O by
explicitly setting it to Read-Only, as shown below, or by inadvertently
changing disks without performing a warm start). The space remaining on
the disk in drive d: is given in kilobytes by nnn.
.sp
.ti -16
STAT d: If a drive name is given, then the drive is selected before
the storage is computed. Thus, the command STAT B: could be issued while
logged into drive A, resulting in the message
.sp
BYTES REMAINING ON B: nnnK
.sp
.ti -16
STAT afn The command line can also specify a set of files to be
scanned by STAT. The files that satisfy afn are listed in alphabetical
order, with storage requirements for each file under the heading:
.sp
.nf
RECS BYTES EXT D:FILENAME.TYP
rrrr bbbK ee d:filename.typ
.fi
.sp
where rrrr is the number of 128-byte records allocated to the file, bbb is
the number of kilobytes allocated to the file (bbb=rrrr*128/1024), ee is the
number of 16K extensions (ee=bbb/16), d is the drive name containing the
file (A...P), filename is the eight-character primary filename, and
typ is the three-character filetype. After listing the individual
files, the storage usage is summarized.
.sp
.ti -16
STAT d:afn The drive name can be given ahead of the afn. The specified
drive is first selected, and the form STAT afn is executed.
.sp
.ti -16
STAT d:=R/O This form sets the drive given by d to Read-Only, remaining
in effect until the next warm or cold start takes place. When a disk is
Read-Only, the message
.sp
BDOS ERR ON d: Read-Only
.sp
appears if there is an attempt to write to the Read-Only disk. CP/M
waits until a key is pressed before performing an automatic
warm start, at
which time the disk becomes R/W.
.in 0
.bp
.pp
The STAT command allows you to control the physical-to-logical device
assignment. See the IOBYTE function described in Sections 5 and 6. There
are four logical peripheral devices that are, at any particular instant, each
assigned one of several physical peripheral devices. The
following is a list of the four logical devices:
.sp 2
.in 5
.ti -2
o CON: is the system console device, used by CCP for communication with the
operator.
.sp
.ti -2
o RDR: is the paper tape reader device.
.sp
.ti -2
o PUN: is the paper tape punch device.
.sp
.ti -2
o LST: is the output list device.
.in 0
.sp
.pp
The actual devices attached to any particular computer system are driven by
subroutines in the BIOS portion of CP/M. Thus, the logical RDR: device, for
example, could actually be a high speed reader, teletype reader, or cassette
tape. To allow some flexibility in device naming and assignment, several
physical devices are defined in Table 1-3.
.sp 2
.ce
.sh
Table 1-3. Physical Devices
.qs
.ll 60
.in 5
.sp
.nf
Device Meaning
.fi
.sp
.in 14
.ti -8
TTY: Teletype device (slow speed console)
.sp
.ti -8
CRT: Cathode ray tube device (high speed console)
.sp
.ti -8
BAT: Batch processing (console is current RDR:, output goes to current
LST: device)
.sp
.ti -8
UC1: User-defined console
.sp
.ti -8
PTR: Paper tape reader (high speed reader)
.sp
.ti -8
UR1: User-defined reader #1
.sp
.ti -8
UR2: User-defined reader #2
.sp
.ti -8
PTP: Paper tape punch (high speed punch)
.sp
.ti -8
UP1: User-defined punch #1
.sp
.ti -8
UP2: User-defined punch #2
.sp
.ti -8
LPT: Line printer
.sp
.ti -8
UL1: User-defined list device #1
.in 0
.ll 65
.nx oneb


915
Source/Doc/CPM 22 Manual - Testing/oneb.tex

@ -1,915 +0,0 @@
.bp
.op
.cs 5
.mt 5
.mb 6
.pl 66
.ll 65
.po 10
.hm 2
.fm 2
.he CP/M Operating System Manual 1.6 Transient Commands
.ft 1-%
.pc 1
.pp 5
It is emphasized that the physical device names might not actually
correspond to devices that the names imply. That is, you can
implement the PTP: device as a cassette write operation. The exact
correspondence and driving subroutine is defined in the BIOS portion of
CP/M. In the standard distribution version of CP/M, these devices correspond
to their names on the Model 800 development system.
.pp
The command,
.sp
.ti 8
STAT VAL:
.sp
produces a summary of the available status commands, resulting in
the output:
.sp
.in 8
.nf
Temp R/O Disk d:$R/O
Set Indicator: filename.typ $R/O $R/W $SYS $DIR
Disk Status: DSK: d:DSK
Iobyte Assign:
.sp
.in 0
.fi
which gives an instant summary of the possible STAT commands and shows the
permissible logical-to-physical device assignments:
.sp
.in 8
.nf
CON: = TTY: CRT: BAT: UC1:
RDR: = TTY: PTR: UR1: UR2:
PUN: = TTY: PTP: UP1: UP2:
LST: = TTY: CRT: LPT: UL1:
.fi
.in 0
.sp
The logical device to the left takes any of the four physical assignments
shown to the right. The current logical-to-physical mapping is displayed by
typing the command:
.sp
.ti 8
STAT DEV:
.sp
This command produces a list of each logical device to the left and
the current
corresponding physical device to the right. For example, the list might
appear as follows:
.sp
.in 8
.nf
CON: = CRT:
RDR: = UR1:
PUN: = PTP:
LST: = TTY:
.fi
.in 0
.sp
The current logical-to-physical device assignment is changed by typing a STAT
command of the form:
.sp
.ti 8
STAT ld1 = pd1, ld2 = pd2, ... , ldn = pdn
.sp
where ld1 through ldn are logical device names and pd1 through pdn are
compatible physical device names. For example, ldi and pdi appear on the
same line
in the VAL: command shown above. The following example shows valid STAT
commands that change the
current logical-to-physical device assignments:
.sp
.in 8
.nf
STAT CON:=CRT:
STAT PUN:=TTY:, LST:=LPT:, RDR:=TTY:
.in 0
.fi
.pp
The command form,
.sp
.ti 8
STAT d:filename.typ $S
.sp
where d: is an optional drive name and filename.typ is an unambiguous or
ambiguous filename, produces the following output display format:
.sp 2
.in 8
.nf
Size Recs Bytes Ext Acc
.sp
48 48 6K 1 R/O A:ED.COM
55 55 12K 1 R/O (A:PIP.COM)
65536 128 16K 2 R/W A:X.DAT
.in 0
.fi
.sp 2
where the $S parameter causes the Size field to be displayed. Without the
$S, the Size field is skipped, but the remaining fields are displayed. The
Size field lists the virtual file size in records, while the Recs field
sums the number of virtual records in each extent. For files constructed
sequentially, the Size and Recs fields are identical. The Bytes field
lists the actual number of bytes allocated to the corresponding file. The
minimum allocation unit is determined at configuration time; thus, the number
of bytes corresponds to the record count plus the remaining unused space in
the last allocated block for sequential files. Random access files are given
data areas only when written, so the Bytes field contains the only accurate
allocation figure. In the case of random access, the Size field gives the
logical end-of-file record position and the Recs field counts the logical
records of each extent. Each of these extents, however, can contain
unallocated holes even though they are added into the record count.
.pp
The Ext field counts the number of physical extents allocated to the file.
The Ext count corresponds to the number of directory entries given to the
file. Depending on allocation size, there can be up to 128K
bytes (8 logical extents) directly addressed by a single directory entry. In a special case,
there are actually 256K bytes that can be directly addressed by a physical
extent.
.pp
The Acc field gives the R/O or R/W file indicator, which you can
change using the commands shown. The four command forms,
.sp
.nf
.in 8
STAT d:filename.typ $R/O
STAT d:filename.typ $R/W
STAT d:filename.typ $SYS
STAT d:filename.typ $DIR
.in 0
.fi
.sp
set or reset various permanent file indicators. The R/O indicator places the
file, or set of files, in a Read-Only status until changed by a subsequent
STAT command. The R/O status is recorded in the directory with the file so
that it remains R/O through intervening cold start operations. The R/W
indicator places the file in a permanent Read-Write status. The SYS
indicator attaches the system indicator to the file, while the DIR command
removes the system indicator. The filename.typ may be ambiguous or
unambiguous, but files whose attributes are changed are listed at the console
when the change occurs. The drive name denoted by d: is optional.
.pp
When a file is marked R/O, subsequent attempts to erase or write into the
file produce the following BDOS message at your screen:
.sp
.ti 8
BDOS Err on d: File R/O
.sp
lists the drive characteristics of the disk named by d: that is in the range
A:, B:,...,P:. The drive characteristics are listed in the
following format:
.sp
.nf
d: Drive Characteristics
65536: 128 Byte Record Capacity
8192: Kilobyte Drive Capacity
128: 32 Byte Directory Entries
0: Checked Directory Entries
1024: Records/Extent
128: Records/Block
58: Sectors/Track
2: Reserved Tracks
.fi
.sp
where d: is the selected drive, followed by the total record capacity
(65536 is an eight-megabyte drive), followed by the total capacity listed in
kilobytes. The directory size is listed next, followed by the checked
entries. The number of checked entries is usually identical to the directory
size for removable media, because this mechanism is used to detect changed
media during CP/M operation without an intervening warm start. For fixed
media, the number is usually zero, because the media are not changed without
at least a cold or warm start.
.pp
The number of records per extent determines
the addressing capacity of each directory entry (1024 times 128 bytes, or
128K in the previous example). The number of records per block shows the
basic allocation size (in the example, 128 records/block times 128 bytes per
record, or 16K bytes per block). The listing is then followed by the number
of physical sectors per track and the number of reserved tracks.
.pp
For logical
drives that share the same physical disk, the number of reserved tracks can
be quite large because this mechanism is used to skip lower-numbered disk
areas allocated to other logical disks. The command form
.sp
.ti 8
STAT DSK:
.sp
produces a drive characteristics table for all currently active drives. The
final STAT command form is
.sp
.ti 8
STAT USR:
.sp
which produces a list of the user numbers that have files on the currently
addressed disk. The display format is
.sp
.nf
.in 8
Active User: 0
Active Files: 0 1 3
.in 0
.fi
.sp
where the first line lists the currently addressed user number, as set by the
last CCP USER command, followed by a list of user numbers scanned from the
current directory. In this case, the active user number is 0 (default at cold
start) with three user numbers that have active files on the current disk.
The operator can subsequently examine the directories of the other user
numbers by logging in with USER 1 or USER 3 commands, followed by a DIR
command at the CCP level.
.sp 2
.tc 1.6.2 ASM Command
.sh
1.6.2 ASM Command
.qs
.sp
Syntax:
.sp
.ti 8
ASM ufn
.pp
The ASM command loads and executes the CP/M 8080 assembler. The ufn
specifies a source file containing assembly language statements, where the
filetype is assumed to be ASM and is not specified. The following ASM
commands are valid:
.sp
.nf
.in 8
ASM X
ASM GAMMA
.in 0
.fi
.sp
The two-pass assembler is automatically executed. Assembly errors that occur
during the second pass are printed at the console.
.pp
The assembler produces a file:
.sp
.ti 8
X.PRN
.sp
where X is the primary name specified in the ASM command. The PRN file
contains a listing of the source program with embedded tab characters if
present in the source program, along with the machine code generated for
each statement and diagnostic error messages, if any. The PRN file is listed
at the console using the TYPE command, or sent to a peripheral device
using PIP (see Section 1.6.4). Note that the PRN file
contains the original source program, augmented by miscellaneous assembly
information in the leftmost 16 columns; for example, program addresses and
hexadecimal
machine code. The PRN file serves as a backup for the original
source file. If the source file is accidentally removed or destroyed, the
PRN file can be edited by removing the leftmost 16 characters
of each line (see Section 2). This is done by issuing a single editor macro
command.
The resulting file is identical to the original source file and can be
renamed from PRN to ASM for subsequent editing and assembly. The file
.sp
.ti 8
X.HEX
.sp
is also produced, which contains 8080 machine language in Intel HEX format
suitable for subsequent loading and execution (see Section 1.6.3). For
complete details of CP/M's assembly language program, see Section 3.
.pp
The source file for assembly is taken from an alternate disk by prefixing the
assembly language filename by a disk drive name. The command
.sp
.ti 8
ASM B:ALPHA
.sp
loads the assembler from the currently logged drive and processes the source
program ALPHA.ASM on drive B. The HEX and PRN files are also placed on
drive B in this case.
.he CP/M Operating System Manual 1.6 Transient Commands
.sp 2
.tc 1.6.3 LOAD Command
.sh
1.6.3 LOAD Command
.qs
.sp
Syntax:
.sp
.ti 8
LOAD ufn
.pp 5
The LOAD command reads the file ufn, which is assumed to contain HEX format
machine code, and produces a memory image file that can subsequently be
executed. The filename ufn is assumed to be of the form:
.sp
.ti 8
X.HEX
.sp
and only the filename X need be specified in the command. The LOAD command
creates a file named
.sp
.ti 8
X.COM
.sp
that marks it as containing machine executable code. The file is actually
loaded into memory and executed when the user types the filename X
immediately after the prompting character > printed by the CCP.
.pp
Generally, the CCP reads the filename X following the prompting character and
looks for a built-in function name. If no function name is found, the CCP
searches the system disk directory for a file by the name
.sp
.ti 8
X.COM
.mb 5
.fm 1
.sp
If found, the machine code is loaded into the TPA, and the program executes.
Thus, the user need only LOAD a hex file once; it can be subsequently
executed any number of times by typing the primary name. This
way, you can invent new commands in the CCP. Initialized disks contain
the transient commands as COM files, which are optionally deleted. The
operation takes place on an alternate drive if the filename is prefixed
by a drive name. Thus,
.bp
.mb 6
.fm 2
.sp
.ti 8
LOAD B:BETA
.sp
brings the LOAD program into the TPA from the currently logged disk and
operates on drive B after execution begins.
.sp
.sh
Note: \c
.qs
the BETA.HEX file must contain valid Intel format
hexadecimal machine code records (as produced by the ASM program, for
example) that begin at 100H of the TPA. The addresses in the hex records
must be in ascending order; gaps in unfilled memory regions are filled with
zeroes by the LOAD command as the hex records are read. Thus, LOAD must be
used only for creating CP/M standard COM files that operate in the TPA.
Programs that occupy regions of memory other than the TPA are loaded under
DDT.
.sp 2
.tc 1.6.4 PIP
.sh
1.6.4 PIP
.qs
.sp
.ul
Syntax:
.qu
.sp
.in 8
.nf
PIP
PIP destination=source#1, source#2, ..., source #n
.fi
.in 0
.pp
PIP is the CP/M Peripheral Interchange Program that implements the basic
media conversion operations necessary to load, print, punch, copy, and
combine disk files. The PIP program is initiated by typing one of the
following forms:
.sp
.nf
.in 8
PIP
PIP command line
.fi
.in 0
.sp
In both cases PIP is loaded into the TPA and executed. In the
first form, PIP reads command lines directly from the console, prompted with
the * character, until an empty command line is typed (for example, a single
carriage return is issued by
the operator). Each successive command line causes some media conversion
to take place according to the rules shown below.
.pp
In the second form, the PIP
command is equivalent to the first, except that the single command line
given with the PIP command is automatically executed, and PIP terminates
immediately with no further prompting of the console for input command
lines. The form of each command line is
.sp
.ti 8
destination = source#1, source#2, ..., source#n
.sp
where destination is the file or peripheral device to receive the
data,
and source#1, ..., source#n is a series of one or more files or devices
that are copied from left to right to the destination.
.pp
When multiple files are given in the command line (for example,
n>1), the individual
files are assumed to contain ASCII characters, with an assumed CP/M
end-of-file character (CTRL-Z) at the end of each file (see the O parameter
to override this assumption). Lower-case ASCII alphabetics are internally
translated to upper-case to be consistent with CP/M file and device name
conventions. Finally, the total command line length cannot exceed 255
characters. CTRL-E can be used to force a physical carriage return for lines
that exceed the console width.
.pp
The destination and source elements are unambiguous references to CP/M source
files with or without a preceding disk drive name. That is, any file can be
referenced with a preceding drive name (A: through P:) that defines the
particular drive where the file can be obtained or stored. When the drive
name is not included, the currently logged disk is assumed. The
destination file can also appear as one or more of the source files, in
which case the source file is not altered until the entire concatenation is
complete. If it already exists, the destination file is removed if the
command line is properly formed. It is not removed if an error condition
arises. The following command lines, with explanations to the
right, are
valid as input to PIP:
.sp 2
.in 31
.ti -23
X=Y Copies to file X from file Y, where X and Y are
unambiguous filenames; Y remains unchanged.
.sp
.ti -23
X=Y,Z Concatenates files Y and z and copies to file X,
with Y and Z unchanged.
.sp
.ti -23
X.ASM=Y.ASM,Z.ASM Creates the file X.ASM from the concatenation of the
Y and Z.ASM files.
.sp
.ti -23
NEW.ZOT=B:OLD.ZAP Moves a copy of OLD.ZAPP from drive B to the currently
logged disk; names the file NEW.ZOT.
.sp
.ti -23
B:A.U=B:B.V,A:C.W,D.X Concatenates file B.V from drive B with C.W from drive
a and D.X from the logged disk; creates the file A.U on drive b.
.in 0
.sp
.pp
For convenience, PIP allows abbreviated commands for transferring files
between disk drives. The abbreviated PIP forms are
.sp
.in 8
.nf
PIP d:=afn
PIP d\d1\u=d\d2\u:afn
PIP ufn = d\d2\u:
PIP d\d1\u:ufn = d\d2\u:
.fi
.in 0
.sp
The first form copies all files from the currently logged disk that satisfy
the afn to the same files on drive d, where d = A...P. The second form is
equivalent to the first, where the source for the copy is drive
d\d2\u, where d\d2\u = A...P. The third form is equivalent to the command PIP
d\d1\u:ufn=d\d2\u:ufn which copies the file given by ufn from drive
d\d2\u to the file ufn on drive d\d1\u:. The fourth form is equivalent to
the third, where the source disk is explicitly given by d\d2\u:.
.pp
The source and destination disks must be different in all of these cases.
If an afn is specified, PIP lists each ufn that satisfies the afn as it
is being copied. If a file exists by the same name as the destination file,
it is removed after successful completion of the copy and replaced by the
copied file.
.pp
The following PIP commands give examples of valid disk-to-disk copy operations:
.sp 2
.in 24
.ti -16
B:=*.COM Copies all files that have the secondary name COM to
drive B from the current drive.
.sp
.ti -16
A:=B:ZAP.* Copies all files that have the primary name ZAP to
drive A from drive B.
.sp
.ti -16
ZAP.ASM=B: Same as ZAP.ASM=B:ZAP.ASM
.sp
.ti -16
B:ZOT.COM=A: Same as B:ZOT.COM=A:ZOT.COM
.sp
.ti -16
B:=GAMMA.BAS Same as B:GAMMA.BAS=GAMMA.BAS
.sp
.ti -16
B:=A:GAMMA.BAS Same as B:GAMMA.BAS=A:GAMMA.BAS
.in 0
.sp
.pp
PIP allows reference to physical and logical devices that are attached to the
CP/M system. The device names are the same as given under the STAT command,
along with a number of specially named devices. The following is
a list of logical devices given in the STAT command
.sp
.in 8
.nf
CON: (console)
RDR: (reader)
PUN: (punch)
LST: (list)
.fi
.in 0
.sp
while the physical devices are
.sp
.in 8
.nf
TTY: (console), reader, punch, or list)
CRT: (console, or list), UC1: (console)
PTR: (reader), UR1: (reader), UR2: (reader)
PTP: (punch), UP1: (punch), UP2: (punch)
LPT: (list), UL1: (list)
.fi
.in 0
.sp
The BAT: physical device is not included, because this assignment is used
only to indicate that the RDR: and LST: devices are used for console
input/output.
.pp
The RDR, LST, PUN, and CON devices are all defined within the BIOS portion of
CP/M, and are easily altered for any particular I/O system. The current
physical device mapping is defined by IOBYTE; see Section 6 for a discussion
of this function. The destination device must be capable of
receiving data, for example, data cannot be sent to the punch, and the
source devices must be
capable of generating data, for example, the LST: device cannot be read.
.pp
The following list describes additional device names that can be used in
PIP commands.
.sp 2
.in 5
.ti -2
o NUL: sends 40 nulls (ASCII 0s) to the device. This can be issued
at the end of punched output.
.sp
.ti -2
o EOF: sends a CP/M end-of-file (ASCII CTRL-Z) to the destination
device (sent automatically at the end of all ASCII data transfers through PIP).
.sp
.ti -2
o INP: is a special PIP input source that can be patched into the PIP
program. PIP gets the input data character-by-character, by CALLing location
103H, with data returned in location 109H (parity bit must be zero).
.sp
.ti -2
o OUT: is a special PIP output destination that can be patched into the
PIP program. PIP CALLs location 106H with data in register C for each
character to transmit. Note that locations 109H through
1FFH of the PIP memory image are not used and can be replaced by special
purpose drivers using DDT (see Section 4).
.sp
.ti -2
o PRN: is the same as LST:, except that tabs are expanded at every eighth
character position, lines are numbered, and page ejects are inserted every
60 lines with an initial eject (same as using PIP options [t8np]).
.in 0
.sp
.pp
File and device names can be interspersed in the PIP commands. In each case,
the specific device is read until end-of-file (CTRL-Z for ASCII files, and
end-of-data for non-ASCII disk files). Data from each device or file are
concatenated from left to right until the last data source has been read.
.pp
The destination device or file is written using the data from the source
files, and an end-of-file character, CTRL-Z, is appended to the result
for ASCII files. If the destination is a disk file, a temporary file is
created ($$$ secondary name) that is changed to the actual filename only
on successful completion of the copy. Files with the extension COM are
always assumed to be non-ASCII.
.pp
The copy operation can be aborted at any time by pressing any key on the
keyboard. PIP responds with the message ABORTED to
indicate that the operation has not been completed. If any operation is
aborted, or if an error occurs during processing, PIP removes any pending
commands that were set up while using the SUBMIT command.
.pp
PIP performs a special function if the destination is a disk file with type
HEX (an Intel hex-formatted machine code file), and the source is an
external peripheral device, such as a paper tape reader. In this case, the
PIP program checks to ensure that the source file contains a properly formed
hex file, with legal hexadecimal values and checksum records.
.pp
When an
invalid input record is found, PIP reports an error message at the console
and waits for corrective action. Usually, you can open the reader
and rerun a section of the tape (pull the tape back about 20 inches). When
the tape is ready for the reread, a single carriage return is typed at the
console, and PIP attempts another read. If the tape position cannot be
properly read, continue the read by typing a return following the
error message, and enter the record manually with the ED program after
the disk file is constructed.
.pp
PIP allows the end-of-file to
be entered from the console if the source file is an RDR: device. In
this case, the PIP program reads the device and monitors the keyboard. If
CTRL-Z is typed at the keyboard, the read operation is terminated normally.
.pp
The following are valid PIP commands:
.sp 2
.in 24
.ti 8
PIP LST: = X.PRN
.sp
Copies X.PRN to the LST device and
terminates the PIP program.
.sp
.ti 8
PIP
.sp
Starts PIP for a sequence of
commands. PIP prompts with *.
.sp
.ti 8
*CON:=X.ASM,Y.ASM,Z.ASM
.sp
Concatenates three ASM files and copies to
the CON device.
.sp
.ti 8
*X.HEX=CON:,Y.HEX,PTR:
.sp
Creates a HEX file by reading the CON
until a CTRL-Z is typed, followed by data from Y.HEX and PTR until
a CTRL-Z is encountered.
.sp
.ti 8
PIP PUN:=NUL:,X.ASM,EOF:,NUL:
.mb 4
.fm 1
.sp
Sends 40 nulls to the punch device; copies the X.ASM file to the punch,
followed by an end-of-file, CTRL-Z, and 40 more null characters.
.sp
.ti 8
(carriage return)
.sp
A single carriage return stops PIP.
.in 0
.bp
.pp
You can also specify one or more PIP parameters, enclosed in left and
right square brackets, separated by zero or more blanks. Each parameter
affects the copy operation, and the enclosed list of parameters must
immediately follow the affected file or device. Generally, each parameter
can be followed by an optional decimal integer value (the S and Q parameters
are exceptions). Table 1-4 describes valid PIP parameters.
.sp 2
.ce
.sh
Table 1-4. PIP Parameters
.ll 60
.in 5
.nf
.sp
Parameter Meaning
.fi
.mb 6
.fm 2
.sp
.in 17
.ti -10
B Blocks mode transfer. Data are buffered by PIP until an ASCII x-off
character, CTRL-S, is received from the source device. This allows transfer
of data to a disk file from a continuous reading device, such as a cassette
reader. Upon receipt of the x-off, PIP clears the disk buffers and returns
for more input data. The amount of data that can be buffered depends on the
memory size of the host system. PIP issues an error message if the
buffers overflow.
.sp
.ti -10
Dn Deletes characters that extend past column n in the transfer of data
to the destination from the character source. This parameter is generally
used to truncate long lines that are sent to a narrow printer or
console device.
.sp
.ti -10
E Echoes all transfer operations to the console as they are being
performed.
.sp
.ti -10
F Filters form-feeds from the file. All embedded form-feeds are
removed. The P parameter can be used simultaneously to insert new form-feeds.
.sp
.ti -10
Gn Gets file from user number n (n in the range 0-15).
.sp
.ti -10
H Transfers HEX data. All data are checked for proper Intel hex file
format. Nonessential characters between hex records are removed during the
copy operation. The console is prompted for corrective action in case
errors occur.
.sp
.ti -10
I Ignores :00 records in the transfer of Intel hex format
file. The I parameter automatically sets the H parameter.
.bp
.ll 65
.in 0
.ce
.sh
Table 1-4. (continued)
.ll 60
.in 5
.nf
.sp
Parameter Meaning
.fi
.sp
.in 17
.ti -10
L Translates upper-case alphabetics to lower-case.
.sp
.ti -10
N Adds line numbers to each line transferred to the destination,
starting at one and incrementing by 1. Leading zeroes are suppressed, and
the number is followed by a colon. If N2 is specified, leading zeroes are
included and a tab is inserted following the number. The tab is expanded if
T is set.
.sp
.ti -10
O Transfers non-ASCII object files. The normal CP/M end-of-file is
ignored.
.sp
.ti -10
Pn Includes page ejects at every n lines with an initial page eject.
If n = 1 or is excluded altogether, page ejects occur every 60 lines. If
the F parameter is used, form-feed suppression takes place before the new
page ejects are inserted.
.sp
.ti -10
Qs^Z Quits copying from the source device or file when the
string s, terminated by CTRL-Z, is encountered.
.sp
.ti -10
R Reads system files.
.sp
.ti -10
Ss^Z Start copying from the source device when the string
s, terminated by CTRL-Z, is encountered. The S and Q parameters can be used
to abstract a particular section of a file, such as a subroutine. The
start and quit strings are always included in the copy operation.
.sp
If you specify a command line after the PIP command keyword, the CCP
translates strings
following the S and Q parameters to upper-case. If you do not
specify a command line, PIP does not perform the automatic upper-case
translation.
.sp
.ti -10
Tn Expands tabs, CTRL-I characters, to every nth column during the
transfer of characters to the destination from the source.
.sp
.ti -10
U Translates lower-case alphabetics to upper-case during the copy
operation.
.bp
.ll 65
.in 0
.ce
.sh
Table 1-4. (continued)
.ll 60
.in 5
.nf
.sp
Parameter Meaning
.fi
.sp
.in 17
.ti -10
V Verifies that data have been copied correctly by rereading after the
write operation (the destination must be a disk file).
.sp
.ti -10
W Writes over R/O files without console interrogation.
.sp
.ti -10
Z Zeros the parity bit on input for each ASCII character.
.in 0
.ll 65
.sp
.pp
The following examples show valid PIP commands that specify parameters in
the file transfer.
.sp 2
.in 24
.ti 8
PIP X.ASM=B:[v]
.sp
Copies X.ASM from drive B to the current drive and verifies that the data were
properly copied.
.sp 2
.ti 8
PIP LPT:=X.ASM[nt8u]
.sp
Copies X.ASM to the LPT: device; numbers each line, expands tabs to every
eighth column, and translates lower-case alphabetics to upper-case.
.sp 2
.ti 8
PIP PUN:=X.HEX[i],Y.ZOT[h]
.sp
First copies X.HEX to the PUN: device
and ignores the trailing :00 record in X.HEX; continues the transfer of data
by reading Y.ZOT, which contains HEX records, including any :00 records
it contains.
.sp 2
.ti 8
PIP X.LIB=Y.ASM[sSUBRI:^z qJMP L3^z]
.sp
Copies from the file Y.ASM into the
file X.LIB. The command starts the copy when the string SUBR1: has been
found, and quits copying after the string JMP L3 is encountered.
.bp
.ti 8
PIP PRN:=X.ASM[p50]
.sp
Sends X.ASM to the LST: device with
line numbers, expands tabs to every eighth column, and ejects
pages at every
50th line. The assumed parameter list for a PRN file is nt8p60; p50
overrides the default value.
.in 0
.sp
.pp
Under normal operation, PIP does not overwrite a file that is set to a
permanent R/O status. If an attempt is made to overwrite an R/O file, the
following prompt appears:
.sp
.ti 8
DESTINATION FILE IS R/O, DELETE (Y/N)?
.sp
If you type Y, the file is overwritten. Otherwise, the following response
appears:
.sp
.ti 8
** NOT DELETED **
.sp
The file transfer is skipped, and PIP continues with the next
operation in sequence. To avoid the prompt and response in the case of R/O
file overwrite, the command line can include the W parameter, as
shown in this example:
.sp
.ti 8
PIP A:=B:*.COM[W]
.sp
The W parameter copies all nonsystem files to the A drive from the B drive and
overwrites any R/O files in the process. If the operation involves several
concatenated files, the W parameter need only be included with the last file
in the list, as in this example:
.sp
.ti 8
PIP A.DAT=B.DAT,F:NEW.DAT,G:OLD.DAT[W]
.pp
Files with the system attribute can be included in PIP transfers if the R
parameter is included; otherwise, system files are not
recognized. For example, the command line:
.sp
.ti 8
PIP ED.COM=B:ED.COM[R]
.sp
reads the ED.COM file from the B drive, even if it has been
marked as an R/O and system file. The system file attributes are copied, if
present.
.pp
Downward compatibility with previous versions of CP/M is only maintained if
the file does not exceed one megabyte, no file attributes are set, and the
file is created by user 0. If compatibility is required with
nonstandard, for example, double-density versions of 1.4, it
might be
necessary to select 1.4
compatibility mode when constructing the internal disk parameter block. See
Section 6 and refer to Section 6.10, which describes BIOS differences.
.bp
.sh
Note: \c
.qs
to copy files into another user area, PIP.COM must be located in that user
area. Use the following procedure to make a copy of PIP.COM in another
user area.
.sp 2
.in 8
.nf
USER 0 Log in user 0.
DDT PIP.COM (note PIP size s) Load PIP to memory.
GO Return to CCP.
USER 3 Log in user 3.
SAVEs PIP.COM
.fi
.in 0
.sp 2
In this procedure, s is the integral number of memory pages, 256-byte
segments, occupied
by PIP. The number s can be determined when PIP.COM is loaded under DDT,
by referring to the value under the NEXT display. If, for example, the next
available address is 1D00, then PIP.COM requires 1C hexadecimal
pages, or
1 times 16 + 12 = 28 pages, and the value of s is 28 in the subsequent
save. Once PIP is copied in this manner, it can be copied to another disk
belonging to the same user number through normal PIP transfers.
.nx onec


683
Source/Doc/CPM 22 Manual - Testing/onec.tex

@ -1,683 +0,0 @@
.op
.cs 5
.mt 5
.mb 6
.pl 66
.ll 65
.po 10
.hm 2
.fm 2
.he CP/M Operating System Manual 1.6 Transient Commands
.ft 1-%
.pc 1
.sp 2
.tc 1.6.5 ED Command
.sh
1.6.5 ED Command
.qs
.sp
.ul
Syntax:
.qu
.sp 0
.sp
.ti 8
ED ufn
.pp 5
The ED program is the CP/M system context editor that allows creation and
alteration of ASCII files in the CP/M environment. Complete details of
operation are given in Section 2. ED allows the operator to create and
operate upon source files that are organized as a sequence of ASCII
characters, separated by end-of-line characters (a carriage
return/line-feed
sequence). There is no practical restriction on line length (no single
line can exceed the size of the working memory) that is defined by the
number of characters typed between carriage returns.
.pp
The ED program has
a number of commands for character string searching, replacement, and
insertion that are useful for creating and correcting programs or text
files under CP/M. Although the CP/M has a limited memory work
space area (approximately 5000 characters in a 20K CP/M system), the file
size that
can be edited is not limited, since data are easily paged through this
work area.
.pp
If it does not exist, ED creates the specified source file and opens the
file for access. If the source file does exist, the
programmer appends data for editing (see the A command). The appended data
can then be
displayed, altered, and written from the work area back to the
disk (see the W command). Particular points in the program can be
automatically paged and
located by context, allowing easy access to particular
portions of a large file (see the N command).
.pp
If you type the following command line:
.sp
.ti 8
ED X.ASM
.sp
the ED program creates an intermediate work file with the name
.sp
.ti 8
X.$$$
.sp
to hold the edited data during the ED run. Upon completion of ED, the
X.ASM file (original file) is renamed to X.BAK, and the edited work file is
renamed to X.ASM. Thus, the X.BAK file contains the original unedited
file, and the X.ASM file contains the newly edited file. The operator can
always return to the previous version of a file by removing the most recent
version and renaming the previous version. If the current X.ASM file has
been improperly edited, the following sequence of commands reclaim the
back-up file.
.sp 2
.nf
.in 8
DIR X.* Checks to see that BAK file is
available.
ERA X.ASM Erases most recent version.
REN X.ASM=X.BAK Renames the BAK file to ASM.
.fi
.in 0
.sp 2
You can abort the edit at any point (reboot, power failure, CTRL-C,
or CTRL-Q command) without destroying the original file. In this case, the
BAK file is not created and the original file is always intact.
.pp
The ED program allows the user to edit the source on one disk and create the
back-up file on another disk. This form of the ED command is
.sp
.ti 8
ED ufn d:
.sp
where ufn is the name of the file to edit on the currently logged disk and d
is the name of an alternate drive. The ED program reads and processes the
source file and writes the new file to drive d using the name ufn. After
processing, the original file becomes the back-up file. If the operator is
addressing disk A, the following command is valid.
.sp
.ti 8
ED X.ASM b:
.sp
This edits the file X.ASM on drive A, creating the new file X.$$$ on
drive B. After a successful edit, A:X.ASM is renamed to A:X.BAK, and
B:X.$$$ is renamed to B:X.ASM. For convenience, the currently logged disk
becomes drive B at the end of the edit. Note that if a file
named B:X.ASM exists before the editing begins, the following
message appears on the screen:
.bp
.sp
.ti 8
FILE EXISTS
.sp
This message is a precaution against accidentally destroying
a source file. You should first erase the existing file and then restart
the edit operation.
.pp
Similar to other transient commands, editing can take place on a drive
different from the currently logged disk by preceding the source filename
by a drive name. The following are examples of valid edit
requests:
.sp 2
.in 25
.ti -17
ED A:X.ASM Edits the file X.ASM on drive A, with new file and back-up
on drive A.
.sp
.ti -17
ED B:X.ASM A: Edits the file X.ASM on drive B to the temporary file X.$$$
on drive A. After editing, this command changes X.ASM on drive B to X.BAK
and changes X.$$$ on drive A to X.ASM.
.in 0
.ll 65
.sp 2
.tc 1.6.6 SYSGEN Command
.sh
1.6.6 SYSGEN Command
.qs
.sp
Syntax:
.sp
.ti 8
SYSGEN
.pp
The SYSGEN transient command allows generation of an initialized disk
containing the CP/M operating system. The SYSGEN program prompts the
console for commands by interacting as shown.
.sp 2
.in 24
.ti 8
SYSGEN <cr>
.sp
Initiates the SYSGEN program.
.sp 2
.ti 8
SYSGEN VERSION x.x
.sp
SYSGEN sign-on message.
.sp 2
.in 8
.nf
SOURCE DRIVE NAME
(OR RETURN TO SKIP)
.in 24
.sp
.fi
Respond with the drive name (one of the letters A, B, C, or D) of the
disk containing a CP/M system, usually A. If a copy of CP/M already exists
in memory due to a MOVCPM command, press only a carriage return. Typing a
drive name d causes the response:
.sp 2
.ti 8
SOURCE ON d THEN TYPE RETURN
.sp
Place a disk containing the CP/M operating
system on drive d (d is one of A, B, C, or D). Answer by pressing a carriage
return when ready.
.sp 2
.ti 8
FUNCTION COMPLETE
.sp
System is copied to memory. SYSGEN then prompts with the following:
.sp 2
.nf
.in 8
DESTINATION DRIVE NAME
(OR RETURN TO REBOOT)
.fi
.sp
.in 24
If a disk is being initialized, place the new disk into a drive
and answer with the drive name. Otherwise, press a carriage return
and the system reboots from drive A. Typing drive name d causes
SYSGEN to prompt with the following message:
.sp 2
.nf
.in 8
DESTINATION ON d
THEN TYPE RETURN
.fi
.in 24
.sp
Place new disk into drive d; press return when ready.
.sp 2
.ti 8
FUNCTION COMPLETE
.sp
New disk is initialized in drive d.
.in 0
.sp 2
The DESTINATION prompt is repeated until a single carriage return is
pressed at the console, so that more than one disk can be initialized.
.pp
Upon completion of a successful system generation, the new disk contains
the operating system, and only the built-in commands are available. An
IBM-compatible disk appears to CP/M as a disk with an
empty directory; therefore, the operator must copy the appropriate COM files
from an existing CP/M disk to the newly constructed disk using the
PIP transient.
.pp
You can copy all files from an existing disk by typing the following
PIP command:
.sp
.ti 8
PIP B: = A:*.*[v]
.bp
This command copies all files from disk drive A to disk drive B and verifies
that
each file has been copied correctly. The name of each file is displayed at
the console as the copy operation proceeds.
.pp
Note that a SYSGEN does not destroy the files that already
exist on a disk; it only constructs a new operating system. If a
disk is being used only on drives B through P and will never be the
source of a bootstrap operation on drive A, the SYSGEN need not take place.
.sp 2
.tc 1.6.7 SUBMIT Command
.sh
1.6.7 SUBMIT Command
.sp
.ul
Syntax:
.qu
.sp
.ti 8
SUBMIT ufn parm#1 ... parm#n
.pp
The SUBMIT command allows CP/M commands to be batched for automatic
processing. The ufn given in the SUBMIT command must be the filename of a
file that exists on the currently logged disk, with an assumed file type of
SUB. The SUB file contains CP/M prototype commands with possible parameter
substitution. The actual parameters parm#1 ... parm#n are substituted into
the prototype commands, and, if no errors occur, the file of substituted
commands are processed sequentially by CP/M.
.pp
The prototype command file is created using the ED program, with
interspersed $ parameters of the form:
.sp
.ti 8
$1 $2 $3 ...$n
.sp
corresponding to the number of actual parameters that will be included when
the file is submitted for execution. When the SUBMIT transient is executed,
the actual parameters parm#1 ... parm#n are paired with the formal parameters
$1 ... $n in the prototype commands. If the numbers of formal and actual
parameters do not correspond, the SUBMIT function is aborted with an error
message at the console. The SUBMIT function creates a file of substituted
commands with the name
.mt 5
.hm 2
.sp
.ti 8
$$$.SUB
.sp
on the logged disk. When the system reboots, at the termination of the
SUBMIT, this command file is read by the CCP as a source of input rather
than the console. If the SUBMIT function is performed on any disk other
than drive A, the commands are not processed until the disk is inserted into
drive A and the system reboots. You can abort command processing at
any time by pressing the rubout key when the command is read and echoed. In
this case, the $$$.SUB file is removed and the subsequent commands come
from the console. Command processing is also aborted if the CCP detects an
error in any of the commands. Programs that execute under CP/M can abort
processing of command files when error conditions occur by erasing any
existing $$$.SUB file.
.pp
To introduce dollar signs into a SUBMIT file, you can type a $$
which reduces to a single $ within the command file. A caret,
^, precedes an alphabetic character s, which produces a single CTRL-X
character within the file.
.pp
The last command in a SUB file can initiate another SUB file, allowing
chained batch commands:
.pp
Suppose the file ASMBL.SUB exists on disk and contains the prototype commands
.sp
.in 8
.nf
ASM $1
DIR $1.*
ERA *.BAK
PIP $2:=$1.PRN
ERA $1.PRN
.fi
.in 0
.sp
then, you issue the following command:
.sp
.ti 8
SUBMIT ASMBL X PRN
.sp
The SUBMIT program reads the ASMBL.SUB file,
substituting X: for all occurrences of $1 and PRN for all occurrences of
$2. This results in a $$$.SUB file containing the commands:
.sp
.in 8
.nf
ASM X
DIR X.*
ERA *.BAK
PIP PRN:=X.PRN
ERA X.PRN
.fi
.in 0
.sp
which are executed in sequence by the CCP.
.pp
The SUBMIT function can access a SUB file on an alternate drive by preceding
the filename by a drive name. Submitted files are only acted upon when
they appear on drive A. Thus, it is possible to create a submitted file
on drive B that is executed at a later time when inserted in drive A.
.pp
An additional utility program called XSUB extends the power of the SUBMIT
facility to include line input to programs as well as the CCP. The XSUB
command is included as the first line of the SUBMIT
file. When it is executed, XSUB self-relocates directly below the CCP. All
subsequent SUBMIT command lines are processed by XSUB so that programs that
read buffered console input, BDOS Function 10, receive their input directly
from the SUBMIT file. For example, the file SAVER.SUB can contain the
following SUBMIT lines:
.sp
.in 8
.nf
XSUB
DDT
|$1.COM
R
GO
SAVE 1 $2.COM
.fi
.in 0
.sp
a subsequent SUBMIT command, such as
.sp
.ti 8
A>\c
.sh
SUBMIT SAVER PIP Y
.qs
.sp
substitutes X for $1 and Y for $2 in the command stream. The XSUB
program loads, followed by DDT, which is sent to the command lines PIP.COM,
R, and G0, thus returning to the CCP. The final command SAVE 1 Y.COM is
processed by the CCP.
.pp
The XSUB program remains in memory and prints the message
.sp
.ti 8
(xsub active)
.sp
on each warm start operation to indicate its presence. Subsequent SUBMIT
command streams do not require the XSUB, unless an intervening cold start
occurs. Note that XSUB must be loaded after the optional
CP/M DESPOOL utility, if both are to run simultaneously.
.sp 2
.tc 1.6.8 DUMP Command
.sh
1.6.8 DUMP Command
.sp
.ul
Syntax:
.qu
.sp
.ti 8
DUMP ufn
.pp
The DUMP program types the contents of the disk file (ufn) at the console in
hexadecimal form. The file contents are listed sixteen bytes at a time,
with the absolute byte address listed to the left of each line in
hexadecimal. Long typeouts can be aborted by pressing the rubout key during
printout. The source listing of the DUMP program is given in Section 5 as
an example of a program written for the CP/M environment.
.sp 2
.tc 1.6.9 MOVCPM Command
.sh
1.6.9 MOVCPM Command
.sp
.ul
Syntax:
.qu
.sp
.ti 8
MOVCPM
.pp
The MOVCPM program allows you to reconfigure the CP/M system for any
particular memory size. Two optional parameters can be used to indicate the
desired size of the new system and the disposition of the new system at
program termination. If the first parameter is omitted or an * is given,
the MOVCPM program reconfigures the system to its maximum size, based
upon the kilobytes of contiguous RAM in the host system (starting at 0000H).
If the second parameter is omitted, the system is executed, but not
permanently recorded; if * is given, the system is left in memory, ready
for a SYSGEN operation. The MOVCPM program relocates a memory image of CP/M
and places this image in memory in preparation for a system generation
operation. The following is a list of MOVCPM command forms:
.sp 2
.in 23
.ti -15
MOVCPM Relocates and executes CP/M for management of the current
memory
configuration (memory is examined for contiguous RAM, starting at 100H).
On completion of the relocation, the new system is executed but not
permanently recorded on the disk. The system that is constructed
contains a BIOS for the Intel microcomputer development system 800.
.sp
.ti -15
MOVCPM n Creates a relocated CP/M system for management of an n kilobyte
system (n must be in the range of 20 to 64), and executes the system as
described.
.sp
.ti -15
MOVCPM * * Constructs a relocated memory image for the current memory
configuration, but leaves the memory image in memory in preparation for a
SYSGEN operation.
.sp
.ti -15
MOVCPM n * Constructs a relocated memory image for an n kilobyte memory
system, and leaves the memory image in preparation for a SYSGEN operation.
.in 0
.sp
.pp
For example, the command,
.sp
.ti 8
MOVCPM * *
.sp
constructs a new version of the CP/M system and leaves it in
memory, ready for a SYSGEN operation. The message
.sp
.in 8
.nf
READY FOR 'SYSGEN' OR
'SAVE 34 CPMxx.COM'
.fi
.in 0
.sp
appears at the console upon completion, where xx is the current memory
size in kilobytes. You can then type the following sequence:
.sp 2
.in 35
.ti -27
SYSGEN This starts the system generation.
.sp
.nf
.ti -27
SOURCE DRIVE NAME Respond with a carriage return
.sp 0
.fi
.ti -27
(OR RETURN TO SKIP) to skip the CP/M read operation, because the
system is already in memory as a result of the previous MOVCPM operation.
.sp
.nf
.ti -27
DESTINATION DRIVE NAME Respond with B to write new
.sp 0
.fi
.ti -27
(OR RETURN TO REBOOT) system to the disk in drive B. SYSGEN
prompts with the following message:
.sp
.mb 5
.fm 1
.nf
.ti -27
DESTINATION ON B, Place the new disk on drive B
.sp 0
.fi
.ti -27
THEN TYPE RETURN and press the RETURN key when ready.
.in 0
.bp
.mb 6
.fm 2
.pp
If you respond with A rather than B above, the system is
written to drive A rather than B. SYSGEN continues to print this
prompt:
.sp
.ti 8
DESTINATION DRIVE NAME (OR RETURN TO REBOOT)
.sp
until you respond with a single carriage return, which stops the
SYSGEN program with a system reboot.
.pp
You can then go through the reboot process with the old or new
disk. Instead of performing the SYSGEN operation, you can
type a command of the form:
.sp
.ti 8
SAVE 34 CPMxx.COM
.sp
at the completion of the MOVCPM function, where xx is the value indicated
in the SYSGEN message. The CP/M memory image on the currently logged disk is
in a form that can be patched. This is necessary when operating in a
nonstandard environment where the BIOS must be altered for a particular
peripheral device configuration, as described in Section 6.
.pp
The following are valid MOVCPM commands:
.sp 2
.in 23
.ti -15
MOVCPM 48 Constructs a 48K version of CP/M and starts execution.
.sp
.mb 5
.fm 1
.ti -15
MOVCPM 48 * Constructs a 48K version of CP/M in preparation for permanent
recording; the response is
.sp
.nf
READY FOR 'SYSGEN' OR
'SAVE 34 CPM48.COM'
.fi
.sp
.ti -15
MOVCPM * * Constructs a maximum memory version of CP/M and
starts execution.
.in 0
.pp
The newly created system is serialized with the number attached to the
original disk and is subject to the conditions of the Digital Research
Software Licensing Agreement.
.sp 2
.he CP/M Operating System Manual 1.7 BDOS Error Messages
.tc 1.7 BDOS Error Messages
.sh
1.7 BDOS Error Messages
.qs
.mb 6
.fm 2
.pp
There are three error situations that the Basic Disk Operating System
intercepts during file processing. When one of these conditions is detected,
the BDOS prints the message:
.sp
.ti 8
BDOS ERR ON d: error
.bp
where d is the drive name and error is one of the three error messages:
.sp
.in 8
.nf
BAD SECTOR
SELECT
READ ONLY
.fi
.in 0
.pp
The BAD SECTOR message indicates that the disk controller electronics has
detected an error condition in reading or writing the disk. This
condition is generally caused by a malfunctioning disk controller or an
extremely worn disk. If you find that CP/M reports this
error more than once a month, the state of the controller electronics and the
condition of the media should be checked.
.pp
You can also encounter this condition in reading files generated
by a controller produced by a different manufacturer. Even
though controllers claim to be IBM..-compatible, one
often finds small differences in recording formats. The Model 800 controller,
for example, requires two bytes of one's following the data CRC byte, which
is not required in the IBM format. As a result, disks generated by the
Intel microcomputer development system can be read by almost all
other IBM-compatible system, while disk files generated on other
manufacturers' equipment produce the BAD SECTOR message when read
by the microcomputer development system. To recover from this
condition, press a CTRL-C to reboot (the safest course), or a
return, which ignores the bad sector in the file operation.
.sp
.sh
Note: \c
.qs
pressing a return might destroy disk integrity if the
operation is a directory write. Be sure you have adequate
back-ups in this case.
.pp
The SELECT error occurs when there is an attempt to address a drive beyond
the range supported by the BIOS. In this case, the value of d in the error
message gives the selected drive. The system reboots following any input
from the console.
.pp
The READ ONLY message occurs when there is an attempt to write to a
disk or file that has been designated as Read-Only in a STAT command or
has been set to Read-Only by the BDOS. Reboot CP/M by
using the warm start procedure, CTRL-C, or by performing a cold start
whenever the disks are changed. If a changed disk is to be read but
not written, BDOS allows the disk to be changed without the warm or
cold start, but internally marks the drive as Read-Only. The status of the
drive is subsequently changed to Read-Write if a warm or cold start occurs.
On issuing this message, CP/M waits for input from the console. An automatic
warm start takes place following any input.
.sp 2
.he CP/M Operating System Manual 1.8 Operation of CP/M on the Model 800
.tc 1.8 CP/M Operation on the Model 800
.sh
1.8 CP/M Operation on the Model 800
.pp
This section gives operating procedures for using CP/M on the
Intel Model 800 microcomputer development system microcomputer development
system. Basic knowledge of the microcomputer development system
hardware and software systems is assumed.
.pp
CP/M is initiated in essentially the same manner as the Intel ISIS operating
system. The disk drives are labeled 0 through 3 on the
microcomputer development system, corresponding
to CP/M drives A through D, respectively. The CP/M system disk is
inserted into drive 0, and the BOOT and RESET switches are pressed in
sequence. The interrupt 2 light should go on at this point. The space bar
is then pressed on the system console, and the light should go
out. If it does not, the user should check connections and baud rates. The
BOOT
switch is turned off, and the CP/M sign-on message should appear at the
selected console device, followed by the A> system prompt. You
can then issue the various resident and transient commands.
.pp
The CP/M system can be restarted (warm start) at any time by pushing the
INT 0 switch on the front panel. The built-in Intel ROM monitor can be
initiated by pushing the INT 7 switch, which generates an RST 7, except when
operating under DDT, in which case the DDT program gets control instead.
.pp
Diskettes can be removed from the drives at any time, and the system can be
shut down during operation without affecting data integrity. Do
not remove a disk and replace it with another without rebooting the
system (cold or warm start) unless the inserted disk is Read-Only.
.pp
As a result of hardware hang-ups or malfunctions, CP/M might
print the following message:
.sp
.ti 8
BDOS ERR ON d: BAD SECTOR
.sp
where d is the drive that has a permanent error. This error can occur when
drive doors are opened and closed randomly, followed by disk operations, or
can be caused by a disk, drive, or controller failure. You can
optionally elect to ignore the error by pressing a single return at the
console. The error might produce a bad data record, requiring
reinitialization
of up to 128 bytes of data. You can reboot the CP/M system and try
the operation again.
.pp
Termination of a CP/M session requires no special action, except that it is
necessary to remove the disks before turning the power off to avoid
random transients that often make their way to the drive electronics.
.pp
You should use IBM-compatible disks rather than disks
that have previously been used with any ISIS version. In particular, the
ISIS FORMAT operation produces nonstandard sector numbering throughout the
disk. This nonstandard numbering seriously degrades the performance of
CP/M, and causes CP/M to operate noticeably slower than the distribution
version. If it becomes necessary to reformat a disk, which
should not be the case for standard disks, a program can be
written under CP/M that causes the Model 800 controller to
reformat with sequential sector numbering (1-26) on each track.
.pp
Generally, IBM-compatible 8-inch disks do not need to be formatted.
However, 5 1/4-inch disks need to be formatted.
.sp 2
.ce
End of Section 1
.nx two


BIN
Source/Doc/CPM 22 Manual - Testing/part1.ix

Binary file not shown.

13267
Source/Doc/CPM 22 Manual - Testing/part1.prn

File diff suppressed because it is too large

2
Source/Doc/CPM 22 Manual - Testing/part1.tex

@ -1,2 +0,0 @@
.nx front


13350
Source/Doc/CPM 22 Manual - Testing/part1.txt

File diff suppressed because it is too large

3010
Source/Doc/CPM 22 Manual - Testing/part2.prn

File diff suppressed because it is too large

2
Source/Doc/CPM 22 Manual - Testing/part2.tex

@ -1,2 +0,0 @@
.nx appa.tex


3009
Source/Doc/CPM 22 Manual - Testing/part2.txt

File diff suppressed because it is too large

BIN
Source/Doc/CPM 22 Manual - Testing/part3.ix

Binary file not shown.

BIN
Source/Doc/CPM 22 Manual - Testing/part3.prn

Binary file not shown.

2
Source/Doc/CPM 22 Manual - Testing/part3.tex

@ -1,2 +0,0 @@
.nx apph.tex


2511
Source/Doc/CPM 22 Manual - Testing/part3.txt

File diff suppressed because it is too large

807
Source/Doc/CPM 22 Manual - Testing/sixa.tex

@ -1,807 +0,0 @@
.bp 1
.op
.cs 5
.mt 5
.mb 6
.pl 66
.ll 65
.po 10
.hm 2
.fm 2
.he
.ft 6-%
.pc 1
.tc 6 CP/M 2 Alteration
.ce
.sh
Section 6
.qs
.sp
.ce
.sh
CP/M 2 Alteration
.qs
.sp 3
.tc 6.1 Introduction
.he CP/M Operating System Manual 6.1 Introduction
.sh
6.1 Introduction
.qs
.pp
The standard CP/M system assumes operation on an Intel Model
800 microcomputer development system , but is designed so you can alter a
specific set of subroutines that define the hardware operating
environment.
.pp
Although standard CP/M 2 is configured for single-density floppy
disks, field-alteration features allow adaptation to a wide
variety of disk subsystems from single-drive minidisks to
high-capacity, hard disk systems. To simplify the following
adaptation process, it is assumed that CP/M 2 is first
configured for single-density floppy disks where minimal editing
and debugging tools are available. If an earlier version of CP/M
is available, the customizing process is eased considerably. In
this latter case, you might want to review the system
generation process and skip to later sections that discuss system
alteration for nonstandard disk systems.
.pp
To achieve device independence, CP/M is separated into three
distinct modules:
.sp
.in 5
.ti -2
o BIOS is the Basic I/O System, which is environment dependent.
.sp
.ti -2
o BDOS is the Basic Disk Operating System, which is not dependent upon the
hardware configuration.
.sp
.ti -2
o CCP is the Console Command Processor, which uses the BDOS.
.fi
.in 0
.pp
Of these modules, only the BIOS is dependent upon the particular
hardware. You can patch the distribution version
of CP/M to provide a new BIOS that provides a customized
interface between the remaining CP/M modules and the
hardware system. This document provides a step-by-step
procedure for patching a new BIOS into CP/M.
.mb 4
.fm 1
.pp
All disk-dependent portions of CP/M 2 are placed into a BIOS, a
resident disk parameter block, which is either hand coded or
produced automatically using the disk definition macro library
provided with CP/M 2. The end user need only specify the maximum
number of active disks, the starting and ending sector numbers,
the data allocation size, the maximum extent of the logical disk,
directory size information, and reserved track values.
The macros use this information to generate
the appropriate tables and table references for use during CP/M 2
operation. Deblocking information is provided, which aids in
assembly or disassembly of sector sizes that are multiples of the
fundamental 128-byte data unit, and the system alteration manual
includes general purpose subroutines that use the deblocking
information to take advantage of larger sector sizes. Use of
these subroutines, together with the table-drive data access
algorithms, makes CP/M 2 a universal data management system.
.pp
File expansion is achieved by providing up to 512 logical file
extents, where each logical extent contains 16K bytes of data.
CP/M 2 is structured, however, so that as much as 128K bytes of
data are addressed by a single physical extent, corresponding to a
single directory entry, maintaining compatibility with previous
versions while taking advantage of directory space.
.pp
If CP/M is being tailored to a computer system for the first
time, the new BIOS requires some simple software development and
testing. The standard BIOS is listed in Appendix A and can be
used as a model for the customized package. A skeletal version
of the BIOS given in Appendix B can serve as the basis for a
modified BIOS.
.mb 6
.fm 2
.pp
In addition to the BIOS, you must write a simple memory
loader, called GETSYS, which brings the operating system into
memory. To patch the new BIOS into CP/M, you must write the
reverse of GETSYS, called PUTSYS, which places an altered version
of CP/M back onto the disk. PUTSYS can be derived from GETSYS by
changing the disk read commands into disk write commands. Sample
skeletal GETSYS and PUTSYS programs are described in Section 6.4
and listed in Appendix C.
.pp
To make the CP/M system load automatically, you must also
supply a cold start loader, similar to the one provided with
CP/M, listed in Appendixes A and D. A skeletal form of a cold
start loader is given in Appendix E, which serves as a model for
the loader.
.mb 4
.fm 1
.sp 2
.tc 6.2 First-level System Regeneration
.he CP/M Operating System Manual 6.2 First-level Regeneration
.sh
6.2 First-level System Regeneration
.qs
.pp
The procedure to patch the CP/M system is given below. Address
references in each step are shown with H denoting the
hexadecimal radix, and are given for a 20K CP/M system. For
larger CP/M systems, a bias is added to each address that is
shown with a +b following it, where b is equal to the memory
size-20K. Values for b in various standard memory sizes are listed in
Table 6-1.
.sp 2
.sh
Table 6-1. Standard Memory Size Values
.nf
Memory Size Value
.fi
.sp
.in 13
24K: b = 24K - 20K = 4K = 1000H
.sp
32K: b = 32K - 20K = 12K = 3000H
.sp
40K: b = 40K - 20K = 20K = 5000H
.sp
48K: b = 48K - 20K = 28K = 7000H
.sp
56K: b = 56K - 20K = 36K = 9000H
.sp
62K: b = 62K - 20K = 42K = A800H
.sp
64K: b = 64K - 20K = 44K = B000H
.fi
.in 0
.pp
Note that the standard distribution version of CP/M is set for
operation within a 20K CP/M system. Therefore, you must first bring up
the 20K CP/M system, then configure it for actual
memory size (see Section 6.3).
.pp
Follow these steps to patch your CP/M system:
.sp 2
.in 8
.ti -3
1) Read Section 6.4 and write a GETSYS program that reads the
first two tracks of a disk into memory. The program from the
disk must be loaded starting at location 3380H. GETSYS is coded
to start at location 100H (base of the TPA) as shown in Appendix
C.
.mb 6
.fm 2
.sp
.ti -3
2) Test the GETSYS program by reading a blank disk into memory,
and check to see that the data has been read properly and that
the disk has not been altered in any way by the GETSYS program.
.sp
.ti -3
3) Run the GETSYS program using an initialized CP/M disk to see
if GETSYS loads CP/M starting at 3380H (the operating system
actually starts 128 bytes later at 3400H).
.sp
.ti -3
4) Read Section 6.4 and write the PUTSYS program. This writes
memory starting at 3380H back onto the first two tracks of the
disk. The PUTSYS program should be located at 200H, as shown in
Appendix C.
.sp
.ti -3
5) Test the PUTSYS program using a blank, uninitialized disk by
writing a portion of memory to the first two tracks; clear memory
and read it back using GETSYS. Test PUTSYS completely, because
this program will be used to alter CP/M on disk.
.sp
.ti -3
6) Study Sections 6.5, 6.6, and 6.7 along with the distribution
version of the BIOS given in Appendix A and write a simple
version that performs a similar function for the customized
environment. Use the program given in Appendix B as a model.
Call this new BIOS by name CBIOS (customized BIOS). Implement
only the primitive disk operations on a single drive and simple
console input/output functions in this phase.
.sp
.ti -3
7) Test CBIOS completely to ensure that it properly performs
console character I/O and disk reads and writes. Be careful to
ensure that no disk write operations occur during read operations
and check that the proper track and sectors are addressed on all
reads and writes. Failure to make these checks might cause
destruction of the initialized CP/M system after it is patched.
.mb 4
.fm 1
.sp
.ti -3
8) Referring to Table 6-3 in Section 6.5, note that the BIOS is
placed between locations 4A00H and 4FFFH. Read the CP/M system
using GETSYS and replace the BIOS segment by the CBIOS developed
in step 6 and tested in step 7. This replacement is done in
memory.
.sp
.ti -3
9) Use PUTSYS to place the patched memory image of CP/M onto the
first two tracks of a blank disk for testing.
.sp
.ti -4
10) Use GETSYS to bring the copied memory image from the test
disk back into memory at 3380H and check to ensure that it has
loaded back properly (clear memory, if possible, before the
load). Upon successful load, branch to the cold start code at
location 4A00H. The cold start routine initializes page
zero, then jumps to the CCP at location 3400H, which calls the
BDOS, which calls the CBIOS. The CCP asks the CBIOS to read
sixteen sectors on track 2, and CP/M types A>, the system
prompt.
.mb 6
.fm 2
.sp
If difficulties are encountered, use whatever debug facilities
are available to trace and breakpoint the CBIOS.
.sp
.ti -4
11) Upon completion of step 10, CP/M has prompted the console for
a command input. To test the disk write operation, type
.sp
SAVE 1 X.COM
.sp
All commands must be followed by a carriage return. CP/M
responds with another prompt after several disk accesses:
.sp
A>
.sp
If it does not, debug the disk write functions and retry.
.sp
.ti -4
12) Test the directory command by typing
.sp
DIR
.sp
CP/M responds with
.sp
A:X COM
.sp
.ti -4
13) Test the erase command by typing
.sp
ERA X.COM
.sp
CP/M responds with the A prompt. This is now an operational
system that only requires a bootstrap loader to function
completely.
.sp
.ti -4
14) Write a bootstrap loader that is similar to GETSYS and place
it on track 0, sector 1, using PUTSYS (again using the test disk,
not the distribution disk). See Sections 6.5 and 6.8 for more
information on the bootstrap operation.
.sp
.ti -4
15) Retest the new test disk with the bootstrap loader installed
by executing steps 11, 12, and 13. Upon completion of these
tests, type a CTRL-C. The system executes a warm start, which
reboots the system, and types the A prompt.
.sp
.ti -4
16) At this point, there is probably a good version of the
customized CP/M system on the test disk. Use GETSYS to load CP/M
from the test disk. Remove the test disk, place the distribution
disk, or a legal copy, into the drive, and use PUTSYS to
replace the distribution version with the customized version.
Do not make this replacement if you are unsure of the patch
because this step destroys the system that was obtained from
Digital Research.
.sp
.ti -4
17) Load the modified CP/M system and test it by typing
.sp
DIR
.sp
CP/M responds with a list of files that are provided on the
initialized disk. The file DDT.COM is the memory image for the
debugger. Note that from now on, you must always reboot the
CP/M system (CTRL-C is sufficient) when the disk is removed and
replaced by another disk, unless the new disk is to be Read-Only.
.sp
.ti -4
18) Load and test the debugger by typing
.sp
DDT
.sp
See Chapter 4 for operating procedures.
.sp
.ti -4
19) Before making further CBIOS modifications, practice using the
editor (see Chapter 2), and assembler (see Chapter 3). Recode
and test the GETSYS, PUTSYS, and CBIOS programs using ED, ASM,
and DDT. Code and test a COPY program that does a sector-to-sector
copy from one disk to another to obtain back-up copies of
the original disk. Read the CP/M Licensing Agreement specifying
legal responsibilities when copying the CP/M system. Place the
following copyright notice:
.sp
.nf
Copyright (c), 1983
Digital Research
.fi
.sp
on each copy that is made with the COPY program.
.sp
.ti -4
20) Modify the CBIOS to include the extra functions for punches,
readers, and sign-on messages, and add the facilities for
additional disk drives, if desired. These changes can be made
with the GETSYS and PUTSYS programs or by referring to the
regeneration process in Section 6.3.
.fi
.in 0
.sp
.pp
You should now have a good copy of the customized CP/M
system. Although the CBIOS portion of CP/M belongs to the user,
the modified version cannot be legally copied.
.pp
It should be noted that the system remains file-compatible with
all other CP/M systems (assuming media compatibility) which
allows transfer of nonproprietary software between CP/M users.
.tc 6.3 Second-level System Generation
.bp
.he CP/M Operating System Manual 6.3 Second-level System Generation
.sh
6.3 Second-level System Generation
.qs
.pp
Once the system is running, the next step is to configure CP/M
for the desired memory size. Usually, a memory image is first
produced with the MOVCPM program (system relocator) and then
placed into a named disk file. The disk file can then be loaded,
examined, patched, and replaced using the debugger and the
system generation program (refer to Chapter 1).
.pp
The CBIOS and BOOT are modified using ED and assembled using ASM,
producing files called CBIOS.HEX and BOOT.HEX, which contain the
code for CBIOS and BOOT in Intel hex format.
.pp
To get the memory image of CP/M into the TPA configured for the
desired memory size, type the command:
.sp
.ti 8
MOVCPM xx*
.sp
where xx is the memory size in decimal K bytes, for example, 32
for 32K. The response is as follows:
.sp
.nf
.in 8
CONSTRUCTING xxK CP/M VERS 2.0
.sp
READY FOR "SYSGEN" OR
.sp
"SAVE 34 CPMxx.COM"
.fi
.in 0
.pp
An image of CP/M in the TPA is configured for the requested
memory size. The memory image is at location 0900H through
227FH, that is, the BOOT is at 0900H, the CCP is at 980H, the
BDOS starts at 1180H, and the BIOS is at 1F80H. Note that the
memory image has the standard Model 800 BIOS and BOOT on it. It is now
necessary to save the memory image in a file so that you can
patch the CBIOS and CBOOT into it:
.sp
.ti 8
SAVE 34 CPMxx.COM
.pp
The memory image created by the MOVCPM program is offset by a
negative bias so that it loads into the free area of the TPA, and
thus does not interfere with the operation of CP/M in higher
memory. This memory image can be subsequently loaded under DDT
and examined or changed in preparation for a new generation of
the system. DDT is loaded with the memory image by typing:
.sp
.ti 8
DDT CPMxx.COM Loads DDT, then reads the CP/M image.
.sp
DDT should respond with the following:
.sp
.nf
.in 8
NEXT PC
2300 0100
- The DDT prompt
.fi
.in 0
.sp
You can then give the display and disassembly commands to examine
portions of the memory image between 900H and 227FH.
Note, however, that to find any particular address
within the memory image, you must apply the negative bias to the
CP/M address to find the actual address. Track 00, sector 01, is
loaded to location 900H (the user should find the cold start
loader at 900H to 97FH); track 00, sector 02, is loaded into 980H
(this is the base of the CCP); and so on through the entire CP/M
system load. In a 20K system, for example, the CCP resides at
the CP/M address 3400H, but is placed into memory at 980H by the
SYSGEN program. Thus, the negative bias, denoted by n, satisfies
.sp
.ti 8
3400H + n = 980H, or n =980H - 3400H
.sp
Assuming two's complement arithmetic, n = D580H, which can be
checked by
.sp
.ti 8
.nf
3400H + D580H = 10980H = 0980H (ignoring high-order
overflow).
.fi
.pp
Note that for larger systems, n satisfies
.sp
.nf
.in 8
(3400H+b) + n = 980H, or
n = 980H - (3400H + b), or
n = D580H - b
.fi
.in 0
.sp
The value of n for common CP/M systems is given below.
.sp 2
.sh
Table 6-2. Common Values for CP/M Systems
.sp
.nf
Memory Size BIAS b Negative Offset n
.sp
.in 13
20K 0000H D580H - 0000H = D580H
24K 1000H D580H - 1000H = C580H
32K 3000H D580H - 3000H = A580H
40K 5000H D580H - 5000H = 8580H
48K 7000H D580H - 7000H = 6580H
56K 9000H D580H - 9000H = 4580H
62K A800H D580H - A800H = 2D80H
64K B000H D580H - B000H = 2580H
.fi
.in 0
.sp
.pp
If you want to locate the address x within the memory image
loaded under DDT in a 20K system, first type
.sp
.ti 8
Hx,n Hexadecimal sum and difference
.sp
and DDT responds with the value of x+n (sum) and x-n
(difference). The first number printed by DDT is the actual memory
address in the image where the data or code is located. For example,
the following DDT command:
.sp
.ti 8
H3400,D580
.sp
produces 980H as the sum, which is where the CCP
is located in the memory image under DDT.
.pp
Type the L command to disassemble portions of the
BIOS located at (4A00H+b)-n, which, when one uses the H command,
produces an actual address of 1F80H. The disassembly command
would thus be as follows:
.sp
.ti 8
L1F80
.sp
It is now necessary to patch in the CBOOT and CBIOS routines. The BOOT
resides at location 0900H in the memory image. If the actual
load address is n, then to calculate the bias (m),
type the command:
.sp
.ti 8
H900,n Subtract load address from target address.
.pp
The second number typed by DDT in response to the command is the
desired bias (m). For example, if the BOOT executes at 0080H,
the command
.sp
.ti 8
H900,80
.sp
produces
.sp
.ti 8
0980 0880 Sum and difference in hex.
.sp
Therefore, the bias m would be 0880H. To read-in the BOOT, give the command:
.sp
.ti 8
ICBOOT.HEX Input file CBOOT.HEX
.sp
Then
.sp
.ti 8
Rm Read CBOOT with a bias of m (=900H-n).
.sp
Examine the CBOOT with
.sp
.ti 8
L900
.sp
You are now ready to replace the CBIOS by examining the area at
1F80H, where the original version of the CBIOS resides, and then
typing
.sp
.ti 8
ICBIOS.HEX Ready the hex file for loading.
.pp
Assume that the CBIOS is being integrated into a 20K
CP/M system and thus originates at location 4A00H. To locate the
CBIOS properly in the memory image under DDT, you must apply the
negative bias n for a 20K system when loading the hex file. This
is accomplished by typing
.sp
.ti 8
RD580 Read the file with bias D580H.
.sp
Upon completion of the read, reexamine the area
where the CBIOS has been loaded (use an L1F80 command) to ensure
that it is properly loaded. When you are satisfied that the change has
been made, return from DDT using a CTRL-C or, G0 command.
.pp
SYSGEN is used to replace the patched memory image back onto a
disk (you use a test disk until sure of the
patch) as shown in the following interaction:
.sp 2
.nf
.in 8
SYSGEN Start the SYSGEN program.
.sp
SYSGEN VERSION 2.0 Sign-on message from SYSGEN.
.sp
SOURCE DRIVE NAME Respond with a carriage return
(OR RETURN TO SKIP) to skip the CP/M read operation
because the system is already
in memory.
.sp
DESTINATION DRIVE NAME Respond with B to write the new
(OR RETURN TO REBOOT) system to the disk in drive B.
.sp
DESTINATION ON B, Place a scratch disk in drive
THEN TYPE RETURN B, then press RETURN.
.sp
FUNCTION COMPLETE
DESTINATION DRIVE NAME
(OR RETURN TO REBOOT)
.fi
.in 0
.sp
.pp
Place the scratch disk in drive A, then
perform a cold start to bring up the newly-configured CP/M
system.
.pp
The new CP/M system is then tested and the Digital Research
copyright notice is placed on the disk, as specified in the
Licensing Agreement:
.sp
.nf
.in 8
Copyright (c), 1979
Digital Research
.fi
.in 0
.sp 2
.tc 6.4 Sample GETSYS and PUTSYS Programs
.he CP/M Operating System Manual 6.4 Sample GETSYS and PUTSYS
.sh
6.4 Sample GETSYS and PUTSYS Programs
.qs
.pp
The following program provides a framework for the GETSYS and
PUTSYS programs referenced in Sections 6.1 and 6.2. To read and
write the specific sectors, you must insert the READSEC and WRITESEC
subroutines.
.bp
.nf
; GETSYS PROGRAM -- READ TRACKS 0 AND 1 TO MEMORY AT 3380H
; REGISTER USE
.sp
; A (SCRATCH REGISTER)
.sp
; B TRACK COUNT (0, 1)
.sp
; C SECTOR COUNT (1,2,...,26)
.sp
; DE (SCRATCH REGISTER PAIR)
.sp
; HL LOAD ADDRESS
.sp
; SP SET TO STACK ADDRESS
.sp
;
START: LXI SP,3380H ;SET STACK POINTER TO SCRATCH
;AREA
LXI H,3380H ;SET BASE LOAD ADDRESS
MVI B,0 ;START WITH TRACK 0
RDTRK: ;READ NEXT TRACK (INITIALLY 0)
MVI C,1 ;READ STARTING WITH SECTOR 1
.sp
RDSEC: ;READ NEXT SECTOR
CALL READSEC ;USER-SUPPLIED SUBROUTINE
LXI D,128 ;MOVE LOAD ADDRESS TO NEXT 1/2
;PAGE
DAD D ;HL = HL + 128
INR C ;SECTOR = SECTOR + 1
MOV A,C ;CHECK FOR END OF TRACK
CPI 27
JC RDSEC ;CARRY GENERATED IF SECTOR <27
.sp
;
; ARRIVE HERE AT END OF TRACK, MOVE TO NEXT TRACK
INR B
MOV A,B ;TEST FOR LAST TRACK
CPI 2
JC RDTRK ;CARRY GENERATED IF TRACK <2
.sp
;
; USER-SUPPLIED SUBROUTINE TO READ THE DISK
READSEC:
; ENTER WITH TRACK NUMBER IN REGISTER B,
SECTOR NUMBER IN REGISTER C, AND
.sp
; ADDRESS TO FILL IN HL
.sp
;
PUSH B ;SAVE B AND C REGISTERS
PUSH H ;SAVE HL REGISTERS
.sp 2
.sh
Listing 6-1. GETSYS Program
.bp
.................................................
perform disk read at this point, branch to
label START if an error occurs
.................................................
POP H ;RECOVER HL
POP B ;RECOVER B AND C REGISTERS
RET ;BACK TO MAIN PROGRAM
.sp
END START
.fi
.in 0
.sp 2
.sh
Listing 6-1. (continued)
.sp 2
.pp
This program is assembled and listed in Appendix B for reference
purposes, with an assumed origin of 100H. The hexadecimal
operation codes that are listed on the left might be useful if the
program has to be entered through the panel switches.
.pp
The PUTSYS program can be constructed from GETSYS by changing
only a few operations in the GETSYS program given above, as shown
in Appendix C. The register pair HL becomes the dump address,
next address to write, and operations on these registers do not
change within the program. The READSEC subroutine is replaced by
a WRITESEC subroutine, which performs the opposite function; data
from address HL is written to the track given by register B
and sector given by register C. It is often useful to combine
GETSYS and PUTSYS into a single program during the test and
development phase, as shown in Appendix C.
.sp 2
.tc 6.5 Disk Organization
.he CP/M Operating System Manual 6.5 Disk Organization
.sh
6.5 Disk Organization
.qs
.pp
The sector allocation for the standard distribution version of
CP/M is given here for reference purposes. The first sector contains
an optional software boot section (see the table on the following
page. Disk controllers are often set up to bring track 0,
sector 1, into memory at a specific location, often location
0000H. The program in this sector, called BOOT, has the
responsibility of bringing the remaining sectors into memory
starting at location 3400H+b. If the controller does not
have a built-in sector load, the program in track 0, sector 1 can
be ignored. In this case, load the program from track 0, sector
2, to location 3400H+b.
.pp
As an example, the Intel Model 800
hardware cold start loader brings track 0, sector 1, into
absolute address 3000H. Upon loading this sector, control
transfers to location 3000H, where the bootstrap operation
commences by loading the remainder of track 0 and all of track 1
into memory, starting at 3400H+b. Note that this bootstrap
loader is of little use in a non-microcomputer development system
environment, although it is useful to examine it because some of
the boot actions will have to be duplicated in the user's cold
start loader.
.bp
.sh
Table 6-3. CP/M Disk Sector Allocation
.sp
.nf
Track # Sector Page# Memory Address CP/M Module name
.sp
00 01 (boot address) Cold Start Loader
00 02 00 3400H+b CCP
' 03 ' 3480H+b '
' 04 01 3500H+b '
' 05 ' 3580H+b '
' 06 02 3600H+b '
' 07 ' 3680H+b '
' 08 03 3700H+b '
' 09 ' 3780H+b '
' 10 04 3800H+b '
' 11 ' 3880H+b '
' 12 05 3900H+b '
' 13 ' 3980H+b '
' 14 06 3A00H+b '
' 15 ' 3A80H+b '
' 16 07 3B00H+b '
00 17 ' 3B80H+b CCP
00 18 08 3C00H+b BDOS
' 19 ' 3C80H+b '
' 20 09 3D00H+b '
' 21 ' 3D80H+b '
' 22 10 3E00H+b '
' 23 ' 3E80H+b '
' 24 11 3F00H+b '
' 25 ' 3F80H+b '
' 26 12 4000H+b '
01 01 ' 4080H+b '
' 02 13 4100H+b '
' 03 ' 4180H+B '
' 04 14 4200H+b '
' 05 ' 4280H+b '
' 06 15 4300H+b '
' 07 ' 4380H+b '
' 08 16 4400H+b '
' 09 ' 4480H+b '
' 10 17 4500H+b '
' 11 ' 4580H+b '
' 12 18 4600H+b '
' 13 ' 4680H+b '
' 14 19 4700H+b '
' 15 ' 4780H+b '
' 16 20 4800H+b '
' 17 ' 4880H+b '
' 18 21 4900H+b '
.mb 4
.fm 1
01 19 ' 4900H+b BDOS
07 20 22 4A00H+b BIOS
' 21 ' 4A80H+b '
' 22 23 4B00H+b '
' 23 ' 4B80H+b '
' 24 24 4C00H+b '
01 25 ' 4C80H+b BIOS
01 26 25 4D00H+b BIOS
02-76 01-26 (directory and data)
.fi
.nx sixb


1311
Source/Doc/CPM 22 Manual - Testing/sixb.tex

File diff suppressed because it is too large

447
Source/Doc/CPM 22 Manual - Testing/test.tex

@ -1,447 +0,0 @@
.op
.sp 15
.ce 100
.bo 5
CP/M
.sp
.sh
Operating System
.sp
.sh
Manual
.cs 5
.sp 10
Copyright (c) 1982
.sp
Digital Research
P.O. Box 579
160 Central Avenue
Pacific Grove, CA 93950
(408) 649-3896
TWX 910 360 5001
.sp 4
All Rights Reserved
.ce 0
.bp
.po 17
.ll 50
.ce
COPYRIGHT
.sp
Copyright (c) 1976, 1977, 1978, 1979, 1982, 1983, and 1984 by
Digital Research Inc. All rights reserved. No part of this
publication may be reproduced, transmitted, transcribed, stored
in a retrieval system, or translated into any language or
computer language, in any form or by any means, electronic, mechanical,
magnetic, optical, chemical, manual or otherwise, without the prior
written permission of Digital Research Inc., Post Office Box 579,
Pacific Grove, California, 93950.
.sp
Thus, readers are granted permission to include the example
programs, either in whole or in part, in their own programs.
.sp 2
.ce
DISCLAIMER
.sp
Digital Research Inc. makes no representations or warranties with
respect to the contents hereof and specifically disclaims
any implied warranties of merchantability or fitness for
any particular purpose. Further, Digital Research Inc. reserves the
right to revise this publication and to make changes from
time to time in the content hereof without obligation of
Digital Research Inc. to notify any person of such revision or
changes.
.sp 2
.ce
TRADEMARKS
.sp
CP/M, CP/NET, and Digital Research and its logo are registered
trademarks of Digital Research. ASM, DESPOOL, DDT, LINK-80, MAC,
MP/M, PL/I-80 and SID are trademarks of Digital Research. IBM is
a registered trademark of International Business Machines. Intel
is a registered trademark of Intel Corporation. TI Silent 700 is
a trademark of Texas Instruments Incorporated. Zilog and Z80 are
registered trademarks of Zilog, Inc.
.mb 4
.fm 1
.sp 3
The \c
.ul
CP/M Operating System Manual \c
.qu
was prepared using the Digital Research TEX Text Formatter and printed
in the United States of America.
.sp 2
.ce 6
*********************************
* First Edition: 1976 *
* Second Edition: July 1982 *
* Third Edition: March 1983 *
* Fourth Edition: March 1984 *
*********************************
.po 10
.ll 65
.in 0
.bp
.cs 5
.mt 5
.mb 6
.pl 66
.ll 65
.po 10
.hm 2
.fm 2
.he
.ft iii
.bp
.ce
.sh
Table of Contents
.sp 3
.nf
.sh
1 CP/M Features and Facilities
.sp
1.1 Introduction . . . . . . . . . . . . . . . . . . . 1-1
.sp
1.2 Functional Description . . . . . . . . . . . . . . 1-3
.sp
1.2.1 General Command Structure . . . . . . . . . 1-3
1.2.2 File References . . . . . . . . . . . . . . 1-3
.sp
1.3 Switching Disks . . . . . . . . . . . . . . . . . . 1-5
1.4 Built-in Commands . . . . . . . . . . . . . . . . . 1-6
.sp
1.4.1 ERA Command . . . . . . . . . . . . . . . . 1-6
1.4.2 DIR Command . . . . . . . . . . . . . . . . 1-7
1.4.3 REN Command . . . . . . . . . . . . . . . . 1-8
1.4.4 SAVE Command . . . . . . . . . . . . . . . . 1-8
1.4.5 TYPE Command . . . . . . . . . . . . . . . . 1-9
1.4.6 USER Command . . . . . . . . . . . . . . . . 1-9
.sp
1.5 Line Editing and Output Control . . . . . . . . . . 1-10
.sp
1.6 Transient Commands . . . . . . . . . . . . . . . . 1-11
.sp
1.6.1 STAT Command . . . . . . . . . . . . . . . . 1-12
1.6.2 ASM Command . . . . . . . . . . . . . . . . 1-18
1.6.3 LOAD Command . . . . . . . . . . . . . . . . 1-19
1.6.4 PIP . . . . . . . . . . . . . . . . . . . . 1-20
1.6.5 ED Command . . . . . . . . . . . . . . . . . 1-29
1.6.6 SYSGEN Command . . . . . . . . . . . . . . . 1-31
1.6.7 SUBMIT Command . . . . . . . . . . . . . . . 1-33
1.6.8 DUMP Command . . . . . . . . . . . . . . . . 1-35
1.6.9 MOVCPM Command . . . . . . . . . . . . . . . 1-35
.sp
1.7 BDOS Error Messages . . . . . . . . . . . . . . . . 1-37
.sp
1.8 CP/M Operation on the Model 800 . . . . . . . . . . 1-38
.sp 2
.sh
2 The CP/M Editor
.sp
2.1 Introduction to ED . . . . . . . . . . . . . . . . 2-1
.sp
2.1.1 ED Operation . . . . . . . . . . . . . . . . 2-1
2.1.2 Text Transfer Functions . . . . . . . . . . 2-3
2.1.3 Memory Buffer Organization . . . . . . . . . 2-4
2.1.4 Line Numbers and ED Start-up . . . . . . . . 2-5
2.1.5 Memory Buffer Operation . . . . . . . . . . 2-6
2.1.6 Command Strings . . . . . . . . . . . . . . 2-7
2.1.7 Text Search and Alteration . . . . . . . . . 2-10
2.1.8 Source Libraries . . . . . . . . . . . . . . 2-13
2.1.9 Repetitive Command Execution . . . . . . . . 2-14
.bp
.ft iv
.ce
.sh
Table of Contents
.qs
.sp
.ce
.sh
(continued)
.qs
.sp 3
2.2 ED Error Conditions . . . . . . . . . . . . . . . . 2-14
.sp
2.3 Control Characters and Commands . . . . . . . . . . 2-16
.sp 2
.sh
3 CP/M Assembler
.qs
.sp
3.1 Introduction . . . . . . . . . . . . . . . . . . . 3-1
.sp
3.2 Program Format . . . . . . . . . . . . . . . . . . 3-3
.sp
3.3 Forming the Operand . . . . . . . . . . . . . . . . 3-4
.sp
3.3.1 Labels . . . . . . . . . . . . . . . . . . . 3-4
3.3.2 Numeric Constants . . . . . . . . . . . . . 3-5
3.3.3 Reserved Words . . . . . . . . . . . . . . . 3-5
3.3.4 String Constants . . . . . . . . . . . . . . 3-6
3.3.5 Arithmetic and Logical Operators . . . . . . 3-7
3.3.6 Precedence of Operators . . . . . . . . . . 3-8
.sp
3.4 Assembler Directives . . . . . . . . . . . . . . . 3-9
.sp
3.4.1 The ORG Directive . . . . . . . . . . . . . 3-10
3.4.2 The END Directive . . . . . . . . . . . . . 3-10
3.4.3 The EQU Directive . . . . . . . . . . . . . 3-11
3.4.4 The SET Directive . . . . . . . . . . . . . 3-11
3.4.5 The IF and ENDIF Directives . . . . . . . . 3-12
3.4.6 The DB Directive . . . . . . . . . . . . . . 3-13
3.4.7 The DW Directive . . . . . . . . . . . . . . 3-14
3.4.8 The DS Directive . . . . . . . . . . . . . . 3-14
.sp
3.5 Operation Codes . . . . . . . . . . . . . . . . . . 3-15
.sp
3.5.1 Jumps, Calls, and Returns . . . . . . . . . 3-15
3.5.2 Immediate Operand Instructions . . . . . . . 3-17
3.5.3 Increment and Decrement Instructions . . . . 3-17
3.5.4 Data Movement Instructions . . . . . . . . . 3-18
3.5.5 Arithmetic Logic Unit Operations . . . . . . 3-19
3.5.6 Control Instructions . . . . . . . . . . . . 3-21
.sp
3.6 Error Messages . . . . . . . . . . . . . . . . . . 3-21
.sp
3.7 A Sample Session . . . . . . . . . . . . . . . . . 3-23
.bp
.ft v
.ce
.sh
Table of Contents
.qs
.sp
.ce
.sh
(continued)
.qs
.sp 3
.sh
4 CP/M Dynamic Debugging Tool
.qs
.sp
4.1 Introduction . . . . . . . . . . . . . . . . . . . 4-1
.sp
4.2 DDT Commands . . . . . . . . . . . . . . . . . . . 4-3
.sp
4.2.1 The A (Assembly) Command . . . . . . . . . . 4-3
4.2.2 The D (Display) Command . . . . . . . . . . 4-4
4.2.3 The F (Fill) Command . . . . . . . . . . . . 4-5
4.2.4 The G (Go) Command . . . . . . . . . . . . . 4-5
4.2.5 The I (Input) Command . . . . . . . . . . . 4-6
4.2.6 The L (List) Command . . . . . . . . . . . . 4-6
4.2.7 The M (Move) Command . . . . . . . . . . . . 4-7
4.2.8 The R (Read) Command . . . . . . . . . . . . 4-7
4.2.9 The S (Set) Command . . . . . . . . . . . . 4-8
4.2.1- The T (Trace) Command . . . . . . . . . . . 4-8
4.2.11 The U (Untrace) Command . . . . . . . . . . 4-9
4.2.12 The X (Examine) Command . . . . . . . . . . 4-9
.sp
4.3 Implementation Notes . . . . . . . . . . . . . . . 4-10
.sp
4.4 A Sample Program . . . . . . . . . . . . . . . . . 4-11
.sp 2
.sh
5 CP/M 2 System Interface
.qs
.sp
5.1 Introduction . . . . . . . . . . . . . . . . . . . 5-1
.sp
5.2 Operating System Call Conventions . . . . . . . . . 5-3
.sp
5.3 A Sample File-to-File Copy Program . . . . . . . . 5-35
.sp
5.4 A Sample File Dump Utility . . . . . . . . . . . . 5-38
.sp
5.5 A Sample Random Access Program . . . . . . . . . . 5-42
.sp
5.6 System Function Summary . . . . . . . . . . . . . . 5-50
.sp 2
.sh
6 CP/M 2 Alteration
.qs
.sp
6.1 Introduction . . . . . . . . . . . . . . . . . . . 6-1
.sp
6.2 First-level System Regeneration . . . . . . . . . . 6-2
.sp
6.3 Second-level System Generation . . . . . . . . . . 6-5
.sp
6.4 Sample GETSYS and PUTSYS Programs . . . . . . . . . 6-9
.bp
.ft vi
.ce
.sh
Table of Contents
.qs
.sp
.ce
.sh
(continued)
.qs
.sp 3
6.5 Disk Organization . . . . . . . . . . . . . . . . . 6-11
.sp
6.6 The BIOS Entry Points . . . . . . . . . . . . . . . 6-13
.sp
6.7 A Sample BIOS . . . . . . . . . . . . . . . . . . . 6-21
.sp
6.8 A Sample Cold Start Loader . . . . . . . . . . . . 6-21
.sp
6.9 Reserved Locations in Page Zero . . . . . . . . . . 6-22
.sp
6.10 Disk Parameter Tables . . . . . . . . . . . . . . 6-23
.sp
6.11 The DISKDEF Macro Library . . . . . . . . . . . . 6-28
.sp
6.12 Sector Blocking and Deblocking . . . . . . . . . . 6-32
.bp
.ft vii
.ce
.sh
Appendixes
.qs
.sp 3
.sh
A \c
.qs
Basic Input/Output System (BIOS) . . . . . . . . . . . A-1
.sp 2
.sh
B \c
.qs
A Skeletal CBIOS . . . . . . . . . . . . . . . . . . . B-1
.sp 2
.sh
C \c
.qs
A Skeletal GETSYS/PUTSYS Program . . . . . . . . . . . C-1
.sp 2
.sh
D \c
.qs
The Model 800 Cold Start Loader for CP/M 2 . . . . . . D-1
.sp 2
.sh
E \c
.qs
A Skeletal Cold Start Loader . . . . . . . . . . . . . E-1
.sp 2
.sh
F \c
.qs
CP/M Disk Definition Library . . . . . . . . . . . . . F-1
.sp 2
.sh
G \c
.qs
Blocking and Deblocking Algorithms . . . . . . . . . . G-1
.sp 2
.sh
H \c
.qs
Glossary . . . . . . . . . . . . . . . . . . . . . . . H-1
.sp 2
.sh
I \c
.qs
CP/M Error Messages . . . . . . . . . . . . . . . . . . I-1
.bp
.ft viii
.ce
.sh
Tables, Figures, and Listings
.qs
.sp 3
.sh
Tables
.qs
.sp
1-1. Line-editing Control Characters . . . . . . . . 1-10
1-2. CP/M Transient Commands . . . . . . . . . . . . 1-11
1-3. Physical Devices . . . . . . . . . . . . . . . 1-14
1-4. PIP Parameters . . . . . . . . . . . . . . . . 1-24
.sp
2-1. ED Text Transfer Commands . . . . . . . . . . . 2-3
2-2. Editing Commands . . . . . . . . . . . . . . . 2-6
2-3. Line-editing Controls . . . . . . . . . . . . . 2-7
2-4. Error Message Symbols . . . . . . . . . . . . . 2-13
2-5. ED Control Characters . . . . . . . . . . . . . 2-14
2-6. ED Commands . . . . . . . . . . . . . . . . . . 2-15
.sp
3-1. Reserved Characters . . . . . . . . . . . . . . 3-6
3-2. Arithmetic and Logical Operators . . . . . . . 3-7
3-3. Assembler Directives . . . . . . . . . . . . . 3-9
3-4. Jumps, Calls, and Returns . . . . . . . . . . . 3-15
3-5. Immediate Operand Instructions . . . . . . . . 3-16
3-6. Increment and Decrement Instructions . . . . . 3-17
3-7. Data Movement Instructions . . . . . . . . . . 3-17
3-8. Arithmetic Logic Unit Operations . . . . . . . 3-18
3-9. Error Codes . . . . . . . . . . . . . . . . . . 3-20
3-10. Error Messages . . . . . . . . . . . . . . . . 3-21
.sp
4-1. Line-editing Controls . . . . . . . . . . . . . 4-2
4-2. DDT Commands . . . . . . . . . . . . . . . . . 4-2
4-3. CPU Registers . . . . . . . . . . . . . . . . . 4-9
.sp
5-1. CP/M Filetypes . . . . . . . . . . . . . . . . 5-6
5-2. File Control Block Fields . . . . . . . . . . . 5-7
5-3. Edit Control Characters . . . . . . . . . . . . 5-20
.sp
6-1. Standard Memory Size Values . . . . . . . . . . 6-2
6-2. Common Values for CP/M Systems . . . . . . . . 6-7
6-3. CP/M Disk Sector Allocation . . . . . . . . . . 6-11
6-4. IOBYTE Field Values . . . . . . . . . . . . . . 6-15
6-5. BIOS Entry Points . . . . . . . . . . . . . . . 6-16
6-6. Reserved Locations in Page Zero . . . . . . . . 6-21
6-7. Disk Parameter Headers . . . . . . . . . . . . 6-23
6-8. BSH and BLM Values . . . . . . . . . . . . . . 6-25
6-9. EXM Values . . . . . . . . . . . . . . . . . . 6-25
6-10. BLS Tabluation . . . . . . . . . . . . . . . . 6-26
.sp
I-1. CP/M Error Messages . . . . . . . . . . . . . . I-1
.sp 2
.sh
Figures
.qs
.sp
2-1. Overall ED Operation . . . . . . . . . . . . . 2-2
2-2. Memory Buffer Organization . . . . . . . . . . 2-2
.bp
.ft ix
.ce
.sh
Tables, Figures, and Listings
.qs
.sp
.ce
.sh
(continued)
.qs
.sp 3
.sh
Figures
.qs
.sp
2-3. Logical Organization of Memory Buffer . . . . . 2-4
.sp
5-1. CP/M Memory Organization . . . . . . . . . . . 5-1
5-2. File Control Block Format . . . . . . . . . . . 5-7
.sp
6-1. IOBYTE Fields . . . . . . . . . . . . . . . . . 6-15
6-2. Disk Parameter Header Format . . . . . . . . . 6-22
6-3. Disk Parameter Header Table . . . . . . . . . . 6-23
6-4. Disk Parameter Block Format . . . . . . . . . . 6-24
6-5. AL0 and AL1 . . . . . . . . . . . . . . . . . . 6-25
.sp 2
.sh
Listings
.qs
.sp
6-1. GETSYS Program . . . . . . . . . . . . . . . . 6-9
6-2. BIOS Entry Points . . . . . . . . . . . . . . . 6-13
.nx onea


938
Source/Doc/CPM 22 Manual - Testing/threea.tex

@ -1,938 +0,0 @@
.bp 1
.op
.cs 5
.mt 5
.mb 6
.pl 66
.ll 65
.po 10
.hm 2
.fm 2
.he
.ft 3-%
.pc 1
.tc 3 CP/M Assembler
.ce 2
.sh
Section 3
.sp
.sh
CP/M Assembler
.qs
.sp 3
.tc 3.1 Introduction
.he CP/M Operating System Manual 3.1 Introduction
.sh
3.1 Introduction
.qs
.pp 5
The CP/M assembler reads assembly-language source files from the
disk and produces 8080 machine language in Intel hex format.
To start the CP/M assembler, type a command in one of the
following forms:
.sp
.nf
.in 8
ASM filename
ASM filename.parms
.fi
.in 0
.sp
In both cases, the assembler assumes there is a file on the
disk with the name:
.sp
.ti 8
filename.ASM
.sp
which contains an 8080 assembly-language source file. The first
and second forms shown above differ only in that the second form
allows parameters to be passed to the assembler to control source
file access and hex and print file destinations.
.pp
In either case, the CP/M assembler loads and prints the message:
.sp
.ti 8
CP/M ASSEMBLER VER n.n
.sp
where n.n is the current version number. In the case of the
first command, the assembler reads the source file with assumed
filetype ASM and creates two output files
.sp
.in 8
.nf
filename.HEX
filename.PRN
.fi
.in 0
.pp
The HEX file contains the machine code corresponding to the
original program in Intel hex format, and the PRN file contains
an annotated listing showing generated machine code, error flags,
and source lines. If errors occur during translation, they are
listed in the PRN file and at the console.
.pp
The form ASM filename parms is used to redirect input and
output files from their defaults. In this case, the parms
portion of the command is a three-letter group that specifies the
origin of the source file, the destination of the hex file, and
the destination of the print file. The form is
.bp
.ti 8
filename.p1p2p3
.sp
where p1, p2, and p3 are single letters. P1 can be
.sp
.ti 8
A,B, ...,P
.sp
which designates the disk name that contains the source file. P2
can be
.sp
.ti 8
A,B, ...,P
.sp
which designates the disk name that will receive the hex file; or, P2
can be
.sp
.ti 8
Z
.sp
which skips the generation of the hex file.
.pp
P3 can be
.sp
.ti 8
A,B, ...,P
.sp
which designates the disk name that will receive the
print file. P3 can also be specified as
.sp
.ti 8
X
.sp
which places the listing at the console; or
.sp
.ti 8
Z
.sp
which skips generation of the print file. Thus, the command
.sp
.ti 8
ASM X.AAA
.sp
indicates that the source, X.HEX, and print, X.PRN, files
are also to be created on disk A. This form of the command is
implied if the assembler is run from disk A. Given that you are
currently addressing disk A, the above command is the same as
.sp
.ti 8
ASM X
.sp
The command
.sp
.ti 8
ASM X.ABX
.sp
indicates that the source file is to be taken from disk A, the
hex file is to be placed on disk B, and the listing file is to be
sent to the console. The command
.sp
.ti 8
ASM X.BZZ
.sp
takes the source file from disk B and skips the generation of the
hex and print files. This command is useful for fast execution of
the assembler to check program syntax.
.bp
.pp
The source program format is compatible with the Intel 8080
assembler. Macros are not implemented in ASM; see the optional
MAC macro assembler. There are certain extensions in the CP/M
assembler that make it somewhat easier to use. These extensions
are described below.
.sp 2
.tc 3.2 Program Format
.he CP/M Operating System Manual 3.2 Program Format
.sh
3.2 Program Format
.qs
.pp
An assembly-language program acceptable as input to the assembler
consists of a sequence of statements of the form
.sp
.ti 8
line# label operation operand ;comment
.sp
where any or all of the fields may be present in a particular
instance. Each assembly-language statement is terminated with a
carriage return and line-feed (the line-feed is inserted
automatically by the ED program), or with the character !, which
is treated as an end-of-line by the assembler. Thus, multiple
assembly-language statements can be written on the same physical
line if separated by exclamation point symbols.
.pp
The line# is an optional decimal integer value representing the
source program line number, and ASM ignores this field if
present.
.pp
The label field takes either of the following forms:
.sp
.in 8
.nf
identifier
identifier:
.fi
.in 0
.sp
The label field is optional, except where noted in particular statement
types. The identifier is a sequence of alphanumeric characters
where the first character is alphabetic. Identifiers can be
freely used by the programmer to label elements such as program
steps and assembler directives, but cannot exceed 16 characters
in length. All characters are significant in an identifier,
except for the embedded dollar symbol $, which can be used to
improve readability of the name. Further, all lower-case
alphabetics are treated as upper-case. The
following are all valid instances of labels:
.sp 2
.nf
.in 8
x xy long$name
x: yxl: longer$named$data:
X1Y2 X1x2 x234$5678$9012$3456:
.fi
.in 0
.sp
.pp
The operation field contains either an assembler directive or
pseudo operation, or an 8080 machine operation code. The pseudo
operations and machine operation codes are described in Section
3.3.
.pp
Generally, the operand field of the statement contains an
expression formed out of constants and labels, along with
arithmetic and logical operations on these elements. Again, the
complete details of properly formed expressions are given in
Section 3.3.
.pp
The comment field contains arbitrary characters following the
semicolon
symbol until the next real or logical end-of-line. These
characters are read, listed, and otherwise ignored by the
assembler. The CP/M assembler also treats statements that begin
with an * in column one as comment statements that are listed
and ignored in the assembly process.
.pp
The assembly-language program is formulated as a sequence of
statements of the above form, terminated by an optional END
statement. All statements following the END are ignored by the
assembler.
.sp 2
.tc 3.3 Forming the Operand
.he CP/M Operating System Manual 3.3 Forming the Operand
.sh
3.3 Forming the Operand
.qs
.pp
To describe the operation codes and pseudo operations completely,
it is necessary first to present the form of the operand field,
since it is used in nearly all statements. Expressions in the
operand field consist of simple operands, labels, constants, and
reserved words, combined in properly formed subexpressions by
arithmetic and logical operators. The expression computation is
carried out by the assembler as the assembly proceeds. Each
expression must produce a 16-bit value during the assembly.
Further, the number of significant digits in the result must not
exceed the intended use. If an expression is to be used
in a byte move immediate instruction, the most significant 8 bits
of the expression must be zero. The restriction on the
expression significance is given with the individual
instructions.
.sp 2
.tc 3.3.1 Labels
.sh
3.3.1 Labels
.qs
.pp
As discussed above, a label is an identifier that occurs on a
particular statement. In general, the label is given a value
determined by the type of statement that it precedes. If the
label occurs on a statement that generates machine code or
reserves memory space (for example, a MOV instruction or a
DS pseudo operation), the label is given the value of the program address
that it labels. If the label precedes an EQU or SET, the label
is given the value that results from evaluating the operand
field. Except for the SET statement, an identifier can label
only one statement.
.pp
When a label appears in the operand field, its value is
substituted by the assembler. This value can then be combined
with other operands and operators to form the operand field for a
particular instruction.
.bp
.tc 3.3.2 Numeric Constants
.sh
3.3.2 Numeric Constants
.qs
.pp
A numeric constant is a 16-bit value in one of several bases.
The base, called the radix of the constant, is denoted by a
trailing radix indicator. The following are radix indicators:
.sp
.in 3
.nf
o B is a binary constant (base 2).
o O is a octal constant (base 8).
o Q is a octal constant (base 8).
o D is a decimal constant (base 10).
o H is a hexadecimal constant (base 16).
.fi
.in 0
.pp
Q is an alternate radix indicator for octal numbers because the
letter O is easily confused with the digit 0. Any numeric
constant that does not terminate with a radix indicator is
a decimal constant.
.pp
A constant is composed as a sequence of digits, followed by
an optional radix indicator, where the digits are in the
appropriate range for the radix. Binary constants must
be composed of 0 and 1 digits, octal constants can contain digits
in the range 0-7, while decimal constants contain decimal digits.
Hexadecimal constants contain decimal digits as well as
hexadecimal digits A(10D), B(11D), C(12D), D(13D), E(14D), and
F(15D). Note that the leading digit of a
hexadecimal constant must be a decimal digit to avoid confusing a
hexadecimal constant with an identifier. A leading 0 will always
suffice. A constant composed in this manner must evaluate to a
binary number that can be contained within a 16-bit counter,
otherwise it is truncated on the right by the assembler.
.pp
Similar
to identifiers, embedded $ signs are allowed within constants to
improve their readability. Finally, the radix indicator is
translated to upper-case if a lower-case letter is encountered.
The following are all valid instances of numeric constants:
.sp 2
.nf
.in 8
1234 1234D 1100B 1111$0000$1111$0000B
.sp
1234H OFFEH 3377O 33$77$22Q
.sp
3377o Ofe3h 1234d Offffh
.fi
.in 0
.sp 2
.tc 3.3.3 Reserved Words
.sh
3.3.3 Reserved Words
.qs
.pp
There are several reserved character sequences that have
predefined meanings in the operand field of a statement. The
names of 8080 registers are given below. When they are
encountered, they produce the values shown to the right.
.bp
.nf
.sh
Table 3-1. Reserved Characters
.sp
Character Value
A 7
B 0
C 1
D 2
E 3
H 4
L 5
M 6
SP 6
PSW 6
.fi
.in 0
.sp
.pp
Again, lower-case names have the same values as their upper-case
equivalents. Machine instructions can also be used in the
operand field; they evaluate to their internal codes. In the case
of instructions that require operands, where the specific operand
becomes a part of the binary bit pattern of the instruction,
for example, MOV A,B, the value of the instruction, in this case MOV,
is the bit pattern of the instruction with zeros in the optional
fields, for example, MOV produces 40H.
.pp
When the symbol $ occurs in the operand field, not embedded
within identifiers and numeric constants, its value becomes the
address of the next instruction to generate, not including the
instruction contained within the current logical line.
.sp 2
.tc 3.3.4 String Constants
.sh
3.3.4 String Constants
.qs
.pp
String constants represent sequences of ASCII characters and are
represented by enclosing the characters within apostrophe symbols.
All strings must be fully contained within the current
physical line (thus allowing exclamation point symbols within
strings) and must
not exceed 64 characters in length. The apostrophe character
itself can be included within a string by representing it as a
double apostrophe (the two keystrokes ''), which becomes a single
apostrophe when read by the assembler. In most cases, the string
length is restricted to either one or two characters (the DB
pseudo operation is an exception), in which case the string
becomes an 8- or 16-bit value, respectively. Two-character
strings become a 16-bit constant, with the second character as
the low-order byte, and the first character as the high-order
byte.
.pp
The value of a character is its corresponding ASCII code. There
is no case translation within strings; both upper- and
lower-case characters can be represented. You should note
that only graphic printing ASCII characters are
allowed within strings.
.bp
.nf
Valid strings: How assembler reads strings:
'A' 'AB' 'ab' 'c' A AB ab c
'' 'a''' '''' '''' a' ' '
'Walla Walla Wash.' Walla Walla Wash.
'She said ''Hello'' to me.' She said ''Hello'' to me
'I said ''Hello'' to her.' I said ''Hello'' to her
.fi
.sp 2
.tc 3.3.5 Arithmetic and Logical Operators
.sh
3.3.5 Arithmetic and Logical Operators
.qs
.pp
The operands described in Section 3.3 can be combined in normal algebraic
notation using any combination of properly formed operands,
operators, and parenthesized expressions. The operators
recognized in the operand field are described in Table 3-2.
.sp 2
.ce
.sh
Table 3-2. Arithmetic and Logical Operators
.ll 60
.in 5
.sp
.nf
Operators Meaning
.sp
.fi
.in 19
.ti -13
a + b unsigned arithmetic sum of a and b
.sp
.ti -13
a - b unsigned arithmetic difference between a and b
.sp
.ti -13
+ b unary plus (produces b)
.sp
.ti -13
- b unary minus (identical to 0 - b)
.sp
.ti -13
a * b unsigned magnitude multiplication of a and b
.sp
.ti -13
a / b unsigned magnitude division of a by b
.sp
.ti -13
a MOD b remainder after a / b.
.sp
.ti -13
NOT b logical inverse of b (all 0s become 1s, 1s become
0s), where b is considered a 16-bit value
.sp
.ti -13
a AND b bit-by-bit logical and of a and b
.sp
.ti -13
a OR b bit-by-bit logical or of a and b
.sp
.ti -13
a XOR b bit-by-bit logical exclusive or of a and b
.sp
.ti -13
a SHL b the value that results from shifting a to the left
by an amount b, with zero fill
.sp
.ti -13
a SHR b the value that results from shifting a to the
right by an amount b, with zero fill
.in 0
.ll 65
.sp
.pp
In each case, a and b represent simple operands (labels, numeric
constants, reserved words, and one- or two-character strings) or
fully enclosed parenthesized subexpressions, like those shown in
the following examples:
.sp 2
.nf
.in 8
10+20 10h+37Q LI/3 (L2+4) SHR 3
('a' and 5fh) + '0' ('B'+B) OR (PSW+M)
(1+(2+c)) shr (A-(B+1))
.fi
.in 0
.sp
.pp
Note that all computations are performed at assembly time as 16-bit
unsigned operations. Thus, -1 is computed as 0-1, which
results in the value 0ffffh (that is, all 1s). The resulting
expression must fit the operation code in which it is used. For
example, if the expression is used in an ADI (add immediate)
instruction, the high-order 8 bits of the expression must be
zero. As a result, the operation ADI-1 produces an error message
(-1 becomes 0ffffh, which cannot be represented as an 8-bit
value), while ADI(-1) AND 0FFH is accepted by the assembler
because the AND operation zeros the high-order bits of the
expression.
.sp 2
.tc 3.3.6 Precedence of Operators
.sh
3.3.6 Precedence of Operators
.qs
.pp
As a convenience to the programmer, ASM assumes that operators
have a relative precedence of application that allows the
programmer to write expressions without nested levels of
parentheses. The resulting expression has assumed parentheses
that are defined by the relative precedence. The order of
application of operators in unparenthesized expressions is listed
below. Operators listed first have highest precedence (they are
applied first in an unparenthesized expression), while operators
listed last have lowest precedence. Operators listed on the same
line have equal precedence, and are applied from left to right as
they are encountered in an expression.
.sp 2
.in 8
.mb 5
.fm 1
.nf
* / MOD SHL SHR
- +
NOT
AND
OR XOR
.fi
.in 0
.sp
.pp
Thus, the expressions shown to the left below are interpreted by
the assembler as the fully parenthesized expressions shown to the
right.
.bp
.nf
.in 5
a*b+c (a*b)+c
a+b*c a+(b*c)
a MOD b*c SHL d ((a MOD b)*c) SHL d
a OR b AND NOT c+d SHL e a OR (b AND (NOT (c+(d SHL e))))
.fi
.in 0
.sp
.pp
Balanced, parenthesized subexpressions can always be used to
override the assumed parentheses; thus, the last expression above
could be rewritten to force application of operators in a
different order, as shown:
.sp
.ti 8
(a OR b) AND (NOT c)+ d SHL e
.sp
This results in these assumed parentheses:
.sp
.ti 8
(a OR b) AND ((NOT c) + (d SHL e))
.pp
An unparenthesized expression is well-formed only if the
expression that results from inserting the assumed parentheses is
well-formed.
.sp 2
.tc 3.4 Assembler Directives
.he CP/M Operating System Guide 3.4 Assembler Directives
.sh
3.4 Assembler Directives
.qs
.pp
Assembler directives are used to set labels to specific values
during the assembly, perform conditional assembly, define storage
areas, and specify starting addresses in the program. Each
assembler directive is denoted by a pseudo operation that appears
in the operation field of the line. The acceptable pseudo operations
are shown in Table 3-3.
.sp 2
.nf
.sh
Table 3-3. Assembler Directives
.sp
Directive Meaning
.fi
.sp
ORG set the program or data origin
.sp
END end program, optional start address
.sp
EQU numeric equate
.sp
SET numeric set
.sp
IF begin conditional assembly
.sp
ENDIF end of conditional assembly
.sp
DB define data bytes
.sp
DW define data words
.sp
DS define data storage area
.in 0
.bp
.tc 3.4.1 The ORG Directive
.sh
3.4.1 The ORG Directive
.qs
.pp
The ORG statement takes the form:
.sp
.ti 8
label ORG expression
.sp
where label is an optional program identifier and expression is
a 16-bit expression, consisting of operands that are defined
before the ORG statement. The assembler begins machine code
generation at the location specified in the expression. There
can be any number of ORG statements within a particular program,
and there are no checks to ensure that the programmer is not
defining overlapping memory areas. Note that
most programs written for the CP/M system begin with an ORG
statement of the form:
.sp
.ti 8
ORG 100H
.sp
which causes machine code generation to begin at the base of the
CP/M transient program area. If a label is specified in the ORG
statement, the label is given the value of the expression. This
label can then be used in the operand field of other statements
to represent this expression.
.sp 2
.tc 3.4.2 The END Directive
.sh
3.4.2 The END Directive
.qs
.pp
The END statement is optional in an assembly-language program,
but if it is present it must be the last statement. All
subsequent statements are ignored in the assembly. The END
statement takes the following two forms:
.sp
.in 8
.nf
label END
label END expression
.fi
.in 0
.sp
where the label is again optional. If the first form is used,
the assembly process stops, and the default starting address of
the program is taken as 0000. Otherwise, the expression is
evaluated, and becomes the program starting address. This
starting address is included in the last record of the Intel-formatted
machine code hex file that results from the
assembly. Thus, most CP/M assembly-language programs end with
the statement:
.sp
.ti 8
END 100H
.sp
resulting in the default starting address of 100H (beginning of
the transient program area).
.bp
.tc 3.4.3 The EQU Directive
.sh
3.4.3 The EQU Directive
.qs
.pp
The EQU (equate) statement is used to set up synonyms for
particular numeric values. The EQU statement takes the form:
.sp
.ti 8
.nf
label EQU expression
.fi
.sp
where the label must be present and must not label any other
statement. The assembler evaluates the expression and assigns
this value to the identifier given in the label field. The
identifier is usually a name that describes the value in a more
human-oriented manner. Further, this name is used throughout the
program to place parameters on certain functions. Suppose data
received from a teletype appears on a particular input port, and
data is sent to the teletype through the next output port in
sequence. For example, you can use this series of equate statements
to define these ports for a particular hardware environment:
.sp 2
.in 8
.nf
TTYBASE EQU 10H ;BASE PORT NUMBER FOR TTY
TTYIN EQU TTYBASE ;TTY DATA IN
TTYOUT EQU TTYBASE+1 ;TTY DATA OUT
.fi
.in 0
.sp
.pp
At a later point in the program, the statements that access the
teletype can appear as follows:
.sp 2
.in 7
.nf
IN TTYIN ;READ TTY DATA TO REG-A
...
OUT TTYOUT ;WRITE DATA TO TTY FROM REG-A
.fi
.in 0
.sp 2
making the program more readable than if the absolute I/O ports
are used. Further, if the hardware environment is redefined
to start the teletype communications ports at 7FH instead of 10H,
the first statement need only be changed to
.sp
.ti 8
.nf
TTYBASE EQU 7FH ;BASE PORT NUMBER FOR TTY
.fi
.sp
and the program can be reassembled without changing any other
statements.
.sp 2
.tc 3.4.4 The SET Directive
.sh
3.4.4 The SET Directive
.qs
.pp
The SET statement is similar to the EQU, taking the form:
.sp
.ti 8
label SET expression
.sp
except that the label can occur on other SET statements within
the program. The expression is evaluated and becomes the current
value associated with the label. Thus, the EQU statement defines
a label with a single value, while the SET statement defines a
value that is valid from the current SET statement to the point
where the label occurs on the next SET statement. The use of the
SET is similar to the EQU statement, but is used most often in
controlling conditional assembly.
.sp 2
.tc 3.4.5 The IF and ENDIF Directives
.sh
3.4.5 The IF and ENDIF Directives
.qs
.pp
The IF and ENDIF statements define a range of assembly-language
statements that are to be included or excluded during the
assembly process. These statements take on the form:
.sp 2
.in 8
.nf
IF expression
statement#1
statement#2
...
statement#n
ENDIF
.fi
.in 0
.sp
.pp
When encountering the IF statement, the assembler evaluates the
expression following the IF. All operands in the expression must
be defined ahead of the IF statement. If the expression
evaluates to a nonzero value, then statement#1 through
statement#n are assembled. If the expression evaluates to zero,
the statements are listed but not assembled. Conditional
assembly is often used to write a single generic program that
includes a number of possible run-time environments, with only a
few specific portions of the program selected for any particular
assembly. The following program segments, for example, might be
part of a program that communicates with either a teletype or a
CRT console (but not both) by selecting a particular value for
TTY before the assembly begins.
.bp
.nf
.in 8
TRUE EQU OFFFFH ;DEFINE VALUE OF TRUE
FALSE EQU NOT TRUE ;DEFINE VALUE OF FALSE
;
TTY EQU TRUE ;TRUE IF TTY, FALSE IF CRT
;
TTYBASE EQU 10H ;BASE OF TTY I/O PORTS
CRTBASE EQU 20H ;BASE OF CRT I/O PORTS
IF TTY ;ASSEMBLE RELATIVE TO
;TTYBASE
CONIN EQU TTYBASE ;CONSOLE INPUT
CONOUT EQU TTYBASE+1 ;CONSOLE OUTPUT
ENDIF
; IF NOT TTY ;ASSEMBLE RELATIVE TO
;CRTBASE
CONIN EQU CRTBASE ;CONSOLE INPUT
CONOUT EQU CRTBASE+1 ;CONSOLE OUTPUT
ENDIF
...
IN CONIN ;READ CONSOLE DATA
...
OUT CONTOUT ;WRITE CONSOLE DATA
.fi
.in 0
.sp 2
In this case, the program assembles for an environment where
a teletype is connected, based at port 10H. The statement
defining TTY can be changed to
.sp
.nf
.ti 8
TTY EQU FALSE
.fi
.sp
and, in this case, the program assembles for a CRT based at
port 20H.
.sp 2
.tc 3.4.6 The DB Directive
.sh
3.4.6 The DB Directive
.qs
.pp
The DB directive allows the programmer to define initialized
storage areas in single-precision byte format. The DB statement
takes the form:
.sp
.nf
.ti 8
label DB e#1, e#2, ..., e#n
.fi
.sp
where e#1 through e#n are either expressions that evaluate to 8-bit
values (the high-order bit must be zero) or are ASCII strings
of length no greater than 64 characters. There is no practical
restriction on the number of expressions included on a single
source line. The expressions are evaluated and placed
sequentially into the machine code file following the last
program address generated by the assembler. String characters
are similarly placed into memory starting with the first
character and ending with the last character. Strings of length
greater than two characters cannot be used as operands in more
complicated expressions.
.bp
.sh
Note: \c
.qs
ASCII
characters are always placed in memory with the parity bit reset
(0). Also, there is no translation from lower- to upper-case
within strings. The optional label can be used to reference the
data area throughout the remainder of the program. The following
are examples of valid DB statements:
.sp 2
.nf
.in 8
data: DB 0,1,2,3,4,5
DB data and 0ffh,5,377Q,1+2+3+4
sign-on: DB 'please type your name',cr,lf,0
DB 'AB' SHR 8, 'C', 'DE' AND 7FH
.fi
.in 0
.sp 3
.tc 3.4.7 The DW Directive
.sh
3.4.7 The DW Directive
.qs
.pp
The DW statement is similar to the DB statement except double-precision
two-byte words of storage are initialized. The DW statement
takes the form:
.sp
.nf
.ti 8
label DW e#1, e#2, ..., e#n
.fi
.sp
where e#1 through e#n are expressions that evaluate to 16-bit
results. Note that ASCII strings of one or two
characters are allowed, but strings longer than two characters
are disallowed. In all cases, the data storage is consistent
with the 8080 processor; the least significant byte of the
expression is stored first in memory, followed by the most
significant byte. The following are examples of DW statements:
.sp 2
.in 8
.nf
doub: DW 0ffefh,doub+4,signon-$,255+255
DW 'a', 5, 'ab', 'CD', 6 shl 8 or llb.
.fi
.in 0
.sp 3
.tc 3.4.8 The DS Directive
.sh
3.4.8 The DS Directive
.qs
.pp
The DS statement is used to reserve an area of uninitialized
memory, and takes the form:
.sp
.ti 8
.nf
label DS expression
.fi
.sp
where the label is optional. The assembler begins subsequent
code generation after the area reserved by the DS. Thus, the DS
statement given above has exactly the same effect as the following
statement:
.sp
.nf
.in 7
label: EQU $ ;LABEL VALUE IS CURRENT CODE LOCATION
ORG $+expression ;MOVE PAST RESERVED AREA
.fi
.in 0
.nx threeb


954
Source/Doc/CPM 22 Manual - Testing/threeb.tex

@ -1,954 +0,0 @@
.bp
.op
.cs 5
.mt 5
.mb 6
.pl 66
.ll 65
.po 10
.hm 2
.fm 2
.ft 3-%
.he CP/M Operating System Manual 3.5 Operation Codes
.tc 3.5 Operation Codes
.sh
3.5 Operation Codes
.qs
.pp 5
Assembly-language operation codes form the principal part of
assembly-language programs and form the operation field of the
instruction. In general, ASM accepts all the standard mnemonics
for the Intel 8080 microcomputer, which are given in detail in the \c
.ul
Intel 8080 Assembly Language Programming Manual. \c
.qu
Labels are optional on each input line. The individual operators
are listed briefly in the following sections for completeness,
although the Intel manuals should be
referenced for exact operator details. In Tables 3-4 through 3-8,
bit values have the following meaning:
.sp 2
.in 5
.ti -2
o e3 represents a 3-bit value in the range 0-7 that can be
one of the predefined registers A, B, C, D, E, H, L, M, SP, or
PSW.
.sp
.ti -2
o e8 represents an 8-bit value in the range 0-255.
.sp
.ti -2
o e16 represents a 16-bit value in the range 0-65535.
.in 0
.sp
.pp
These expressions can be formed from an arbitrary combination of
operands and operators. In some cases, the operands are
restricted to particular values within the allowable range, such
as the PUSH instruction. These cases are noted as they are
encountered.
.pp
In the sections that follow, each operation code is listed in its
most general form, along with a specific example, a short
explanation, and special restrictions.
.sp 2
.tc 3.5.1 Jumps, Calls, and Returns
.sh
3.5.1 Jumps, Calls, and Returns
.qs
.pp
The Jump, Call, and Return instructions allow several different
forms that test the condition flags set in the 8080 microcomputer
CPU. The forms are shown in Table 3-4.
.sp 2
.ce
.sh
Table 3-4. Jumps, Calls, and Returns
.ll 63
.sp
.nf
Form Bit Example Meaning
Value
JMP e16 JMP L1 Jump unconditionally to label
JNZ e16 JNZ L2 Jump on nonzero condition to label
JZ e16 JZ 100H Jump on zero condition to label
JNC e16 JNC L1+4 Jump no carry to label
JC e16 JC L3 Jump on carry to label
JPO e16 JPO $+8 Jump on parity odd to label
.bp
.ll 65
.fi
.ce
.sh
Table 3-4. (continued)
.ll 63
.sp
.nf
Form Bit Example Meaning
Value
JPE e16 JPE L4 Jump on even parity to label
JP e16 JP GAMMA Jump on positive result to label
JM e16 JM al Jump on minus to label
CALL e16 CALL S1 Call subroutine unconditionally
CNZ e16 CNZ S2 Call subroutine on nonzero
condition
CZ e16 CZ 100H Call subroutine on zero condition
CNC e16 CNC S1+4 Call subroutine if no carry set
CC e16 CC S3 Call subroutine if carry set
CPO e16 CPO $+8 Call subroutine if parity odd
CPE e16 CPE $4 Call subroutine if parity even
CP e16 CP GAMMA Call subroutine if positive result
CM e16 CM b1$c2 Call subroutine if minus flag
RST e3 RST 0 Programmed restart, equivalent to
CALL 8*e3, except one byte call
RET Return from subroutine
RNZ Return if nonzero flag set
RZ Return if zero flag set
RNC Return if no carry
RC Return if carry flag set
RPO Return if parity is odd
RPE Return if parity is even
RP Return if positive result
RM Return if minus flag is set
.fi
.in 0
.ll 65
.sp 3
.tc 3.5.2 Immediate Operand Instructions
.sh
3.5.2 Immediate Operand Instructions
.qs
.pp 5
Several instructions are available that load single- or double-
precision registers or single-precision memory cells with
constant values, along with instructions that perform immediate
arithmetic or logical operations on the accumulator (register A).
Table 3-5 describes the immediate operand instructions.
.sp 2
.ce
.sh
Table 3-5. Immediate Operand Instructions
.sp
.ll 60
.in 5
.nf
Form with Example Meaning
Bit Values
.fi
.sp
.in 35
.ti -30
MVI e3,e8 MVI B,255 Move immediate data to register A, B, C, D,
E, H, L, or M (memory)
.sp
.ti -30
ADI e8 ADI 1 Add immediate operand to A without carry
.sp
.ti -30
ACI e8 ACI 0FFH Add immediate operand to A with carry
.sp
.ti -30
SUI e8 SUI L + 3 Subtract from A without borrow (carry)
.sp
.ti -30
SBI e8 SBI L AND 11B Subtract from A with borrow (carry)
.sp
.ti -30
ANI e8 ANI $ AND 7FH Logical and A with immediate data
.sp
.ti -30
XRI e8 XRI 1111$0000B Exclusive or A with immediate data
.sp
.ti -30
ORI e8 ORI L AND 1+1 Logical or A with immediate data
.sp
.ti -30
CPI e8 CPI 'a' Compare A with immediate data, same
as SUI except register A not changed.
.sp
.ti -30
LXI e3,e16 LXI B,100H Load extended immediate to register
pair. e3 must be equivalent to B, D, H, or SP.
.in 0
.ll 65
.sp 2
.tc 3.5.3 Increment and Decrement Instructions
.sh
3.5.3 Increment and Decrement Instructions
.qs
.pp
The 8080 provides instructions for incrementing or decrementing
single- and double-precision registers. The instructions are
described in Table 3-6.
.sp 2
.ce
.sh
Table 3-6. Increment and Decrement Instructions
.ll 60
.sp
.in 5
.nf
Form with Example Meaning
Bit Value
.fi
.sp
.in 35
.ti -28
INR e3 INR E Single-precision increment
register. e3 produces one of A, B, C, D, E, H, L, M.
.sp
.ti -28
DCR e3 DCR A Single-precision decrement
register. e3 produces one of A, B, C, D, E, H, L, M.
.sp
.ti -28
INX e3 INX SP Double-precision increment register
pair. e3 must be equivalent to B, D, H, or SP.
.sp
.ti -28
DCX e3 DCX B Double-precision decrement register
pair. e3 must be equivalent to B, D, H, or SP.
.in 0
.ll 65
.sp 3
.tc 3.5.4 Data Movement Instructions
.sh
3.5.4 Data Movement Instructions
.qs
.pp
Instructions that move data from memory to the CPU and from CPU to memory are
given in the following table.
.sp 2
.ce
.sh
Table 3-7. Data Movement Instructions
.ll 60
.in 5
.sp
.nf
Form with Example Meaning
Bit Value
.fi
.sp
.in 35
.ti -30
MOV e3,e3 MOV A,B Move data to leftmost element from rightmost
element. e3 produces on of A, B, C, D, E, H, L, or M. MOV M,M is
disallowed.
.sp
.ti -30
LDAX e3 LDAX B Load register A from computed address. e3 must
produce either B or D.
.sp
.ti -30
STAX e3 STAX D Store register A to computed
address. e3 must produce either B or D.
.sp
.ti -30
LHLD e16 LHLD L1 Load HL direct from location
e16. Double-precision load to H and L.
.fi
.bp
.ll 65
.in 0
.ce
.sh
Table 3-7. (continued)
.ll 60
.in 5
.sp
.nf
Form with Example Meaning
Bit Value
.fi
.sp
.in 35
.ti -30
SHLD e16 SHLD L5+x Store HL direct to location e16.
Double-precision store from H and L to memory.
.sp
.ti -30
LDA e16 LDA Gamma Load register A from address e16.
.sp
.ti -30
STA e16 STA X3-5 Store register A into memory
at e16.
.sp
.ti -30
POP e3 POP PSW Load register pair from stack, set SP.
e3 must produce one of B, D, H, or PSW.
.sp
.ti -30
PUSH e3 PUSH B Store register pair into stack, set SP. e3
must produce on of B, D, H, or PSW.
.sp
.ti -30
IN e8 IN 0 Load register A with data from port
e8.
.sp
.ti -30
OUT e8 OUT 255 Send data from register A to port
e8.
.sp
.ti -30
XTHL Exchange data from top of stack
with HL.
.sp
.ti -30
PCHL Fill program counter with data from
HL.
.sp
.ti -30
SPHL Fill stack pointer with data from
HL.
.sp
.ti -30
XCHG Exchange DE pair with HL pair.
.in 0
.ll 65
.sp 3
.tc 3.5.5 Arithmetic Logic Unit Operations
.sh
3.5.5 Arithmetic Logic Unit Operations
.qs
.pp
Instructions that act upon the single-precision accumulator to
perform arithmetic and logic operations are given in the
following table.
.bp
.ce
.sh
Table 3-8. Arithmetic Logic Unit Operations
.ll 60
.sp
.in 5
.nf
Form with Example Meaning
Bit Value
.fi
.sp
.in 35
.ti -29
ADD e3 ADD B Add register given by e3 to
accumulator without carry. e3 must produce one of A, B, C, D, E,
H, or L.
.sp
.ti -29
ADC e3 ADC L Add register to A with carry, e3 as
above.
.sp
.ti -29
SUB e3 SUB H Subtract reg e3 from A without
carry, e3 is defined as above.
.sp
.ti -29
SBB e3 SBB 2 Subtract register e3 from A with
carry, e3 defined as above.
.sp
.ti -29
ANA e3 ANA 1+1 Logical and reg with A, e3 as
above.
.sp
.ti -29
XRA e3 XRA A Exclusive or with A, e3 as above.
.sp
.ti -29
ORA e3 ORA B Logical or with A, e3 defined as
above.
.sp
.ti -29
CMP e3 CMP H Compare register with A, e3 as
above.
.sp
.ti -29
DAA Decimal adjust register A based
upon last arithmetic logic unit operation.
.sp
.ti -29
CMA Complement the bits in register A.
.sp
.ti -29
STC Set the carry flag to 1.
.sp
.ti -29
CMC Complement the carry flag.
.sp
.ti -29
RLC Rotate bits left, (re)set carry as a
side effect. High-order A bit becomes carry.
.sp
.ti -29
RRC Rotate bits right, (re)set carry as
side effect. Low-order A bit becomes carry.
.bp
.in 0
.ll 65
.ce
.sh
Table 3-8. (continued)
.ll 60
.sp
.in 5
.nf
Form with Example Meaning
Bit Value
.fi
.sp
.in 35
.ti -29
RAL Rotate carry/A register to left.
Carry is involved in the rotate.
.sp
.ti -29
RAR Rotate carry/A register to right.
Carry is involved in the rotate.
.sp
.ti -29
DAD e3 DAD B Double-precision add register pair
e3 to HL. e3 must produce B, D, H, or SP.
.in 0
.ll 65
.sp 2
.tc 3.5.6 Control Instructions
.sh
3.5.6 Control Instructions
.qs
.pp
The four remaining instructions, categorized as control instructions, are
the following:
.sp
.nf
.in 3
o HLT halts the 8080 processor.
o DI disables the interrupt system.
o EI enables the interrupt system.
o NOP means no operation.
.in 0
.fi
.sp 2
.tc 3.6 Error Messages
.he CP/M Operating System Manual 3.6 Error Messages
.sh
3.6 Error Messages
.qs
.pp
When errors occur within the assembly-language program, they are
listed as single-character flags in the leftmost position of the
source listing. The line in error is also echoed at the console
so that the source listing need not be examined to determine if
errors are present. The error codes are listed in the following
table.
.sp 2
.ce
.sh
Table 3-9. Error Codes
.sp
.ll 60
.in 3
.nf
Error Code Meaning
.fi
.sp
.in 16
.ti -13
D Data error: element in data statement cannot be placed in
the specified data area.
.sp
.ti -13
E Expression error: expression is ill-formed and cannot be
computed at assembly time.
.sp
.ti -13
L Label error: label cannot appear in this context; might be
duplicate label.
.sp
.ti -13
N Not implemented: features that will appear in future ASM
versions. For example, macros are recognized, but flagged in this
version.
.bp
.in 0
.ll 65
.ce
.sh
Table 3-9. (continued)
.sp
.ll 60
.in 3
.nf
Error Code Meaning
.fi
.sp
.in 16
.ti -13
O Overflow: expression is too complicated (too many
pending operators) to be computed and should be simplified.
.sp
.ti -13
P Phase error: label does not have the same value on two
subsequent passes through the program.
.sp
.ti -13
R Register error: the value specified as a register is not
compatible with the operation code.
.sp
.ti -13
S Syntax error: statement is not properly formed.
.sp
.ti -13
V Value error: operand encountered in expression is
improperly formed.
.in 0
.ll 65
.sp
.pp
Table 3-10 lists the error messages that are due to terminal error
conditions.
.sp 2
.ce
.sh
Table 3-10. Error Messages
.sp
.ll 60
.in 5
.nf
Message Meaning
.fi
.sp
NO SOURCE FILE PRESENT
.sp
.in 19
The file specified in the ASM command does not exist on disk.
.sp 2
.in 5
NO DIRECTORY SPACE
.sp
.in 19
The disk directory is full; erase files that are not needed and retry.
.sp 2
.in 5
SOURCE FILE NAME ERROR
.sp
.in 19
Improperly formed ASM filename, for example, it is specified with ? fields.
.sp 2
.in 5
SOURCE FILE READ ERROR
.sp
.in 19
Source file cannot be read properly by the assembler; execute a
TYPE to determine the point of error.
.bp
.in 0
.ll 65
.ce
.sh
Table 3-10. (continued)
.sp
.ll 60
.in 5
.nf
Message Meaning
.fi
.sp
OUTPUT FILE WRITE ERROR
.sp
.in 19
Output files cannot be written properly; most likely cause is a full
disk, erase and retry.
.sp 2
.in 5
CANNOT CLOSE FILE
.sp
.in 19
Output file cannot be closed; check to see if disk is write protected.
.in 0
.ll 65
.sp 3
.tc 3.7 A Sample Session
.he CP/M Operating System Manual 3.7 A Sample Session
.sh
3.7 A Sample Session
.qs
.pp
The following sample session shows interaction with the assembler and
debugger in the development of a simple assembly-language
program. The arrow represents a carriage return keystroke.
.sp 2
.ll 90
.nf
A>\c
.sh
ASM SORT \c
.qs
Assemble SORT.ASM
.sp
CP/M ASSEMBLER - VER 1.0
.sp
0015C Next free address
003H USE FACTOR Percent of table used 00 to ff (hexadecimal)
END OF ASSEMBLY
.sp
A>\c
.sh
DIR SORT.*
.qs
.sp
SORT ASM Source file
SORT BAK Back-up from last edit
SORT PRN Print file (contains tab characters)
SORT HEX Machine code file
.sp
A>\c
.sh
TYPE SORT.PRN
.qs
Source line
.sp
; SORT PROGRAM IN CP/M ASSEMBLY LANGUAGE
; START AT THE BEGINNING OF THE TRANSIENT
PROGRAM AREA
.sp
Machine code location
0100 ORG 100H
.sp
Generated machine code
0100 214601 SORT: LXI H,SW ;ADDRESS SWITCH TOGGLE
0103 3601 MVI M,1 ;SET TO 1 FOR FIRST ITERATION
0105 214701 LXI H,I ;ADDRESS INDEX
0108 3600 MVI M,0 ;I=0
;
; COMPARE I WITH ARRAY SIZE
010A 7E COMPL: MOV A,M ;A REGISTER = I
010B FE09 CPI N-1 ;CY SET IF I<(N-1)
010D D21901 JNC CONT ;CONTINUE IF I<=(N-2)
;
; END OF ONE PASS THROUGH DATA
0110 214601 LXI H,SW ;CHECK FOR ZERO SWITCHES
0113 7EB7C200001 MOV A, M! ORA A! JNZ SORT ;END OF SORT IF SW=0
;
0118 FF RST 7 ;GO TO THE DEBUGGER INSTEAD OF REB
;
; CONTINUE THIS PASS
Truncated ; ADDRESSING I, SO LOAD AV(I) INTO REGISTERS
0119
5F16002148CONT: MOV E, A! MVI D, 0! LXI H, AV! DAD D! DAD D
0121 4E792346 MOV C, M! MOV A, C! INX H! MOV B, M
; LOW ORDER BYTE IN A AND C, HIGH ORDER BYTE IN B
;
; MOV H AND L TO ADDRESS AV(I+1)
0125 23 INX H
;
; COMPARE VALUE WITH REGS CONTAINING AV (I)
0126 965778239E SUB M! MOV D, A! MOV A, B! INX H! SBB M ;SUBTRACT
;
; BORROW SET IF AV(I+1)>AV(I)
012B DA3F01 JC INCI ;SKIP IF IN PROPER ORDER
;
; CHECK FOR EQUAL VALUES
012E B2CA3F01 ORA D! JZ INCI ;SKIP IF AV(I) = AV(I+1)
0132 56702B5E MOV D, M! MOV M, B! DCX H! MOV E, M
0136 712B722B73 MOV M, C! DCX H! MOV M, D! DCX H! MOV M, E
;
; INCREMENT SWITCH COUNT
013B 21460134 LXI H,SW! INR M
;
; INCREMENT I
013F 21470134C3INCI:LXI H,I! INR M! JMP COMP
;
; DATA DEFINITION SECTION
0146 00 SW: DB 0 ;RESERVE SPACE FOR SWITCH COUNT
0147 I: DS 1 ;SPACE FOR INDEX
0148 050064001EAV: DW 5, 100, 30, 50, 20, 7, 1000, 300, 100, -32767
000A = N EQU($-AV)/2 ;COMPUTE N INSTEAD OF PRE
015C END
A>\c
.sh
TYPE SORT.HEX \c
.qs
Equate value
:10010000214601360121470136007EFE09D2190140
:100110002146017EB7C20001FF5F16002148011988 Machine code in
:10012000194E79234623965778239EDA3F01B2CAA7 HEX format
.mb 5
.fm 1
:100130003F0156702B5E712B722B732146013421C7
:07014000470134C30A01006E Machine code in
:10014800050064001E00320014000700E8032C01BB HEX format
:0401580064000180BE
:0000000000
A>\c
.sh
DDT SORT.HEX \c
.qs
Start debug run
.mb 6
.fm 2
16K DDT VER 1.0
NEXT PC
015C 0000 Default address (no address on END statement)
-XP
P=0000 100 Change PC to 100
-UFFFF Untrace for 65535 steps
Abort with rubout
C0Z0M0E0I0 A=00 B=0000 D=0000 H=0000 S=0100 P=0100 LXI H,0146*0100
-T10 Trace 10\d16\u steps
C0Z0M0E0I0 A=01 B=0000 D=0000 H=0146 S=0100 P=0100 LXI H, 0146
C0Z0M0E0I0 A=01 B=0000 D=0000 H=0146 S=0100 P=0103 MVI M, 01
C0Z0M0E0I0 A=01 B=0000 D=0000 H=0146 S=0100 P=0105 LXI H, 0147
C0Z0M0E0I0 A=01 B=0000 D=0000 H=0147 S=0100 P=0108 MVI M, 00
C0Z0M0E0I0 A=01 B=0000 D=0000 H=0147 S=0100 P=010A MOV A, M
C0Z0M0E0I0 A=00 B=0000 D=0000 H=0147 S=0100 P=010B CPI 09
C1Z0M1E0I0 A=00 B=0000 D=0000 H=0147 S=0100 P=010D JNC 0119
C1Z0M1E0I0 A=00 B=0000 D=0000 H=0147 S=0100 P=0110 LXI H, 0146
C1Z0M1E0I0 A=00 B=0000 D=0000 H=0146 S=0100 P=0113 MOV A, M
C1Z0M1E0I0 A=01 B=0000 D=0000 H=0146 S=0100 P=0114 ORA A
C0Z0M0E0I0 A=01 B=0000 D=0000 H=0146 S=0100 P=0115 JNZ 0100
C0Z0M0E0I0 A=01 B=0000 D=0000 H=0146 S=0100 P=0100 LXI H, 0146
C0Z0M0E0I0 A=01 B=0000 D=0000 H=0146 S=0100 P=0103 MVI M, 01
C0Z0M0E0I0 A=01 B=0000 D=0000 H=0146 S=0100 P=0105 LXI H, 0147
C0Z0M0E0I0 A=01 B=0000 D=0000 H=0147 S=0100 P=0108 MVI M, 00
C0Z0M0E0I0 A=01 B=0000 D=0000 H=0147 S=0100 P=010A MOV A, M*010B
-A10D Stopped at 10BH
010D JC 119 Change to a jump on carry
0110
-XP
P=010B 100 Reset program counter back to beginning of program
-T10 Trace execution for 10H steps
Altered instruction
C0Z0M0E0I0 A=00 B=0000 D=0000 H=0147 S=0100 P=0100 LXI H,0146
C0Z0M0E0I0 A=00 B=0000 D=0000 H=0146 S=0100 P=0103 MVI M,01
C0Z0M0E0I0 A=00 B=0000 D=0000 H=0146 S=0100 P=0105 LXI H,0147
C0Z0M0E0I0 A=00 B=0000 D=0000 H=0147 S=0100 P=0108 MVI M,00
C0Z0M0E0I0 A=00 B=0000 D=0000 H=0147 S=0100 P=010A MOV A,M
C0Z0M0E0I0 A=00 B=0000 D=0000 H=0147 S=0100 P=010B CPI 09
C1Z0M1E0I0 A=00 B=0000 D=0000 H=0147 S=0100 P=010D JC 0119
C1Z0M1E0I0 A=00 B=0000 D=0000 H=0147 S=0100 P=0119 MOV E,A
C1Z0M1E0I0 A=00 B=0000 D=0000 H=0147 S=0100 P=011A MVI D,00
C1Z0M1E0I0 A=00 B=0000 D=0000 H=0147 S=0100 P=011C LXI H,0148
C1Z0M1E0I0 A=00 B=0000 D=0000 H=0148 S=0100 P=011F DAD D
C0Z0M1E0I0 A=00 B=0000 D=0000 H=0148 S=0100 P=0120 DAD D
C0Z0M1E0I0 A=00 B=0000 D=0000 H=0148 S=0100 P=0121 MOV C,M
C0Z0M1E0I0 A=00 B=0005 D=0000 H=0148 S=0100 P=0122 MOV A,C
C0Z0M1E0I0 A=05 B=0005 D=0000 H=0148 S=0100 P=0123 INX H
C0Z0M1E0I0 A=05 B=0005 D=0000 H=0149 S=0100 P=0124 MOV B,M*0125
-L100 Automatic breakpoint
0100 LXI H,0146
0103 MVI M,01
0105 LXI H,0147
0108 MVI M,00
010A MOV A,M List some code
010B CPI 09 from 100H
010D JC 0119
0110 LXI H,0146
0113 MOV A,M
0114 ORA A
0115 JNZ 0100
-L
0118 RST 07
0119 MOV E,A List more
011A MVI D,00
011C LXI H,0148
-Abort list with rubout
-G,11B Start program from current PC (0125H)
and run in real time to 11BH
*0127 Stopped with an external interrupt 7 from front panel
-T4 (program was looping indefinitely)
Look at looping program in trace mode
C0Z0M0E0I0 A=38 B=0064 D=0006 H=0156 S=0100 P=0127 MOV D,A
C0Z0M0E0I0 A=38 B=0064 D=3806 H=0156 S=0100 P=0128 MOV A,B
C0Z0M0E0I0 A=00 B=0064 D=3806 H=0156 S=0100 P=0129 INX H
C0Z0M0E0I0 A=00 B=0064 D=3806 H=0157 S=0100 P=012A SBB M*012B
-D148
Data are sorted, but program does not stop.
0148 05 00 07 00 14 00 1E 00........
0150 32 00 64 00 64 00 2C 01 E8 03 01 80 00 00 00 00 2.D.D.,........
0160 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00................
-G0 Return to CP/M
A>\c
.sh
DDT SORT.HEX \c
.qs
Reload the memory image
16K DDT VER 1.0
NEXT PC
015C 0000
-XP
P=0000 100 Set PC to beginning of program
-L10D List bad OPCODE
010D JNC 0119
0110 LXI H,0146
-Abort list with rubout
-A10D Assemble new OPCODE
010D JC 119
0110
-L100 List starting section of program
0100 LXI H,0146
0103 MVI M,01
0105 LXI H,0147
0108 MVI M,00
-Abort list with rubout
-A103 Change switch initialization to 00
0103 MVI M,0
0105
-^C Return to CP/M with CTRL-C (G0 works as well)
SAVE 1 SORT.COM Save 1 page (256 bytes, from 100H to 1ffH) on
disk in case there is need to reload later
A>\c
.sh
DDT SORT.COM \c
.qs
Restart DDT with saved memory image
16K DDT VER 1.0
NEXT PC
0200 0100 COM file always starts with address 100H
-G Run the program from PC=100H
*0118 Programmed stop (RST 7) encountered
-D148
Data properly sorted
0148 05 00 07 00 14 00 1E 00........
0150 32 00 64 00 64 00 2C 01 E8 03 01 80 00 00 00 00 2.D.D.........
0160 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00................
0170 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00................
-G0 Return to CP/M
A>\c
.sh
ED SORT.ASM \c
.qs
Make changes to original program
*N,0^Z0TT Find next ,0
MVI M,0 ;I = 0
*- Up one line in text
LXI H,I ;ADDRESS INDEX
.bp
*- Up another line
MVI M,1 ;SET TO 1 FOR FIRST ITERATION
*KT Kill line and type next line
LXI H,I ;ADDRESS INDEX
*I Insert new line
MVI M,0 ;ZERO SW
*T
LXI H,I ;ADDRESS INDEX
*NJNC^Z0T
JNC*T
CONT ;CONTINUE IF I<=(N-2)
*-2DIC^Z0LT
JC CONT ;CONTINUE IF I<=(N-2)
*E Source from disk A
HEX to disk A
A>\c
.sh
ASM SORT.AAZ \c
.qs
Skip PRN file
CP/M ASSEMBLER - VER 1.0
015C Next address to assemble
003H USE FACTOR
END OF ASSEMBLY
A>\c
.sh
DDT SORT.HEX \c
.qs
Test program changes
16K DDT VER 1.0
NEXT PC
015C 0000
-G100
*0118
-D148
Data sorted
0148 05 00 07 00 14 00 1E 00........
0150 32 00 64 00 64 00 2C 01 E8 03 01 80 00 00 00 00 2.D.D..........
0160 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00................
-Abort with rubout
-G0 Return to CP/M--program checks OK.
.in 0
.ll 65
.sp 2
.ce
End of Section 3
.nx foura


1124
Source/Doc/CPM 22 Manual - Testing/two.tex

File diff suppressed because it is too large

27
Source/Doc/CPM 22 Manual/Build.cmd

@ -1,27 +0,0 @@
@echo off
setlocal
set TOOLS=..\..\..\Tools
set PATH=%TOOLS%\zx;%PATH%
set ZXBINDIR=%TOOLS%/cpm/bin/
set ZXLIBDIR=%TOOLS%/cpm/lib/
set ZXINCDIR=%TOOLS%/cpm/include/
rem set TEXOPT=-$D -$Q
zx TEX21A PART1 %TEXOPT%
zx TEX21A PART2 %TEXOPT%
zx TEX21A PART3 %TEXOPT%
echo Remove extraneous control codes and escape sequences
rem pause
PowerShell .\Strip.ps1
call texify -p --clean "Main.ltx"
if errorlevel 1 goto :eof
move /Y Main.pdf "..\..\..\Doc\CPM 22 Manual.pdf"

9
Source/Doc/CPM 22 Manual/Clean.cmd

@ -1,9 +0,0 @@
@echo off
setlocal
if exist *.pdf del *.pdf
if exist *.prn del *.prn
if exist *.ix del *.ix
if exist *.log del *.log
if exist part?.txt del part?.txt
if exist *.synctex.gz del *.synctex.gz

40
Source/Doc/CPM 22 Manual/Main.ltx

@ -1,40 +0,0 @@
\documentclass[letterpaper,10pt,oneside]{book}
\usepackage[T1]{fontenc}
%\usepackage[defaultmono]{droidmono}
\usepackage[scaled]{beramono}
\usepackage{fancyvrb}
\usepackage{geometry}
\usepackage{pdflscape}
%\usepackage{showframe} % Diagnostic
% Suppress headers and footers completely
\pagestyle{empty}
% portrait @ 66 lines per page
\geometry{top=0.0in, bottom=0.0in, left=1.0in, right=1.0in}
%\RecustomVerbatimCommand{\VerbatimInput}{VerbatimInput}%
%{
% commandchars=\\\{\}
%}
\begin{document}
% Part 1 (main document sections)
\VerbatimInput{part1.txt}
% landscape @ 51 lines per page
\newgeometry{top=1.0in, bottom=1.0in, left=0.0in, right=0.0in}
\begin{landscape}
% Part 2 (appendices A-G, source listings)
\VerbatimInput{part2.txt}
% restore portrait @ 66 lines per page
\end{landscape}
\restoregeometry
% Part 3 (appendices H-I, index)
\VerbatimInput{part3.txt}
\end{document}

35
Source/Doc/CPM 22 Manual/Main.ltx.bak

@ -1,35 +0,0 @@
\documentclass[letterpaper,10pt,oneside]{book}
\usepackage[defaultmono]{droidmono}
\usepackage{verbatim}
\usepackage{geometry}
\usepackage{pdflscape}
%\usepackage{showframe} % Diagnostic
% Suppress headers and footers completely
\pagestyle{empty}
% 66 lines per page, portrait
%\geometry{top=0.0in, bottom=0.0in, left=1.0in, right=0.5in}
\geometry{top=0.0in, bottom=0.0in, left=0.5in, right=0.5in}
\begin{document}
% Part 1 (main document sections)
\hspace{1pt} \verbatiminput{part1.txt}
% 51 lines per page, landscape
%\newgeometry{top=1.0in, bottom=0.5in, left=0.0in, right=0.0in}
\newgeometry{top=0.5in, bottom=0.5in, left=0.0in, right=0.0in}
\begin{landscape}
% Part 2 (appendices A-G, source listings)
\hspace{1pt} \verbatiminput{part2.txt}
% back to standard geometry
\end{landscape}
\restoregeometry
% Part 3 (appendices H-I, index)
\hspace{1pt} \verbatiminput{part3.txt}
\end{document}

14
Source/Doc/CPM 22 Manual/Strip.ps1

@ -1,14 +0,0 @@
function StripFile($Filename)
{
$Content = Get-Content "${Filename}.prn"
# $Content = $Content -replace "\0", ""
# $Content = $Content -replace "\e.", ""
$Content = $Content -replace "\x1A", ""
Set-Content "${Filename}.txt" $Content[0..($Content.count - 3)]
}
StripFile("part1")
StripFile("part2")
StripFile("part3")
return

716
Source/Doc/CPM 22 Manual/appa.tex

@ -1,716 +0,0 @@
.pl 51
.nf
.bp 1
.ft A-%
Appendix A
The Microcomputer Development System Basic Input/Output System (BIOS)
1 ; mds-800 i/o drivers for cp/m 2.2
2 ; (four drive single density version)
3 ;
4 ; version 2.2 february, 1980
5 ;
6 0016 = vers equ 22 ;version 2.2
7 ;
8 ; copyright (c) 1980
9 ; digital research
10 ; box 579, pacific grove
11 ; california, 93950
12 ;
13 ;
14 ffff = true equ 0fffh ;value of "true"
15 0000 = false equ not true ;"false"
16 0000 = test equ false ;true if test bios
17 ;
18 if test
19 bias equ 03400h ;base of ccp in test system
20 endif
21 if not test
22 0000 = bias equ 0000h ;generate relocatable cp/m system
23 endif
24 ;
25 1600 = patch equ 1600h
26 ;
27 1600 org patch
28 0000 = cpmb equ $-patch ;base of cpm console processor
29 0806 = bdos equ 806h+cpmb ;basic dos (resident portion)
30 1600 = cpml equ $-cpmb ;length (in bytes) of cpm system
31 002c = nsects equ cpml/128 ;number of sectors to load
32 0002 = offset equ 2 ;number of disk tracks used by cp/m
33 0004 = cdisk equ 0004h ;address of last logged disk on warm start
34 0080 = buff equ 0080h ;default buffer address
35 000a = retry equ 10 ;max retries on disk i/o before error
36 ;
37 ; perform following functions
38 ; boot cold start
39 ; wboot warm start (save i/o byte)
40 ; (boot and wboot are the same for mds)
41 ; const console status
42 ; reg-a = 00 if no character ready
43 ; reg-a = ff if character ready
44 ; conin console character in (result in reg-a)
45 ; conout console character out (char in reg-c)
46 ; list list out (char in reg-c)
47 ; punch punch out (char in reg-c)
48 ; reader paper tape reader in (result to reg-a)
49 ; home move to track 00
50 ;
51 ; (the following calls set-up the io parameter block for the
52 ; mds, which is used to perform subsequent reads and writes)
53 ; seldsk select disk given by reg-c (0, 1, 2...)
54 ; settrk set track address (0,...76) for subsequent read-write
55 ; setsec set sector address (1,...,26) for subsequent read-write
56 ; setdma set subsequent dma address (initially 80h)
57 ;
58 ; (read and write assume previous calls to set up the io parameters)
59 ; read read track/sector to preset dma address
60 ; write track/sector from preset dma address
61 ;
62 ; jump vector for individual routines
63 1600 c3b316 jmp boot
64 1603 c3c316 wboote: jmp wboot
65 1606 c36117 jmp const
66 1609 c36417 jmp conin
67 160c c36a17 jmp conout
68 160f c36d17 jmp list
69 1612 c37217 jmp punch
70 1615 c37517 jmp reader
71 1618 c37817 jmp home
72 161b c37d17 jmp seldsk
73 161e c3a717 jmp settrk
74 1621 c3ac17 jmp setsec
75 1624 c3bb17 jmp setdma
76 1627 c3c117 jmp read
77 162a c3ca17 jmp write
78 162d c37017 jmp listst ;list status
79 1630 c3b117 jmp sectran
80 ;
81 maclib diskdef ;load the disk definition library
82 disks 4 ;four disks
83 1633+= dpbase equ $ ;base of disk parameter blocks
84 1633+82160000 dpe0: dw xlt0, 0000h ;translate table
85 1637+00000000 dw 0000h, 0000h ;scratch area
86 163b+6e187316 dw dirbuf, dpb0 ;dir buff, parm block
87 163f+0d19ee18 dw csv0, alv0 ;check, alloc vectors
88 1643+82160000 dpe1: dw xlt1, 0000h ;translate table
89 1647+00000000 dw 0000h, 0000h ;scratch area
90 164b+6e187316 dw dirbuf, dpb1 ;dir buff, parm block
91 164f+3c191d19 dw csv1, alv1 ;check, alloc vectors
92 1653+82160000 dpe2: dw xlt2, 0000h ;translate table
93 1657+00000000 dw 0000h, 0000h ;scratch area
94 165b+6e187316 dw dirbuf, dpb2 ;dir buff, parm block
95 165f+6b194c19 dw csv2, alv2 ;check, alloc vectors
96 1663+82160000 dpe3: dw xlt3, 0000h ;translate table
97 1667+00000000 dw 0000h, 0000h ;scratch area
98 166b+6e187316 dw dirbuf, dpb3 ;check, alloc block
99 166f+9a197b19 dw csv3, alv3 ;dir buff, parm vectors
100 diskdef 0, 1, 26, 6, 1024, 243, 64, 64, offset
101 1673+= dpb0 equ $ ;disk parm block
102 1673+1a00 dw 26 ;sec per track
103 1675+03 db 3 ;block shift
104 1676+07 db 7 ;block mask
105 1677+00 db 0 ;extnt mask
106 1678+f200 dw 242 ;disk size-1
107 167a+3f00 dw 63 ;directory max
108 167c+c0 db 192 ;alloc0
109 167d+00 db 0 ;alloc1
110 167e+1000 dw 16 ;check size
111 1680+0200 dw 2 ;offset
112 1682+= xlt0 equ $ ;translate table
113 1682+01 db 1
114 1683+07 db 7
115 1684+0d db 13
116 1685+13 db 19
117 1686+19 db 25
118 1687+05 db 5
119 1688+0b db 11
120 1689+11 db 17
121 168a+17 db 23
122 168b+03 db 3
123 168c+09 db 9
124 168d+0f db 15
125 168e+15 db 21
126 168f+02 db 2
127 1690+08 db 8
128 1691+0e db 14
129 1692+14 db 20
130 1693+1a db 26
131 1694+06 db 6
132 1695+0c db 12
133 1696+12 db 18
134 1697+18 db 24
135 1698+04 db 4
136 1699+0a db 10
137 169a+10 db 16
138 169b+16 db 22
139 diskdef 1,0
140 1673+ = dpb1 equ dpb0 ;equivalent parameters
141 001f+ = als1 equ als0 ;same allocation vector size
142 0010+ = css1 equ css0 ;same checksum vector size
143 1682+ = xlt1 equ xlt0 ;same translate table
144 diskdef 2, 0
145 1673+ = dpb2 equ dpb0 ;equivalent parameters
146 001f+ = als2 equ als0 ;same allocation vector size
147 0010+ = css2 equ css0 ;same checksum vector size
148 1682+ = xlt2 equ xlt0 ;same translate table
149 diskdef 3, 0
150 1673+ = dpb3 equ dpb0 ;equivalent parameters
151 001f+ = als3 equ als0 ;same allocation vector size
152 0010+ = css3 equ css0 ;same checksum vector size
153 1682+ = xlt3 equ xlt0 ;same translate table
154 ; endef occurs at end of assembly
155 ;
156 ; end of controller--independent code, the remaining subroutines
157 ; are tailored to the particular operating environment, and must
158 ; be altered for any system which differs from the intel mds.
159 ;
160 ; the following code assumes the mds monitor exists at 0f800h
161 ; and uses the i/o subroutines within the monitor
162 ;
163 ; we also assume the mds system has four disk drives
164 00fd = revrt equ 0fdh ;interrupt revert port
165 00fc = intc equ 0fch ;interrupt mask port
166 00f3 = icon equ 0f3h ;interrupt control port
167 007E = inte equ 0111$1110b ;enable rst 0 (warm boot), rst 7 (monitor)
168 ;
169 ; mds monitor equates
170 f800 = mon80 equ 0f800h ;mds monitor
171 ff0f = rmon80 equ 0ff0fh ;restart mon80 (boot error)
172 f803 = ci equ 0f803h ;console character to reg-a
173 f806 = ri equ 0f806h ;reader in to reg-a
174 f809 = co equ 0f809h ;console char from c to console out
175 f80c = po equ 0f80ch ;punch char from c to punch device
176 f80f = lo equ 0f80fh ;list from c to list device
177 f812 = csts equ 0f812h ;console status 00/ff to register a
178 ;
179 ; disk ports and commands
180 0078 = base equ 78h ;base of disk command io ports
181 0078 = dstat equ base ;disk status (input)
182 0079 = rtype equ base+1 ;result type (input)
183 007b = rbyte equ base+3 ;result byte (input)
184 ;
185 0079 = ilow equ base+1 ;iopb low address (output)
186 007a = ihigh equ base+2 ;iopb high address (output)
187 ;
188 0004 = readf equ 4h ;read function
189 0006 = writf equ 6h ;write function
190 0003 = recal equ 3h ;recalibrate drive
191 0004 = iordy equ 4h ;i/o finished mask
192 000d = cr equ 0dh ;carriage return
193 000a = lf equ 0ah ;line-feed
194 ;
195 signon: ;signon message: xxk cp/m vers y.y
196 169c 0d0a0a db cr, lf, lf
197 if test
198 db '32' ;32k example bios
199 endif
200 if not test
201 169f 3030 db '00' ;memory size filled by relocator
202 endif
203 16a1 6b2043502f db 'k cp/m vers '
204 16ad 322e32 db ver/10+'0', ',' vers mod 10+'0'
205 16b0 0d0a00 db cr, lf, 0
206 ;
207 boot: ;print signon message and go to ccp
208 ; (note: mds boot initialized iobyte at 0003h)
209 16b3 310001 lxi sp, buff+80h
210 16b6 219c16 lxi h, signon
211 16b9 cdd317 call prmsg ;print message
212 16bc af xra a ;clear accumulator
213 16bd 320400 sta cdisk ;set initially to disk a
214 16c0 c30f17 jmp gocpm ;go to cp/m
215 ;
216 ;
217 wboot:; loader on track 0, sector 1, which will be skipped for warm
218 ; read cp/m from disk--assuming there is a 128 byte cold start
219 ; start
220 ;
221 16c3 318000 lxi sp, buff ;using dma--thus 80 thru ff available for stack
222 ;
223 16c6 0e0a mvi c, retry ;max retries
224 16c8 c5 push b
225 wboot0: ;enter here on error retries
226 16c9 010000 lxi b, cpmb ;set dma address to start of disk system
227 16cc cdbb17 call setdma
228 16cf 0e00 mvi c, 0 ;boot from drive 0
229 16d1 cd7d17 call seldsk
230 16d4 0e00 mvi c, 0
231 16d6 cda717 call settrk ;start with track 0
232 16d9 0e02 mvi c, 2 ;start reading sector 2
233 16db cdac17 call setsec
234 ;
235 ; read sectors, count nsects to zero
236 16de c1 pop b ;10-error count
237 16df 062c mvi b, nsects
238 rdsec: ;read next sector
239 16e1 c5 push b ;save sector count
240 16e2 cdc117 call read
241 16e5 c24917 jnz booterr ;retry if errors occur
242 16e8 2a6c18 lhld iod ;increment dma address
243 16eb 118000 lxi d, 128 ;sector size
244 16ee 19 dad d ;incremented dma address in hl
245 16ef 44 mov b, h
246 16f0 4d mov c, l ;ready for call to set dma
247 16f1 cdbb17 call setdma
248 16f4 3a6b18 lda ios ;sector number just read
249 16f7 fe1a cpi 26 ;read last sector?
250 16f9 da0517 jc rd1
251 ; must be sector 26, zero and go to next track
252 16fc 3a6a18 lda iot ;get track to register a
253 16ff 3c inr a
254 1700 4f mov c, a ;read for call
255 1701 cda717 call settrk
256 1704 af xra a ;clear sector number
257 1705 3c rd1: inr a ;to next sector
258 1706 4f mov c, a ;ready for call
259 1707 cdac17 call setsec
260 170a c1 pop b ;recall sector count
261 170b 05 dcr b ;done?
262 170c c2e116 jnz rdsec
263 ;
264 ; done with the load, reset default buffer address
265 gocpm: ;(enter here from cold start boot)
266 ; enable rst0 and rst7
267 170f f3 di
268 1710 3e12 mvi a, 12h ;initialize command
269 1712 d3fd out revrt
270 1714 af xra a
271 1715 d3fc out intc ;cleared
272 1717 3e7e mvi a, inte ;rst0 and rst7 bits on
273 1719 d3fc out intc
274 171b af xra a
275 171c d3f3 out icon ;interrupt control
276 ;
277 ; set default buffer address to 80h
278 171e 018000 lxi b, buff
279 1721 cdbb17 call setdma
280 ;
281 ; reset monitor entry points
282 1724 3ec3 mvi a, jmp
283 1726 320000 sta 0
284 1729 210316 lxi h, wboote
285 172c 220100 shld 1 ;jump wboot at location 00
286 172f 320500 sta 5
287 1732 210608 lxi h, bdos
288 1735 220600 shld 6 ;jmp bdos at location 5
289 if not test
290 1738 323800 sta 7*8 ;jmp to mon80 (may have changed by ddt)
291 173b 2100f8 lxi h, mon80
292 173e 223900 shld 7*8+1
293 endif
294 ; leave iobyte set
295 ; previously selected disk was b, send parameter to cpm
296 1741 3a0400 lda cdisk ;last logged disk number
297 1744 4f mov c, a ;send to ccp to log it in
298 1745 fb ei
299 1746 c30000 jmp cpmb
300 ;
301 ; error condition occurred, print message and retry
302 booterr:
303 1749 c1 pop b ;recall counts
304 174a 0d dcr c
305 174b ca5217 jz booter0
306 ; try again
307 174e c5 push b
308 174f c3c916 jmp wboot0
309 ;
310 booter0:
311 ; otherwise too many retries
312 1752 215b17 lxi h, bootmsg
313 1755 cdd317 call prmsg
314 1758 c30fff jmp rmon80 ;mds hardware monitor
315 ;
316 bootmsg:
317 175b 3f626f6f74 db '?boot', 0
318 ;
319 ;
320 const: console status to reg-a
321 ; (exactly the same as mds call)
322 1761 c312f8 jmp csts
323 ;
324 conin: ;console character to reg-a
325 1764 cd03f8 call ci
326 1767 e67f ani 7fh ;remove parity bit
327 1769 c9 ret
328 ;
329 conout: ;console character from c to console out
330 176a c309f8 jmp co
331 ;
332 list: ;list device out
333 ; (exactly the same as mds call)
334 176d c30ff8 jmp lo
335 ;
336 listst:
337 ;return list status
338 1770 af xra a
339 1771 c9 ret ;always not ready
340 ;
341 punch: ;punch device out
342 ; (exactly the same as mds call)
343 1772 c30cf8 jmp po
344 ;
345 reader: ;reader character in to reg-a
346 ; (exactly the same as mds call)
347 1775 c306f8 jmp ri
348 ;
349 home: ;move to home position
350 ; treat as track 00 seek
351 1778 0e00 mvi c, 0
352 177a c3a717 jmp settrk
353 ;
354 seldsk: ;select disk given by register c
355 177d 210000 lxi h, 0000h ;return 0000 if error
356 1780 79 mov a, c
357 1781 fe04 cpi ndisks ;too large?
358 1783 d0 rnc ;leave hl = 0000
359 ;
360 1784 e602 ani 10b ;00 00 for drive 0, 1 and 10 10 for drive 2, 3
361 1786 326618 sta dbank ;to select drive bank
362 1789 79 mov a, c ;00, 01, 10, 11
363 178a e601 ani 1b ;mds has 0, 1 at 78, 2, 3 at 88
364 178c b7 ora a ;result 00?
365 178d ca9217 jz setdrive
366 1790 3e30 mvi a, 00110000b ;selects drive 1 in bank
367 setdrive:
368 1792 47 mov b, a ;save the function
369 1793 216818 lxi h, iof ;io function
370 1796 7e mov a, m
371 1797 e6cf ani 11001111b ;mask out disk number
372 1799 b0 ora b ;mask in new disk number
373 179a 77 mov m, a ;save it in iopb
374 179b 69 mov l, c
375 179c 2600 mvi h, 0 ;hl=disk number
376 179e 29 dad h ;*2
377 179f 29 dad h ;*4
378 17a0 29 dad h ;*8
379 17a1 29 dad h ;*16
380 17a2 113316 lxi d, dpbase
381 17a5 19 dad d ;hl=disk header table address
382 17a6 c9 ret
383 ;
384 ;
385 settrk: ;set track address given by c
386 17a7 216a18 lxi h, iot
387 17aa 71 mov m, c
388 17ab c9 ret
389 ;
390 setsec: ;set sector number given by c
391 17ac 216b18 lxi h, ios
392 17af 71 mov m, c
393 17b0 c9 ret
394 sectran:
395 ;translate sector bc using table at de
396 17b1 0600 mvi b, 0 ;double-precision sector number in bc
397 17b3 eb xchg ;translate table address to hl
398 17b4 09 dad b ;translate (sector) address
399 17b5 7e mov a, m ;translated sector number to a
400 17b6 326b18 sta ios
401 17b9 6f mov l, a ;return sector number in l
402 17ba c9 ret
403 ;
404 setdma: ;set dma address given by regs b, c
405 17bb 69 mov l, c
406 17bc 60 mov h, b
407 17bd 226c18 shld iod
408 17c0 c9 ret
409 ;
410 read: ;read next disk record (assuming disk/trk/sec/dma set)
411 17c1 0e04 mvi c, readf ;set to read function
412 17c3 cde017 call setfunc
413 17c6 cdf017 call waitio ;perform read function
414 17c9 c9 ret ;may have error set in reg-a
415 ;
416 ;
417 write: ;disk write function
418 17ca 0e06 mvi c, writf
419 17cc cde017 call setfunc ;set to write function
420 17cf cdf017 call waitio
421 17d2 c9 ret ;may have error set
422 ;
423 ;
424 ; utility subroutines
425 prmsg: ;print message at h, l to 0
426 17d3 7e mov a, m
427 17d4 b7 ora a zero?
428 17d5 c8 rz
429 ; more to print
430 17d6 e5 push h
431 17d7 4f mov c,a
432 17d8 cd6a17 call conout
433 17db e1 pop h
434 17dc 23 inx h
435 17dd c3d317 jmp prmsg
436 ;
437 setfunc:
438 ; set function for next i/o (command in reg-c)
439 17e0 216818 lxi h, iof ;io function address
440 17e3 7e mov a, m ;get it to accumulator for masking
441 17e4 e6f8 ani 11111000b ;remove previous command
442 17e6 b1 ora c ;set to new command
443 17e7 77 mov m, a ;replaced in iopb
444 ; the mds-800 controller requires disk bank bit in sector byte
445 ; mask the bit from the current i/o function
446 17e8 e620 ani 00100000b ;mask the disk select bit
447 17ea 216b18 lxi h, ios ;address the sector select byte
448 17ed b6 ora m ;select proper disk bank
449 17ee 77 mov m, a ;set disk select bit on/off
450 17ef c9 ret
451 ;
452 waitio:
453 17f0 0e0a mvi c, retry ;max retries before perm error
454 rewait:
455 ; start the i/o function and wait for completion
456 17f2 cd3f18 call intype ;in rtype
457 17f5 cd4c18 call inbyte ;clears the controller
458 ;
459 17f8 3a6618 lda dbank ;set bank flags
460 17fb b7 ora a ;zero if drive 0, 1 and nz if 2, 3
461 17fc 3e67 mvi a, iopb and offh ;low address for iopb
462 17fe 0618 mvi b, iopb shr 8 ;high address for iopb
463 1800 c20b18 jnz iodr1 ;drive bank 1?
464 1803 d379 out ilow ;low address to controller
465 1805 78 mov a, b
466 1806 d37a out ihigh ;high address
467 1808 c31018 jmp waito ;to wait for complete
468 ;
469 iodr1: ;drive bank 1
470 180b d389 out ilow+10h ;88 for drive bank 10
471 180d 78 mov a, b
472 180e d38a out ihigh+10h
473 ;
474 1810 cd5918 waito: call instat ;wait for completion
475 1813 e604 ani iordy ;ready?
476 1815 ca1018 jz waito
477 ;
478 ; check io completion ok
479 1818 cd3f18 call intype ;must be io complete (00) unlinked
480 ; 00 unlinked i/o complete, 01 linked i/o complete (not used)
481 ; io disk status changed 11 (not used)
482 181b fe02 cpi 10b ;ready status change?
483 181d ca3218 jz wready
484 ;
485 ; must be 00 in the accumulator
486 1820 b7 ora a
487 1821 c23818 jnz werror ;some other condition, retry
488 ;
489 ; check i/o error bits
490 1824 cd4c18 call inbyte
491 1827 17 ral
492 1828 da3218 jc wready ;unit not ready
493 182b 1f rar
494 182c e6fe ani 11111110b ;any other errors? (deleted data ok)
495 182e c23818 jnz werror
496 ;
497 ; read or write is ok, accumulator contains zero
498 1831 c9 ret
499 ;
500 wready: ;not ready, treat as error for now
501 1832 cd4c18 call inbyte ;clear result byte
502 1835 c33818 jmp trycount
503 ;
504 werror: ;return hardware malfunction (crc, track, seek, etc.)
505 ; the mds controller has returned a bit in each position
506 ; of the accumulator, corresponding to the conditions:
507 ; 0 -deleted data (accepted as ok above)
508 ; 1 -crc error
509 ; 2 -seek error
510 ; 3 -address error (hardware malfunction)
511 ; 4 -data over/under flow (hardware malfunction)
512 ; 5 -write protect (treated as not ready)
513 ; 6 -write error (hardware malfunction)
514 ; j -not ready
515 ; (accumulator bits are numbered 7 6 5 4 3 2 1 0)
516 ;
517 ; it may be useful to filter out the various conditions,
518 ; but we will get a permanent error message if it is not
519 ; recoverable. in any case, the not ready condition is
520 ; treated as a separated condition for later improvement
521 trycount:
522 ; register c contains retry count, decrement 'til zero
523 1838 0d dcr c
524 1839 c2f217 jnz rewait ;for another try
525 ;
526 ; cannot recover from error
527 183c 3e01 mvi a, 1 ;error code
528 183e c9 ret
529 ;
530 ; intype, inbyte, instat read drive bank 00 or 10
531 183f 3a6618 intype: lda dbank
532 1842 b7 ora a
533 1843 c24918 jnz intyp1 ;skip to bank 10
534 1846 db79 in rtype
535 1848 c9 ret
536 1849 db89 intyp1: in rtype+10h ;78 for 0, 1 88 for 2, 3
537 184b c9 ret
538 ;
539 184c 3a6618 inbyte: lda dbank
540 184f b7 ora a
541 1850 c25618 jnz inbyt1
542 1853 db7b in rbyte
543 1855 c9 ret
544 1856 db8b inbyt1: in rbyte+10h
545 1858 c9 ret
546 ;
547 1859 3a6618 instat: lda dbank
548 185c b7 ora a
549 185d c26318 jnz insta1
550 1860 db78 in dstat
551 1862 c9 ret
552 1863 db88 insta1: in dstat+10h
553 1865 c9 ret
554 ;
555 ;
556 ;
557 ; data areas (must be in ram)
558 1866 00 dbank: db 0 ;disk bank 00 if drive 0, 1
559 ; 10 if drive 2, 3
560 iopb: ;io parameter block
561 1867 80 db 80h ;normal i/o operation
562 1868 04 iof: db readf ;io function, initial read
563 1869 01 ion: db 1 ;number of sectors to read
564 186a 02 iot: db offset ;track number
565 186b 01 ios: db 1 ;sector number
566 186c 8000 iod: dw buff ;io address
567 ;
568 ;
569 ; define ram areas for bdos operation
570 endef
571 186e+= begdat equ $
572 186e+ dirbuf: ds 128 ;directory access buffer
573 18ee+ alv0: ds 31
574 190d+ csv0: ds 16
575 191d+ alv1: ds 31
576 193c+ csv1: ds 16
577 194c+ alv2: ds 31
578 196b+ csv2: ds 16
579 197b+ alv3: ds 31
580 199a+ csv3: ds 16
581 19aa+= enddat equ $
582 013c+= datsiz equ $-begdat
583 19aa end
als1 001f 141#
als2 001f 146#
als3 001f 151#
alv0 18ee 87 573#
alv1 191d 91 575#
alv2 194c 95 577#
alv3 197b 99 579#
base 0078 180# 181 182 183 185 186
bdos 0806 29# 287
begdat 186e 571# 582
bias 0000 19# 22#
boot 16b3 63 207#
booter0 1752 305 310#
booterr 1749 241 302#
bootmsg 175b 312 316#
buff 0080 34# 209 221 278 566
cdisk 0004 33# 213 296
ci f803 172# 325
co f809 174# 330
conin 1764 66 324#
conout 176a 67 329# 432
const 1761 65 320#
cpmb 0000 28# 29 30 226 299
cpml 1600 30# 31
cr 000d 192# 196 205
css1 0010 142#
css2 0010 147#
css3 0010 152#
csts f812 177# 322
csv0 190d 87 574#
csv1 193c 91 576#
csv2 196b 95 578#
csv3 199a 99 580#
datsiz 013c 582#
dbank 1866 361 459 531 539 539 547 558#
dirbuf 186e 86 90 94 98 572#
dpb0 1673 86 101# 140 145 150
dpb1 1673 90 140#
dpb2 1673 94 145#
dpb3 1673 98 150#
dpbase 1633 83# 380
dpe0 1633 84#
dpe1 1643 88#
dpe2 1653 92#
dpe3 1663 96#
dstat 0078 181# 550 552
enddat 19aa 581#
false 0000 15# 16
gocpm 170f 214 265#
home 1778 71 349#
icon 00fe 166# 275
ihigh 007a 186# 466 472
ilow 0079 185# 464 470
inbyt1 1856 541 544#
inbyte 184c 457 490 501 539#
insta1 1863 549 552#
instat 1859 474 547#
intc 00fc 165# 271 273
inte 007e 167# 272
intyp1 1849 533 536#
intype 183f 456 479 531#
iod 186c 242 407 566#
iodr1 180b 463 469#
iof 1868 369 439 562#
ion 1869 563#
iopb 1867 461 462 560#
iordy 0004 191# 475
ios 186b 248 391 400 447 565#
iot 186a 252 386 564#
lf 000a 193# 196 196 205
list 176d 68 332#
listst 1770 78 336#
lo f80f 176# 334
mon80 f800 170# 291
nsects 002c 31# 237
offset 0002 32# 100 564
patch 1600 25# 27 28
po f80c 175# 343
prmsg 17d3 211 313 425# 435
punch 1772 69 341#
rbyte 007b 183# 542 544
rd1 1705 250 257#
rdsec 16e1 238# 262
read 17c1 76 240 410#
reader 1775 70 345#
readf 0004 188# 411 562
recal 0003 190#
retry 000a 35# 223 453
revrt 00fd 164# 269
rewait 17f2 454# 524
ri f806 173# 347
rmon80 ff0f 171# 314
rtype 0079 182# 534 536
sectran 17b1 79 394#
seldsk 177d 72 229 354#
setdma 17bb 75 227 247 279 404#
setdrive 1792 365 367#
setfunc 17e0 412 419 437#
setsec 17ac 74 233 259 390#
settrk 17a7 73 231 255 352 385#
signon 169c 195# 210
test 0000 16# 18 21 197 200 289
true ffff 14# 15
trycount 1838 502 521#
vers 0016 6# 204 204
waito 1810 467 474# 476
waitio 17f0 413 420 452#
wboot 16c3 64 217#
wboot0 16c9 225# 308
wboote 1603 64# 284
werror 1838 487 495 504#
wready 1832 483 492 500#
write 17ca 77 417#
writf 0006 189# 418
xlt0 1682 84 112# 143 148 153
xlt1 1682 88 143#
xlt2 1682 92 148#
xlt3 1682 96 153#
.nx appb


371
Source/Doc/CPM 22 Manual/appb.tex

@ -1,371 +0,0 @@
.pl 51
.nf
.bp 1
.ft B-%
Appendix B
A Skeletal CBIOS
1 ; skeletal cbios for first level of cp/m 2.0 alteration
2 ;
3 0014 = msize equ 20 ;cp/m version memory size in kilobytes
4 ;
5 ; "bias" is address offset from 3400h for memory systems
6 ; than 16k (referred to as "b" throughout the text)
7 ;
8 0000 = bias equ (msize-20)*1024
9 3400 = ccp equ 3400h+bias ;base of ccp
10 3c06 = bdos equ ccp+806h ;base of bdos
11 4a00 = bios equ ccp+1600h ;base of bios
12 0004 = cdisk equ 0004h ;current disk number 0=a,..., 15=p
13 0003 = iobyte equ 0003h ;intel i/o byte
14 ;
15 4a00 org bios ;origin of this program
16 002c = nsects equ ($-ccp)/128 ;warm start sector count
17 ;
18 ; jump vector for individual subroutines
19 4a00 c39c4a jmp boot ;cold start
20 4a03 c3a64a wboote: jmp wboot ;warm start
21 4a06 c3114b jmp const ;console status
22 4a09 c3244b jmp conin ;console character in
23 4a0c c3374b jmp conout ;console character out
24 4a0f c3494b jmp list ;list character out
25 4a12 c34d4b jmp punch ;punch character out
26 4a15 c34f4b jmp reader ;reader character out
27 4a18 c3544b jmp home ;move head to home position
28 4a1b c35a4b jmp seldsk ;select disk
29 4a1e c37d4b jmp settrk ;set track number
30 4a21 c3924b jmp setsec ;set sector number
31 4a24 c3ad4b jmp setdma ;set dma address
32 4a27 c3c34b jmp read ;read disk
33 4a2a c3d64b jmp write ;write disk
34 4a2d c34b4b jmp listst ;return list status
35 4a30 c3a74b jmp sectran ;sector translate
36 ;
37 ; fixed data tables for four-drive standard
38 ; ibm-compatible 8" disks
39 ; disk parameter header for disk 00
40 4a33 734a0000 dpbase: dw trans, 0000h
41 4a37 00000000 dw 0000h, 0000h
42 4a3b f04c8d4a dw dirbf, dpblk
43 4a3f ec4d704d dw chk00, all00
44 ; disk parameter header for disk 01
45 4a43 734a0000 dw trans, 0000h
46 4a47 00000000 dw 0000h, 0000h
47 4a4b f04c8d4a dw dirbf, dpblk
48 4a4f fc4d8f4d dw chk01, all01
49 ; disk parameter header for disk 02
50 4a53 734a0000 dw trans, 0000h
51 4a57 00000000 dw 0000h, 0000h
52 4a5b f04c8d4a dw dirbf, dpblk
53 4a5f 0c4eae4d dw chk02, all02
54 ; disk parameter header for disk 03
55 4a63 734a0000 dw trans, 0000h
56 4a67 00000000 dw 0000h, 0000h
57 4a6b f04c8d4a dw dirbf, dpblk
58 4a6f 1c4ecd4d dw chk03, all03
59 ;
60 ; sector translate vector
61 4a73 01070d13 trans: db 1, 7, 13, 19 ;sectors 1, 2, 3, 4
62 4a77 19050b11 db 25, 5, 11, 17 ;sectors 5, 6, 7, 8
63 4a7b 1703090f db 23, 3, 9, 15 ;sectors 9, 10, 11, 12
64 4a7f 1502080e db 21, 2, 8, 14 ;sectors 13, 14, 15, 16
65 4a83 141a060c db 20, 26, 6, 12 ;sectors 17, 18, 19, 20
66 4a87 1218040a db 18, 24, 4, 10 ;sectors 21, 22, 23, 24
67 4a8b 1016 db 16, 22 ;sectors 25, 26
68 ;
69 dpblk: ;disk parameter block, common to all disks
70 4a8d 1a00 dw 26 ;sectors per track
71 4a8f 03 db 3 ;block shift factor
72 4a90 07 db 7 ;block mask
73 4a91 00 db 0 ;null mask
74 4a92 f200 dw 242 ;disk size-1
75 4a94 3f00 dw 63 ;directory max
76 4a96 c0 db 192 ;alloc 0
77 4a97 00 db 0 ;alloc 1
78 4a98 1000 dw 16 ;check size
79 4a9a 0200 dw 2 ;track offset
80 ;
81 ; end of fixed tables
82 ;
83 ; individual subroutines to perform each function
84 boot: ;simplest case is to just perform parameter initialization
85 4a9c af xra a ;zero in the accum
86 4a9d 320300 sta iobyte ;clear the iobyte
87 4aa0 320400 sta cdisk ;select disk zero
88 4aa3 c3ef4a jmp gocpm ;initialize and go to cp/m
89 ;
90 wboot: ;simplest case is to read the disk until all sectors loaded
91 4aa6 318000 lxi sp, 80h ;use space below buffer for stack
92 4aa9 0e00 mvi c, 0 ;select disk 0
93 4aab cd5a4b call seldsk
94 4aae cd544b call home ;go to track 00
95 ;
96 4ab1 062c mvi b, nsects ;b counts # of sectors to load
97 4ab3 0e00 mvi c, 0 ;c has the current track number
98 4ab5 1602 mvi d, 2 ;d has the next sector to read
99 ; note that we begin by reading track 0, sector 2 since sector 1
100 ; contains the cold start loader, which is skipped in a warm start
101 4ab7 210034 lxi h, ccp ;base of cp/m (initial load point)
102 load1: ;load one more sector
103 4aba c5 push b ;save sector count, current track
104 4abb d5 push d ;save next sector to read
105 4abc e5 push h ;save dma address
106 4abd 4a mov c, d ;get sector address to register c
107 4abe cd924b call setsec ;set sector address from register c
108 4ac1 c1 pop b ;recall dma address to b, c
109 4ac2 c5 push b ;replace on stack for later recall
110 4ac3 cdad4b call setdma ;set dma address from b, c
111 ;
112 ; drive set to 0, track set, sector set, dma address set
113 4ac6 cdc34b call read
114 4ac9 fe00 cpi 00h ;any errors?
115 4acb c2a64a jnz wboot ;retry the entire boot if an error occurs
116 ;
117 ; no error, move to next sector
118 4ace e1 pop h ;recall dma address
119 4acf 118000 lxi d, 128 ;dma=dma+128
120 4ad2 19 dad d ;new dma address is in h, l
121 4ad3 d1 pop d ;recall sector address
122 4ad4 c1 pop b ;recall number of sectors remaining, and current trk
123 4ad5 05 dcr b ;sectors=sectors-1
124 4ad6 caef4a jz gocpm ;transfer to cp/m if all have been loaded
125 ;
126 ; more sectors remain to load, check for track change
127 4ad9 14 inr d
128 4ada 7a mov a,d ;sector=27?, if so, change tracks
129 4adb fe1b cpi 27
130 4add daba4a jc load1 ;carry generated if sector<27
131 ;
132 ; end of current track, go to next track
133 4ae0 1601 mvi d, 1 ;begin with first sector of next track
134 4ae2 0c inr c ;track=track+1
135 ;
136 ; save register state, and change tracks
137 4ae3 c5 push b
138 4ae4 d5 push d
139 4ae5 e5 push h
140 4ae6 cd7d4b call settrk ;track address set from register c
141 4ae9 e1 pop h
142 4aea d1 pop d
143 4aeb c1 pop b
144 4aec c3ba4a jmp load1 ;for another sector
145 ;
146 ; end of load operation, set parameters and go to cp/m
147 gocpm:
148 4aef 3ec3 mvi a, 0c3h ;c3 is a jmp instruction
149 4af1 320000 sta 0 ;for jmp to wboot
150 4af4 21034a lxi h, wboote ;wboot entry point
151 4af7 220100 shld 1 ;set address field for jmp at 0
152 ;
153 4afa 320500 sta 5 ;for jmp to bdos
154 4afd 21063c lxi h, bdos ;bdos entry point
155 4b00 220600 shld 6 ;address field of jump at 5 to bdos
156 ;
157 4b03 018000 lxi b, 80h ;default dma address is 80h
158 4b06 cdad4b call setdma
159 ;
160 4b09 fb ei ;enable the interrupt system
161 4b0a 3a0400 lda cdisk ;get current disk number
162 4b0d 4f mov c, a ;send to the ccp
163 4b0e c30034 jmp ccp ;go to cp/m for further processing
164 ;
165 ;
166 ; simple i/o handlers (must be filled in by user)
167 ; in each case, the entry point is provided, with space reserved
168 ; to insert your own code
169 ;
170 const: ;console status, return 0ffh if character ready, 00h if not
171 4b11 ds 10h ;space for status subroutine
172 4b21 3e00 mvi a, 00h
173 4b23 c9 ret
174 ;
175 conin: ;console character into register a
176 4b24 ds 10h ;space for input routine
177 4b34 e67f ani 7fh ;strip parity bit
178 4b36 c9 ret
179 ;
180 conout: ;console character output from register c
181 4b37 79 mov a, c ;get to accumulator
182 4b38 ds 10h ;space for output routine
183 4b48 c9 ret
184 ;
185 list: ;list character from register c
186 4b49 79 mov a, c ;character to register a
187 4b4a c9 ret ;null subroutine
188 ;
189 listst: ;return list status (0 if not ready, 1 if ready)
190 4b4b af xra a ;0 is always ok to return
191 4b4c c9 ret
192 ;
193 punch: ;punch character from register c
194 4b4d 79 mov a, c ;character to register a
195 4b4e c9 ret ;null subroutine
196 ;
197 ;
198 reader: ;reader character into register a from reader device
199 4b4f 3e1a mvi a, 1ah ;enter end of file for now (replace later)
200 4b51 e67f ani 7fh ;remember to strip parity bit
201 4b53 c9 ret
202 ;
203 ;
204 ; i/o drivers for the disk follow
205 ; for now, we will simply store the parameters away for use
206 ; in the read and write subroutines
207 ;
208 home: ;move to the track 00 position of current drive
209 ; translate this call into a settrk call with parameter 00
210 4b54 0e00 mvi c, 0 ;select track 0
211 4b56 cd7d4b call settrk
212 4b59 c9 ret ;we will move to 00 on first read/write
213 ;
214 seldsk: ;select disk given by register c
215 4b51 210000 lxi h, 0000h ;error return code
216 4b5d 79 mov a, c
217 4b5e 32ef4c sta diskno
218 4b61 fe04 cpi 4 ;must be between 0 and 3
219 4b63 d0 rnc ;no carry if 4, 5,...
220 ; disk number is in the proper range
221 4b64 ds 10 ;space for disk select
222 ; compute proper disk parameter header address
223 4b6e 3aef4c lda diskno
224 4b71 6f mov l, a ;l=disk number 0, 1, 2, 3
225 4b72 2600 mvi h, 0 ;high order zero
226 4b74 29 dad h ;*2
227 4b75 29 dad h ;*4
228 4b76 29 dad h ;*8
229 4b77 29 dad h ;*16 (size of each header)
230 4b78 11334a lxi d, dpbase
231 4b7b 19 dad 0 ;hl=.dpbase (diskno*16)
232 4b7c c9 ret
233 ;
234 settrk: ;set track given by register c
235 4b7d 79 mov a, c
236 4b7e 32e94c sta track
237 4b81 ds 10h ;space for track select
238 4b91 c9 ret
239 ;
240 setsec: ;set sector given by register c
241 4b92 79 mov a, c
242 4b93 32eb4c sta sector
243 4b96 ds 10h ;space for sector select
244 4ba6 c9 ret
245 ;
246 sectran:
247 ;translate the sector given by bc using the
248 ;translate table given by de
249 4ba7 eb xchg ;hl=.trans
250 4ba8 09 dad b ;hl=.trans (sector)
251 4ba9 6e mov l, m ;l=trans (sector)
252 4baa 2600 mvi h, 0 ;hl=trans (sector)
253 4bac c9 ret ;with value in hl
254 ;
255 setdma: ;set dma address given by registers b and c
256 4bad 69 mov l, c ;low order address
257 4bae 60 mov h, b ;high order address
258 4baf 22ed4c shld dmaad ;save the address
259 4bb2 ds 10h ;space for setting the dma address
260 4bc2 c9 ret
261 ;
262 read: ;perform read operation (usually this is similar to write
263 ; so we will allow space to set up read command, then use
264 ; common code in write)
265 4bc3 ds 10h ;set up read command
266 4bd3 c3e64b jmp waitio ;to perform the actual i/o
267 ;
268 write: ;perform a write operation
269 4bd6 ds 10h ;set up write command
270 ;
271 waitio: ;enter here from read and write to perform the actual i/o
272 ; operation. return a 00h in register a if the operation completes
273 ; properly, and 01h if an error occurs during the read or write
274 ;
275 ; in this case, we have saved the disk number in 'diskno' (0, 1)
276 ; the track number in 'track' (0-76)
277 ; the sector number in 'sector' (1-26)
278 ; the dma address in 'dmaad' (0-65535)
279 4be6 ds 256 ;space reserved for i/o drivers
280 4ce6 3e01 mvi a, 1 ;error condition
281 4ce8 c9 ret ;replaced when filled-in
282 ;
283 ; the remainder of the cbios is reserved uninitialized
284 ; data area, and does not need to be a part of the
285 ; system memory image (the space must be available,
286 ; however, between "begdat" and "enddat").
287 ;
288 4ce9 track: ds 2 ;two bytes for expansion
289 4ceb sector: ds 2 ;two bytes for expansion
290 4ced dmaad: ds 2 ;direct memory address
291 4cef diskno: ds 1 ;disk number 0-15
292 ;
293 ; scratch ram area for bdos use
294 4cf0= begdat equ $ ;beginning of data area
295 4cf0 dirfb: ds 128 ;scratch directory area
296 4d70 all00: ds 31 ;allocation vector 0
297 4d8f all01: ds 31 ;allocation vector 1
298 4dae all02: ds 31 ;allocation vector 2
299 4dcd all03: ds 31 ;allocation vector 3
300 4dec chk00: ds 16 ;check vector 0
301 4dfc chk01: ds 16 ;check vector 1
302 4e0c chk02: ds 16 ;check vector 2
303 4e1c chk03: ds 16 ;check vector 3
304 ;
305 4e2c enddat equ $ ;end of data area
306 013c= datsiz equ $-begdat; ;size of data area
307 4e2c end
all00 4d70 43 296#
all01 4d8f 48 297#
all02 4dae 53 298#
all03 4dcd 58 299#
bdos 3c06 10# 154
begdat 4cf0 294# 306
bias 0000 8# 9
bios 4a00 11# 15
boot 4a9c 19 84#
ccp 3400 9# 10 11 16 101 163
cdisk 0004 12# 87 161
chk00 4dec 43 300#
chk01 4dfc 48 301#
chk02 4e0c 53 302#
chk03 4e1c 58 303#
conin 4b24 22 175#
conout 4b37 23 180#
const 4b11 21 170#
datsiz 013c 306#
dirbf 4cf0 42 47 52 57 295#
diskno 4cef 217 223 291#
dmaad 4ced 258 290#
dpbase 4a33 40# 230
dpblk 4a8d 42 47 52 57 69#
enddat 4e2c 305#
gocpm 4aef 88 124 147#
home 4b54 27 94 208#
iobyte 0003 13# 86
list 4b49 24 185#
listst 4b4b 34 189#
load1 4aba 102# 130 144
msize 0014 3# 8
nsects 002c 16# 96
punch 4b4d 25 193#
read 4bc3 32 113 262#
reader 4b4f 26 198#
sector 4ceb 242 289#
sectran 4ba7 35 246#
seldsk 4b5a 28 93 214#
setdma 4bad 31 110 158 255#
setsec 4b92 30 107 240#
settrk 4b7d 29 140 211 234#
track 4ce9 236 288#
trans 4a73 40 45 50 55 61#
waitio 4be6 266 271#
wboot 4aa6 20 90# 115
wboote 4a03 20# 150
write 4bd6 33 268#
.nx appc


143
Source/Doc/CPM 22 Manual/appc.tex

@ -1,143 +0,0 @@
.pl 51
.nf
.bp 1
.ft C-%
Appendix C
A Skeletal GETSYS/PUTSYS Program
; combined getsys and putsys programs from
; Sec 6.4
; Start the programs at the base of the TPA
0100 org 0100h
0014 = msize equ 20 ;size of cp/m in Kbytes
;"bias" is the amount to add to addresses for > 20k
; (referred to as "b" throughout the text)
0000 = bias equ (msize-20)*1024
3400 = ccp equ 3400h+bias
3c00 = bdos equ ccp+0800h
4a00 = bios equ ccp+1600h
; getsys programs tracks 0 and 1 to memory at
; 3880h + bias
; register usage
; a (scratch register)
; b track count (0...76)
; c sector count (1...26)
; d,e (scratch register pair)
; h,l load address
; sp set to track address
gstart: ;start of getsys
0100 318033 lxi sp,ccp-0080h ;convenient place
0103 218033 lxi h,ccp-0080h ;set initial load
0106 0600 mvi b 0 ;start with track
rd$trk: ;read next track
0108 0e01 mvi c,1 ;each track start
rd$sec:
010a cd0003 call read$sec ;get the next sector
010d 118000 lxi d,128 ;offset by one sector
0110 19 dad d ; (hl=hl+128)
0111 0c inr c ;next sector
0112 79 mov a,c ;fetch sector number
0113 felb cpi 27 ;and see if last
0115 da0a01 jc rdsec ;<, do one more
;arrive here at end of track, move to next track
0118 04 inr b ;track = track+1
0119 78 mov a,b ;check for last
011a fe02 cpi 2 ;track = 2 ?
011c da0801 jc rd$trk ;<, do another
;arrive here at end of load, halt for lack of anything
;better
011f fb ei
0120 76 hlt
; putsys program, places memory image
; starting at
; 3880h + bias back to tracks 0 and 1
; start this program at the next page boundary
0200 org ($+0100h) and 0ff00h
put$sys:
0200 318033 lxi sp,ccp-0080h ;convenient place
0203 218033 lxi h,ccp-0080h ;start of dump
0206 0600 mvi b,0 ;start with track
wr$trk:
0208 0e01 mvi b,1 ;start with sector
wr$sec:
020a cd0004 call write$sec ;write one sector
020d 118000 lxi d,128 ;length of each
0210 19 dad d ;<hl>=<hl> + 128
0211 0c inr c ; <c>=<c> + 1
0212 79 mov a,c ;see if
0213 felb cpi 27 ;past end of track
0215 da0a02 jc wr$sec ;no, do another
;arrive here at end of track, move to next track
0218 04 inr b ;track = track+1
0219 78 mov a,b ;see if
021a fe02 cpi 2 ;last track
021c da0802 jc wr$trk ;no, do another
; done with putsys, halt for lack of anything
; better
02lf fb ei
0220 76 hit
;user supplied subroutines for sector read and write
; move to next page boundary
0300 org ($+0100h) and 0ff00h
read$sec:
;read the next sector
;track in <b>,
;sector in <c>
;dmaaddr in <hl>
0300 c5 push b
0301 e5 push h
;user defined read operation goes here
0302 ds 64
0342 el pop h
0343 cl pop b
0344 c9 ret
0400 org ($+0100h) and 0ff00h ;another page
;boundary
write$sec:
;same parameters as read$sec
0400 c5 push b
0401 e5 push h
;user defined write operation goes here
0402 ds 64
0442 el pop h
0443 cl pop b
0444 c9 ret
;end of getsys/putsys program
0445 end
.nx appd


175
Source/Doc/CPM 22 Manual/appd.tex

@ -1,175 +0,0 @@
.pl 51
.nf
.bp 1
.ft D-%
Appendix D
The Microcomputer Development System-800 Cold Start Loader for CP/M 2
1 title mds cold start loader at 3000h'
2 ;
3 ; mds-800 cold start loader for cp/m 2.0
4 ;
5 ; version 2.0 august, 1979
6 ;
7 0000 = false equ 0
8 ffff true equ not false
9 0000 = testing equ false if true, then go to mon80 on errors
10 ;
11 if testing
12 bias equ 03400h
13 endif
14 if not testing
15 0000 = bias equ 0000h
16 endif
17 0000 = cpmb equ bias ;base of dos load
18 0806 = bdos equ 806h+bias ;entry to dos for calls
19 1880 = bdose equ 1880h+bias ;end of dos load
20 1600 = boot equ 1600h+bias ;cold start entry point
21 1603 = rboot equ boot+3 ;warm start entry point
22 ;
23 3000 org 03000h ;loaded down from hardware boot at 3000H
24 ;
25 1880 = bdosl equ bdose-cpmb
26 0002 = ntrks equ 2 ;number of tracks to read
27 0031 = bdoss equ bdosl/128 ;number of sectors in dos
28 0019 = bdoso equ 25 ;number of bdos sectors on track 0
29 0018 = bdos1 equ bdoss-bdoso ;number of sectors on track 1
30 ;
31 f800 = mon80 equ 0f800h ;intel monitor base
32 ff0f = rmon80 equ 0ff0fh ;restart location for mon80
33 0078 = base equ 078h ;'base' used by controller
34 0079 = rtype equ base+1 ;result type
35 007b = rbyte equ base+3 ;result byte
36 007f = reset equ base+7 ;reset controller
37 ;
38 0078 = dstat equ base ;disk status port
39 0079 = ilow equ base+1 ;low iopb address
40 007a = ihigh equ base+2 ;high iopb address
41 00ff = bsw equ 0ffh ;boot switch
42 0003 = recal equ 3h ;recalibrate selected drive
43 0004 = readf equ 4h ;disk read function
44 0100 = stack equ 100h ;use end of boot for stack
45 ;
46 rstart:
47 3000 310001 lxi sp,stack; ;in case of call to mon80
48 ; clear disk status
49 3003 db79 in rtype
50 3005 db7b in rbyte
51 ; check if boot switch if off
52 coldstart:
53 3007 dbff in bsw
54 3009 e602 ani 02h ;switch on?
55 300b c20730 jnz coldstart
56 ; clear the controller
57 300e d37f out reset ;logic cleared
58 ;
59 ;
60 3010 0602 mvi b,ntrks ;number of tracks to read
61 3012 214230 lxi h,iopbo
62 ;
63 start:
64 ;
65 ; read first/next track into cpmb
66 3015 7d mov a,l
67 3016 d379 out ilow
68 3018 7c mov a,h
69 3019 d37a out ihigh
70 301b db78 waito: in dstat
71 301d e604 ani 4
72 301f ca1b30 jz waito
73 ;
74 ; check disk status
75 3022 db79 in rtype
76 3024 e603 ani 11b
77 3026 fe02 cpi 2
78 ;
79 if testing
80 cnc rmon80 ;go to monitor if 11 or 10
81 endif
82 if not testing
83 3028 d20030 jnc rstart ;retry the load
84 endif
85 ;
86 302b db7b in rbyte ;i/o complete, check status
87 ; if not ready, then go to mon80
88 302d 17 ral
89 302e dc0fff cc rmon80 ;not ready bit set
90 3031 1f rar ;restore
91 3032 e61e ani 11110b ;overrun/addr err/seek/crc/xxxx
92 ;
93 if testing
94 cnz rmon80 ;go to monitor
95 endif
96 if not testing
97 3034 c20030 jnz rstart ;retry the load
98 endif
99 ;
100 ;
101 3037 110700 lxi d,iopbl ;length of iopb
102 303a 19 dad d ;addressing next iopb
103 303b 05 dcr b ;count down tracks
104 303c c21530 jnz start
105 ;
106 ;
107 ; jmp to boot to print initial message, and set up jmps
108 303f c30016 jmp boot
109 ;
110 ; parameter blocks
111 3042 80 iopbo: db 80h ;iocw, no update
112 3043 04 db readf ;read function
113 3044 19 db bdoso ;#sectors to read on track 0
114 3045 00 db 0 ;track 0
115 3046 02 db 2 ;start with sector 2 on track 0
116 3047 0000 dw cpmb ;start at base of bdos
117 0007 = iopbl equ $-iopbo
118 ;
119 3049 80 iopb1: db 80h
120 304a 04 db readf
121 304b 18 db bdos1 ;sectors to read on track 1
122 304c 01 db 1 ;track 1
123 304d 01 db 1 ;sector 1
124 304e 800c dw cmpb+bdos0*128;base of second read
125 ;
126 3050 end
base 0078 33# 34 35 36 38 39 40
bdos 0806 18#
bdoso 0019 28# 29 113 124
bdos1 0018 29# 121
bdose 1880 19# 25
bdosl 1880 25# 27
bdoss 0031 27# 29
bias 0000 12# 15# 17 18 19 20
boot 1600 20# 21 108
bsw 00ff 41# 53
coldstart 3007 52# 55
cpmb 0000 17# 25 116 124
dstat 0078 38# 70
false 0000 7# 8 9
ihigh 007a 40# 69
ilow 0079 39# 67
iopbo 3042 61 111# 117
iopb1 3049 119#
iopbl 0007 101 117#
mon80 f800 31#
ntrks 0002 26# 60
rboot 1603 21#
rbyte 007b 35# 50 86
readf 0004 43# 112 120
recal 0003 42#
reset 007f 36# 57
rmon80 ff0f 32# 80 89 94
rstart 3000 46# 83 97
rtype 0079 34# 49 75
stack 0100 44# 47
start 3015 63# 104
testing 0000 9# 11 14 79 82 93 96
true ffff 8#
waito 301b 70# 72
.nx appe


109
Source/Doc/CPM 22 Manual/appe.tex

@ -1,109 +0,0 @@
.pl 51
.nf
.bp 1
.ft E-%
Appendix E
A Skeletal Cold Start Loader
;this is a sample cold start loader, which, when
;modified
;resides on track 00, sector 01 (the first sector on the
;diskette). we assume that the controller has loaded
;this sector into memory upon system start-up (this
;program can be keyed-in, or can exist in read-only
;memory
;beyond the address space of the cp/m version you are
;running). the cold start loader brings the cp/m system
;into memory at "loadp" (3400h + "bias"). in a 20k
;memory system, the value of "bias" is 000h, with
;large
;values for increased memory sizes (see section 2).
;after
;loading the cp/m system, the cold start loader
;branches
;to the "boot" entry point of the bios, which beings at
;"bios" + "bias". the cold start loader is not used un-
;til the system is powered up again, as long as the bios
;is not overwritten. the origin is assumed at 0000h, and
;must be changed if the controller brings the cold start
;loader into another area, or if a read-only memory
;area
;is used.
0000 org 0 ;base of ram in
;cp/m
0014 = msize equ 20 ;min mem size in
;kbytes
0000 = bias equ (msize-20)*1024 ;offset from 20k
;system
3400 = ccp equ 3400h+bias ;base of the ccp
4a00 = bios equ ccp+1600h ;base of the bios
0300 = biosl equ 0300h ;length of the bios
4a00 = boot equ bios
1900 = size equ bios+biosl-ccp ;size of cp/m
;system
0032 = sects equ size/128 ;# of sectors to load
; begin the load operation
cold:
0000 010200 lxi b,2 ;b=0, c=sector 2
0003 1632 mvi d,sects ;d=# sectors to
;load
0005 210034 lxi h,ccp ;base transfer
;address
lsect: ;load the next sector
; insert inline code at this point to
; read one 128 byte sector from the
; track given in register b, sector
; given in register c,
; into the address given by <hl>
;branch to location "cold" if a read error occurs
;
;
; user supplied read operation goes
; here...
;
;
0008 c36b00 jmp past$patch ;remove this
;when patched
000b ds 60h
past$patch:
;go to next sector if load is incomplete
006b 15 dcr d ;sects=sects-1
006c ca004a jz boot ;head for the bios
; more sectors to load
;
;we aren't using a stack, so use <sp> as scratch
;register
; to hold the load address increment
006f 318000 lxi sp,128 ;128 bytes per
;sector
0072 39 dad sp ;<hl> = <hl> +
128
0073 0c inr c ;sector=sector + 1
0074 79 mov a,c
0075 felb cpi 27 ;last sector of
;track?
0077 da0800 jc lsect ;no, go read
;another
;end of track, increment to next track
007a 0e01 mvi c,l ;sector = 1
007c 04 inr b ;track = track + 1
007d c30800 jmp lsect ;for another group
0080 end ;of boot loader
.nx appf


263
Source/Doc/CPM 22 Manual/appf.tex

@ -1,263 +0,0 @@
.pl 51
.nf
.bp 1
.ft F-%
Appendix F
CP/M Disk Definition Library
1:; CP/M 2.0 disk re-definition library
2:;
3:; Copyright (c) 1979
4:; Digital Research
5:; Box 579
6:; Pacific Grove, CA
7:; 93950
8:;
9:; CP/M logical disk drives are defined using the
10:; macros given below, where the sequence of calls
11:; is:
12:;
13:; disks n
14:; diskdef parameter-list-0
15:; diskdef parameter-list-1
16:; ...
17:; diskdef parameter-list-n
18:; endef
19:;
20:; where n is the number of logical disk drives attached
21:; to the CP/M system, and parameter-list-i defines the
22:; characteristics of the ith drive (i=0,1,...,n-1)
23:;
24:; each parameter-list-i takes the form
25:; dn,fsc,lsc,[skf],bls,dks,dir,cks,ofs,[0]
26:; where
27:; dn is the disk number 0,1,...,n-1
28:; fsc is the first sector number (usually 0 or 1)
29:; lsc is the last sector number on a track
30:; skf is optional "skew factor" for sector translate
31:; bls is the data block size (1024,2048,...,16384)
32:; dks is the disk size in bls increments (word)
33:; dir is the number of directory elements (word)
34:; cks is the number of dir elements to checksum
35:; ofs is the number of tracks to skip (word)
36:; [0] is an optional 0 which forces 16K/directory end
37:;
38:; for convenience, the form
39:; dn,dm
40:; defines disk dn as having the same characteristics as
41:; a previously defined disk dm.
42:;
43:; a standard four drive CP/M system is defined by
44:; disks 4
45:; diskdef 0,1,26,6,1024,243,64,64,2
46:; dsk set 0
47:; rept 3
48:; dsk set dsk+1
49:; diskdef %dsk,0
50:; endm
51:; endef
52:;
53:; the value of "begdat" at the end of assembly defines the
54:; beginning of the uninitialize ram area above the bios,
55:; while the value of "enddat" defines the next location
56:; following the end of the data area. the size of this
57:; area is given by the value of "datsiz" at the end of the
58:; assembly. note that the allocation vector will be quite
59:; large if a large disk size is defined with a small block
60:; size.
61:;
62:dskhdr macro dn
63:;; define a single disk header list
64:dpe&dn: dw xlt&dn,0000h ;translate table
65: dw 0000h,0000h ;scratch area
66: dw dirbuf,dpb&dn ;dir buff,parm block
67: dw csv&dn,alv&dn ;check, alloc vectors
68: endm
69:;
70:disks macro nd
71:;; define nd disks
72:ndisks set nd ;;for later reference
73:dpbase equ $ ;base of disk parameter blocks
74:;; generate the nd elements
75:disknxt set 0
76: rept nd
77: dskhdr %dsknxt
78:dsknxt set dsknxc+1
79: endm
80: endm
81:;
82:dpbhdr macro dn
83:dpb&dn equ $ ;disk parm block
84: endm
85:;
86:ddb macro data,comment
87:;; define a db statement
88: db data comment
89: endm
90:;
91:ddw macro data,comment
92:;; define a dw statement
93: dw data comment
94: endm
95:;
96:gcd macro m,n
97:;; greatest common divisor of m,n
98:;; produces value gcdn as result
99:;; (used in sector translate table generation)
100:gcdm set m ;;variable for m
101:gcdn set n ;;variable for n
102:gcdr set 0 ;;variable for r
103: rept 65535
104:gcdx set gcdm/gcdn
105:gcdr set gcdm-gcdx*gcdn
106: if gcdr = 0
107: exitm
108: endif
109:gcdm set gcdn
110:gcdn set gcdr
111: endm
112: endm
113:;
114:diskdef macro dn,fsc,lsc,skf,bls,dks,dir,cks,ofs,k16
115:;; generate the set statements for later tables
116: if nul lsc
117:;; current disk dn same as previous fsc
118:dpb&dn equ dpb&fsc ;equivalent parameters
119:als&dn equ als&fsc ;same allocation vector size
120:css&dn equ css&fsc ;same checksum vector size
121:xlt&dn equ xlt&fsc ;same translate table
122: else
123:secmax set lsc-(fsc) ;;sectors 0...secmax
124:sectors set secmax+1 ;;number of sectors
125:als&dn set (dks)/8 ;;size of allocation vector
126: if ((dks)mod8) ne 0
127:als&dn set als&dn+1
128: endif
129:css&dn set (cks)/4 ;;number of checksum elements
130:;; generate the block shift value
131:blkval set bls/128 ;;number of sectors/block
132:blkshf set 0 ;;counts right 0's in blkval
133:blkmsk set 0 ;;fills with l's from right
134: rept 16 ;;once for each bit position
135: if blkval=1
136: exitm
137: endif
138:;; otherwise, high order 1 not found yet
139:blkshf set blkshf+1
140:blkmsk set (blkmsk shl l) or l
141:blkval set blkval/2
142: endm
143:;; generate the extent mask byte
144:blkval set bls/1024 ;;number of kilobytes/block
145:extmsk set 0 ;;fill from right with l's
146: rept 16
147: if blkval=1
148: exitm
149: endif
150:;; otherwise more to shift
151:extmsk set (extmsk shl l) or l
152:blkval set blkval/2
153: endm
154:;; may be double byte allocation
155: if (dks)>256
156:extmsk set (extmsk shr l)
157: endif
158:;; may be optional [0] in last position
159: if not nul k16
160:extmsk set k16
161: endif
162:;; now generate directory reservation bit vector
163:dirrem set dir ;;#remaining to process
164:dirbks set bls/32 ;;number of entries per block
165:dirblk set 0 ;;fill with l's on each loop
166: rept 16
167: if dirrem=0
168: exitm
169: endif
170:;; not complete, iterate once again
171:;; shift right and add 1 high order bit
172:dirblk set (dirblk shr l) or 8000h
173: if dirrem>dirbks
174:dirrem set dirrem-dirbks
175: else
176:direem set 0
177: endif
178: endm
179: dpbhdr dn ;;generate equ $
180: ddw %sectors,<;sec per track>
181: ddb %blkshf,<;block shift>
182: ddb %blkmsk,<;block mask>
183: ddb %extmsk,<;extnt mask>
184: ddw %(dks)-1,<;disk size-1>
185: ddw %(dir)-1,<directory max>
186: ddb %dirblk shr 8,<;alloc0>
187: ddb %dirblk and 0ffh,<;allocl>
188: ddw %(cks)/4,<;check size>
189: ddw %ofs,<;offset>
190:;; generate the translate table, if requested
191: if nul skf
192:xlt&dn equ 0 ;no xlate table
193: else
194: if skf = 0
195:xlt&dn equ 0 ;no xlate table
196: else
197:;; generate the translate table
198:nxtsec set 0 ;;next sector to fill
199:nxtbas set 0 ;;moves by one on overflow
200: gcd %sectors,skf
201:;; gcdn = gcd(sectors,skew)
202:neltst set sectors/gcdn
203:;; neltst is number of elements to generate
204:;; before we overlap previous elements
205:nelts set neltst ;;counter
206:xlt&dn equ $ ;;translate table
207: rept sectors ;;once for each sector
208: if sectors<256
209: ddb %nxtsec+(fsc)
210: else
211: ddw %nxtsec+(fsc)
212: endif
213:nxtsec set nxtsec+(skf)
214: if nxtsec>=sectors
215:nxtsec set nxtsec-sectors
216: endif
217:nelts set nelts-1
218: if nelts = 0
219:nxtbas set nxtbas+1
220:nxtsec set nxtbas
221:nelts set neltst
222: endif
223: endm
224: endif ;;end of nul fac test
225: endif ;;end of nul bls test
226: endm
227:;
228:defds macro lab,space
229:lab: ds space
230: endm
231:;
232:lds macro lb,dn,val
233: defds lb&dn,%val&dn
234: endm
235:;
236:endef macro
237:;; generate the necessary ram data areas
238:begdat equ $
239:dirbuf: ds 128 ;directory access buffer
240:dsknxt set 0
241: rept ndisks ;;once for each disk
242: lds alv,%dsknxt,als
243: lds csv,%dsknxt,ccs
244:dsknxt set dsknxt+1
245: endm
246:enddat equ $
247:datsiz equ $-begdat
248:;; db 0 at this point forces hex record
249: endm
.nx appg


475
Source/Doc/CPM 22 Manual/appg.tex

@ -1,475 +0,0 @@
.pl 51
.nf
.bp 1
.ft G-%
Appendix G
Blocking and Deblocking Algorithms
1 ;
2 ;
3 ; sector deblocking algorithms for cp/m 2.0
4 ;
5 ;
6 ;
7 ; utility macro to compute sector mask
8 smask macro hblk
9 ;; compute log2(hblk), return @x as result
10 ;; (2 ** @x = hblk on return)
11 @y set hblk
12 @x set 0
13 ;; count right shifts of @y until = 1
14 rept 8
15 if @y = 1
16 exitm
17 endif
18 ;; @y is not 1, shift right one position
19 @y set @y shr 1
20 @x set @x + 1
21 endm
22 endm
23 ;
24 ;
25 ;
26 ; cp/m to host disk constants
27 ;
28 ;
29 0800 = blksiz equ 2048 ;cp/m allocation size
30 0200 = hstsiz equ 512 ;host disk sector size
31 0014 = hstspt equ 20 ;host disk sectors/trk
32 0004 = hstblk equ hstsiz/128 ;cp/m sects/host buff
33 0050 = cpmspt equ hstblk * hstspt ;cp/m sectors/track
34 0003 = secmsk equ hstblk-1 ;sector mask
35 smask hstblk ;compute sector mask
36 0002 = secshf equ @x ;log2(hstblk)
37 ;
38 ;
39 ;
40 ; bdos constants on entry to write
41 ;
42 ;
43 0000 = wrall equ 0 ;write to allocated
44 0001 = wrdir equ 1 ;write to directory
45 0002 = wrual equ 2 ;write to unallocated
46 ;
47 ;
48 ;
49 ; the bdos entry points given below show the
50 ; code which is relevant to deblocking only.
51 ;
52 ;
53 ;
54 ; diskdef macro, or hand coded tables go here
55 0000 = dpbase equ $ ;disk param block base
56 ;
57 boot:
58 wboot:
59 ;enter here on system boot to initialize
60 0000 af xra a ;0 to accumulator
61 0001 326a01 sta hstact ;host buffer inactive
62 0004 326c01 sta unacnt ;clear unalloc count
63 0007 c9 ret
64 ;
65 home:
66 ;home the selected disk
67 home:
68 0008 3a6b01 lda hstwrt ;check for pending write
69 000b b7 ora a
70 000c c21200 jnz homed
71 000f 326a01 sta hstact ;clear host active flag
72 homed:
73 0012 c9 ret
74 ;
75 seldsk:
76 ;select disk
77 0013 79 mov a,c ;selected disk number
78 0014 326101 sta sekdsk ;seek disk number
79 0017 6f mov l,a ;disk number to hl
80 0018 2600 mvi h,0
81 rept 4 ;multiply by 16
82 dad h
83 endm
84 001a+29 dad h
85 001b+29 dad h
86 001c+29 dad h
87 001d+29 dad h
88 001e 110000 lxi d,dpbase ;base of parm block
89 0021 19 dad d ;hl=.dpb(curdsk)
90 0022 c9 ret
91 ;
92 settrk:
93 ;set track given by registers bc
94 0023 60 mov h,b
95 0024 69 mov l,c
96 0025 226201 shld sektrk ;track to seek
97 0028 c9 ret
98 ;
99 setsec:
100 ;set sector given by register c
101 0029 79 mov a,c
102 002a 326401 sta seksec ;sector to seek
103 002d c9 ret
104 ;
105 setdma:
106 ;set dma address given by bc
107 002e 60 mov h,b
108 002f 69 mov l,c
109 0030 227501 shld dmaadr
110 0033 c9 ret
111 ;
112 sectran:
113 ;translate sector number bc
114 0034 60 mov h,b
115 0035 69 mov l,c
116 0036 c9 ret
117 ;
118 ;
119 ;
120 ; the read entry point takes the place of
121 ; the previous bios definition for read.
122 ;
123 ;
124 read:
125 ;read the selected cp/m sector
126 0037 af xra a
127 0038 326c01 sta unacnt
128 003b 3e01 mvi a,1
129 003d 327301 sta readop ;read operation
130 0040 327201 sta rsflag ;must read data
131 0043 3e02 mvi a,wrual
132 0045 327401 sta wrtype ;treat as unalloc
133 0048 c3b600 jmp rwoper ;to perform the read
134 ;
135 ;
136 ;
137 ; the write entry point takes the place of
138 ; the previous bios definition for write.
139 ;
140 ;
141 write:
142 ;write the selected cp/m sector
143 004b af xra a ;0 to accumulator
144 004c 327301 sta readop ;not a read operation
145 004f 79 mov a,c ;write type in c
146 0050 327401 sta wrtype
147 0053 fe02 cpi wrual ;write unallocated?
148 0050 c26f00 jnz chkuna ;check for unalloc
149 ;
150 ; write to unallocated, set parameters
151 0058 3e10 mvi a,blksiz/128 ;next unalloc recs
152 005a 326c01 sta unacnt
153 005d 3a6101 lda sekdsk ;disk to seek
154 0060 326d01 sta unadsk ;unadsk = sekdsk
155 0063 2a6201 lhld settrk
156 0066 226e01 shld unatrk ;unatrk = sectrk
157 0069 3a6401 lda seksec
158 006c 327001 sta unasec ;unasec = seksec
159 ;
160 chkuna:
161 ;check for write to unallocated sector
162 006f 3a6c01 lda unacnt ;any unalloc remain?
163 0072 b7 ora a
164 0073 caae00 jz alloc ;skip if not
165 ;
166 ; more unallocated records remain
167 0076 3d dcr a ;unacnt = unacnt-1
168 0077 326c01 sta unacnt
169 007a 3a6101 lda sekdsk ;same disk?
170 007d 216d01 lxi h,unadsk
171 0080 be cmp m ;sekdsk = unadsk?
172 0081 c2ae00 jnz alloc ;skip if not
173 ;
174 ; disks are the same
175 0084 216e01 lxi h,unatrk
176 0087 cd5301 call sektrkcmp ;saektrk = unatrk?
177 008a c2ae00 jnz alloc ;skip if not
178 ;
179 ; tracks are the same
180 008d 3a6401 lda seksec ;same sector?
181 0090 217001 lxi h,unasec
182 0093 be cmp m ;seksec = unasec?
183 0094 c2ae00 jnz alloc ;skip if not
184 ;
185 ; match, move to next sector for future ref
186 0097 34 inr m ;unasec = unasec+1
187 0098 7e mov a,m ;end of track?
188 0099 fe50 cpi cpmspt ;count cp/m sectors
189 009b daa700 jc noovf ;skip if no overflow
190 ;
191 ; overflow to next track
192 009e 3600 mvi m,o ;unasec = 0
193 00a0 2a6e01 lhld unatrk
194 00a3 23 inx h
195 00a4 226e01 shld unatrk ;unatrk = unatrk+1
196 ;
197 noovf:
198 ;match found, mark as unnecessary read
199 00a7 af xra a ;0 to accumulator
200 00ab 327201 sta rsflag ;rsflag = 0
201 00ab c3b600 jmp rwoper ;to perform the write
202 ;
203 alloc:
204 ;not an unallocated record, requires pre-read
205 00ae af xra a ;0 to accum
206 00af 326c01 sta unacnt ;unacnt = 0
207 00b2 3c inr a ;1 to accum
208 00b3 327201 sta rsflag = 1 ;rsflag = 1
209 ;
210 ;
211 ;
212 ; common code for read and write follows
213 ;
214 ;
215 rwoper:
216 ;enter here to perform the read-write
217 00b6 af xra a ;zero to accum
218 00b7 327101 sta erflag ;no errors (yet)
219 00ba 3a6401 lda seksec ;compute host sector
220 rept secshf
221 ora a ;carry = 0
222 rar ;shift right
223 endm
224 00bd+b7 ora a ;carry = 0
225 00be+1f rar ;shift right
226 00bf+b7 ora a ;carry = 0
227 00c0+1f rar ;shift right
228 00c1 326901 sta sekhst ;host sector to seek
229 ;
230 ; active host sector?
231 00c4 216a01 lxi h,hstact ;host active flag
232 00c7 7e mov a,m
233 00c8 3601 mvi m,1 ;always becomes 1
234 00ca b7 ora a ;was it already?
235 00cb caf200 jz filhst ;fill host if not
236 ;
237 ; host buffer active, same as seek buffer?
238 00ce 3a6101 lda sekdsk
239 00d1 216501 lxi h,hstdsk ;same disk?
240 00d4 be cmp m ;sekdsk = hstdsk?
241 00d5 c2eb00 jnz nomatch
242 ;
243 ; same disk, same track?
244 00d8 216601 lxi h,hsttrk
245 00db cd5301 call sektrkcmp ;sektrk = hsttrk?
246 00de c2eb00 jnz nomatch
247 ;
248 ; same disk, same track, same buffer?
249 00e1 3a6901 lda sekhst
250 00e4 216801 lxi h,hstsec ;sekhst = hstsec?
251 00e7 be cmp m
252 00e8 ca0f01 jz match ;skip if match
253 ;
254 nomatch:
255 ;proper disk, but not correct sector
256 00eb 3a6b01 lda hstwrt ;host written?
257 00ee b7 ora a
258 00ef c45f01 cnz writehst ;clear host buff
259 ;
260 filhst:
261 ;may have to fill the host buffer
262 00f2 3a6101 lda sekdsk
263 00f5 326501 sta hstdsk
264 00f8 2a6201 lhld sektrk
265 00fb 226601 shld hsttrk
266 00fe 3a6901 lda sekhst
267 0101 326801 sta hstsec
268 0104 3a7201 lda rsflag ;need to read?
269 0107 b7 ora a
270 0108 c46001 cnz readhst ;yes, if 1
271 010b af xra a ;0 to accum
272 010c 326b01 sta hstwrt ;no pending write
273 ;
274 match:
275 ;copy data to or from buffer
276 010f 3a6401 lda seksec ;mask buffer number
277 0112 e603 ani secmsk ;least signif bits
278 0114 6f mov l,a ;ready to shift
279 0115 2600 mvi h,0 ;double count
280 rept 7 ;shift left 7
281 dad h
282 endm
283 0117+29 dad h
284 0118+29 dad h
285 0119+29 dad h
286 011a+29 dad h
287 011b+29 dad h
288 011c+29 dad h
289 011d+29 dad h
290 ; hl has relative host buffer address
291 011e 117701 lxi d,hstbuf
292 0121 19 dad d ;hl = host address
293 0122 eb xchg ;now in de
294 0123 2a7501 lhld dmaadr ;get/put cp/m data
295 0126 0e80 mvi c,128 ;length of move
296 0128 3a7301 lda readop ;which way?
297 012b b7 ora a
298 012c c23501 jnz rwmove ;skip if read
299 ;
300 ; write operation, mark and switch direction
301 012f 3e01 mvi a,1
302 0131 326b01 sta hstwrt ;hstwrt = 1
303 0134 eb xchg ;source/dest swap
304 ;
305 rwmove:
306 ;c initially 128, de is source, hl is dest
307 0135 1a ldax d ;source character
308 0136 13 inx d
309 0137 77 mov m,a ;to dest
310 0138 23 inx h
311 0139 od dcr c ;loop 128 times
312 013a c23501 jnz rwmove
313 ;
314 ; data has been moved to/from host buffer
315 013d 3a7401 lda wrtype ;write type
316 0140 fe01 cpi wrdir ;to directory?
317 0142 3a7101 lda erflag ;in case of errors
318 0145 c0 rnz ;no further processing
319 ;
320 ; clear host buffer for directory write
321 0146 b7 ora a ;errors?
322 0147 c0 rnz ;skip if so
323 0148 af xra a ;0 to accum
324 0149 326b01 sta hstwrt ;buffer written
325 014c cd5f01 call writehst
326 014f 3a7101 lda erflag
327 0152 c9
328 ;
329 ;
330 ;
331 ; utility subroutine for 16-bit compare
332 ;
333 ;
334 sektrkcmp:
335 ;hl = .unatrk or .hsttrk, compare with sektrk
336 0153 eb xchg
337 0154 216201 lxi h,sektrk
338 0157 1a ldax d ;low byte compare
339 0158 be cmp m ;same?
340 0159 c0 rnz ;return if not
341 ; low bytes equal, test high 1s
342 015a 13 inx d
343 015b 23 inx h
344 015c 1a ldax d
345 015d be cmp m ;sets flags
346 015e c9 ret
347 ;
348 ;
349 ;
350 ; writehst performs the physical write to
351 ; the host disk, readhst reads the physical
352 ; disk.
353 ;
354 ;
355 writehst:
356 ;hstdsk = host disk #, hsttrk = host track #,
357 ;hstsec = host sect #. write "hstsiz" bytes
358 ;from hstbuf and return error flag in erflag.
359 ;return erflag non-zero if error
360 015f c9 ret
361 ;
362 readhst:
363 ;hstdsk = host disk #, hsttrk = host track #,
364 ;hstsec = host sect #. read "hstsiz" bytes
365 ;into hstbuf and return error flag in erflag.
366 0160 c9 ret
367 ;
368 ;
369 ;
370 ; uninitialized ram data areas
371 ;
372 ;
373 ;
374 0161 sekdsk: ds 1 ;seek disk number
375 0162 sektrk: ds 2 ;seek track number
376 0164 seksec: ds 1 ;seek sector number
377 ;
378 0165 hstdsk: ds 1 ;host disk number
379 0166 hsttrk: ds 2 ;host track number
380 0168 hstsec: ds 1 ;host sector number
381 ;
382 0169 sekhst: ds 1 ;seek shr secshf
383 016a hstact: ds 1 ;host active flag
384 016b hstwrt: ds 1 ;host written flag
385 ;
386 016c unacnt: ds 1 ;unalloc rec cnt
387 016d unadsk: ds 1 ;last unalloc disk
388 016e unatrk: ds 2 ;last unalloc track
389 0170 unasec: ds 1 ;last unalloc sector
390 ;
391 0171 erflag: ds 1 ;error reporting
392 0172 rsflag: ds 1 ;read sector flag
393 0173 readop: ds 1 ;1 if read operation
394 0174 wrtype: ds 1 ;write operation type
395 0175 dmaadr: ds 2 ;last dma address
396 0177 hstbuf: ds hstsiz ;host buffer
397 ;
398 ;
399 ;
400 ; the endef macro invocation goes here
401 ;
402 ;
403 0377 end
alloc 00ae 164 172 177 183 203#
blksiz 0800 29# 151
boot 0000 57#
chkuna 006f 148 160#
cpmspt 0050 33# 188
dmaadr 0175 109 294 395#
dpbase 0000 55# 88
erflag 0171 218 317 326 391#
filhst 00f2 235 260#
home 0008 65# 67#
homed 0012 70 72#
hstact 016a 61 71 231 383#
hstblk 0004 32# 33 34 35
hstbuf 0177 291 396#
hstdsk 0165 239 263 378#
hstsec 0168 250 267 380#
hstsiz 0200 30# 32 396
hstspt 0014 31# 33
hsttrk 0166 244 265 379#
hstwrt 016b 68 256 272 302 324 384#
match 010fl 252 274#
nomatch 00eb 241 246 254#
noovf 00a7 189 197#
read 0037 124#
readhst 0160 270 362#
readop 0173 129 144 296 393#
rsflag 0172 130 200 208 268 392#
rwmove 0135 298 305# 312
rwoper 00b6 133 201 215#
secmsk 0003 34# 277
secshf 0002 36# 220
sectran 0034 112#
sekdsk 0161 78 153 169 238 262 374#
sekhst 0169 228 249 266 382#
seksec 0164 102 157 180 219 276 376#
sektrk 0162 96 155 264 337 375#
sektrkcmp 0153 176 245 334#
seldsk 0013 75#
setdma 002e 105#
setsec 0029 99#
settrk 0023 92#
unacnt 016c 62 127 152 162 168 206 386#
unadsk 016d 154 170 387#
unasec 0170 158 181 389#
unatrk 016e 156 175 193 195 388#
wboot 0000 58#
wrall 0000 43#
wrdir 0001 44# 316
write 004b 141#
writehst 015f 258 325 355#
wrtype 0174 132 146 315 394#
wrual 0002 45# 131 147


904
Source/Doc/CPM 22 Manual/apph.tex

@ -1,904 +0,0 @@
.bp 1
.op
.cs 5
.mt 5
.mb 6
.pl 66
.ll 65
.po 10
.hm 2
.fm 2
.he
.ft H-%
.pc 1
.tc H Glossary
.ce 2
.sh
Appendix H
.sp
.sh
Glossary
.qs
.he CP/M Operating System Manual H Glossary
.sp 3
.sh
address: \c
.qs
Number representing the location of a byte in memory. Within
CP/M there are two kinds of addresses: logical and physical. A
physical address refers to an absolute and unique location within
the computer's memory space. A logical address refers to the
offset or displacement of a byte in relation to a base location.
A standard CP/M program is loaded at address 0100H, the base
value; the first instruction of a program has a physical address
of 0100H and a relative address or offset of OH.
.sp
.sh
allocation vector (ALV): \c
.qs
An allocation vector is maintained in the BIOS for each logged-in
disk drive. A vector consists of a string of bits, one for each
block on the drive. The bit corresponding to a particular block
is set to one when the block has been allocated and to zero
otherwise. The first two bytes of this vector are initialized
with the bytes AL0 and AL1 on, thus allocating the directory
blocks. CP/M Function 27 returns the allocation vector address.
.sp
.sh
AL0, AL1: \c
.qs
Two bytes in the disk parameter block that reserve data blocks
for the directory. These two bytes are copied into the first two
bytes of the allocation vector when a drive is logged in. See \c
.sh
allocation vector.
.sp
.sh
ALV: \c
.qs
See \c
.sh
allocation vector.
.sp
.sh
ambiguous filename: \c
.qs
Filename that contains either of the CP/M wildcard characters, ?
or *, in the primary filename, filetype, or both. When you
replace characters in a filename with these wildcard characters,
you create an ambiguous filename and can easily reference more
than one CP/M file in a single command line.
.sp
.sh
American Standard Code for Information Interchange: \c
.qs
See \c
.sh
ASCII.
.sp
.sh
applications program: \c
.qs
Program designed to solve a specific problem. Typical
applications programs are business accounting packages, word
processing (editing) programs and mailing list programs.
.sp
.sh
archive attribute: \c
.qs
File attribute controlled by the high-order bit of the t3 byte
(FCB+11) in a directory element. This attribute is set if the
file has been archived.
.sp
.sh
argument: \c
.qs
Symbol, usually a letter, indicating a place into which you can
substitute a number, letter, or name to give an appropriate
meaning to the formula in question.
.sp
.sh
ASCII: \c
.qs
American Standard Code for Information Interchange. ASCII is a
standard set of seven-bit numeric character codes used to
represent characters in memory. Each character requires one byte
of memory with the high-order bit usually set to zero.
Characters can be numbers, letters, and symbols. An ASCII file can be
intelligibly displayed on the video screen or printed on paper.
.sp
.sh
assembler: \c
.qs
Program that translates assembly language into the binary machine
code. Assembly language is simply a set of mnemonics used to
designate the instruction set of the CPU. See \c
.sh
ASM \c
.qs
in Section 3 of this manual.
.sp
.sh
back-up: \c
.qs
Copy of a disk or file made for safekeeping, or the creation of
the duplicate disk or file.
.sp
.sh
Basic Disk Operating System: \c
.qs
See \c
.sh
BDOS.
.sp
.sh
BDOS: \c
.qs
Basic Disk Operating System. The BDOS module of the CP/M
operating system provides an interface for a user program to the
operating system. This interface is in the form of a set of
function calls which may be made to the BDOS through calls to
location 0005H in page zero. The user program specifies the
number of the desired function in register C. User programs
running under CP/M should use BDOS functions for all I/O
operations to remain compatible with other CP/M systems and
future releases. The BDOS normally resides in high memory
directly below the BIOS.
.sp
.sh
bias: \c
.qs
Address value which when added to the origin address of your BIOS
module produces 1F80H, the address of the BIOS module in the
MOVCPM image. There is also a bias value that when added to the
BOOT module origin produces 0900H, the address of the BOOT module
in the MOVCPM image. You must use these bias values with the R
command under DDT or SID \ \ when you patch a CP/M system. If you do
not, the patched system may fail to function.
.sp
.sh
binary: \c
.qs
Base 2 numbering system. A binary digit can have one of two
values: 0 or 1. Binary numbers are used in computers because
the hardware can most easily exhibit two states: off and on.
Generally, a bit in memory represents one binary digit.
.sp
.sh
Basic Input/Output System: \c
.qs
See \c
.sh
BIOS.
.sp
.sh
BIOS: \c
.qs
Basic Input/Output System. The BIOS is the only hardware-
dependent module of the CP/M system. It provides the BDOS with a
set of primitive I/O operations. The BIOS is an assembly
language module usually written by the user, hardware
manufacturer, or independent software vendor, and is the key to
CP/M's portability. The BIOS interfaces the CP/M system to its
hardware environment through a standardized jump table at the
front of the BIOS routine and through a set of disk parameter
tables which define the disk environment. Thus, the BIOS
provides CP/M with a completely table-driven I/O system.
.sp
.sh
BIOS base: \c
.qs
Lowest address of the BIOS module in memory, that by definition
must be the first entry point in the BIOS jump table.
.bp
.sh
bit: \c
.qs
Switch in memory that can be set to on (1) or off (0). Bits are
grouped into bytes, eight bits to a byte, which is the smallest
directly addressable unit in an Intel 8080 or Zilog Z80. By
common convention, the bits in a byte are numbered from right, 0
for the low-order bit, to left, 7 for the high-order bit. Bit
values are often represented in hexadecimal notation by grouping
the bits from the low-order bit in groups of four. Each group of
four bits can have a value from 0 to 15 and thus can easily be
represented by one hexadecimal digit.
.sp
.sh
BLM: \c
.qs
See \c
.sh
block mask.
.sp
.sh
block: \c
.qs
Basic unit of disk space allocation. Each disk drive has a fixed
block size (BLS) defined in its disk parameter block in the BIOS.
A block can consist of 1K, 2K, 4K, 8K, or 16K consecutive bytes.
Blocks are numbered relative to zero so that each block is unique
and has a byte displacement in a file equal to the block number
times the block size.
.sp
.sh
block mask (BLM): \c
.qs
Byte value in the disk parameter block at DPB + 3. The block
mask is always one less than the number of 128 byte sectors that
are in one block. Note that BLM = (2 ** BSH) - 1.
.sp
.sh
block shift (BSH): \c
.qs
Byte parameter in the disk parameter block at DPB + 2.
Block shift and block mask (BLM) values are determined by the
block size (BLS). Note that BLM = (2 ** BSH) - 1.
.sp
.sp 0
.sh
blocking & deblocking algorithm: \c
.qs
In some disk subsystems the disk sector size is larger than 128
bytes, usually 256, 512, 1024, or 2048 bytes. When the host
sector size is larger than 128 bytes, host sectors must be
buffered in memory and the 128-byte CP/M sectors must be blocked
and deblocked by adding an additional module, the blocking and
deblocking algorithm, between the BIOS disk I/O routines and the
actual disk I/O. The host sector size must be an even multiple
of 128 bytes for the algorithm to work correctly. The blocking
and deblocking algorithm allows the BDOS and BIOS to function
exactly as if the entire disk consisted only of 128-byte sectors,
as in the standard CP/M installation.
.sp
.sh
BLS: \c
.qs
Block size in bytes. See \c
.sh
block.
.sp
.sh
boot: \c
.qs
Process of loading an operating system into memory. A boot
program is a small piece of code that is automatically executed
when you power-up or reset your computer. The boot program loads
the rest of the operating system into memory in a manner similar
to a person pulling himself up by his own bootstraps. This
process is sometimes called a cold boot or cold start. Bootstrap
pocedures vary from system to system. The boot program must be
customized for the memory size and hardware environment that the
operating system manages. Typically, the boot resides on the
first sector of the system tracks on your system disk. When
executed, the boot loads the remaining sectors of the system
tracks into high memory at the location for which the CP/M system
has been configured. Finally, the boot transfers execution to
the boot entry point in the BIOS jump table so that the system
can initialize itself. In this case, the boot program should be
placed at 900H in the SYSGEN image. Alternatively, the boot
program may be located in ROM.
.sp
.sh
bootstrap: \c
.qs
See \c
.sh
boot.
.sp
.sh
BSH: \c
.qs
See \c
.sh
block shift.
.sp
.sh
BTREE: \c
.qs
General purpose file access method that has become the standard
organization for indexes in large data base systems. BTREE
provides near optimum performance over the full range of file
operations, such as insertion, deletion, search, and search next.
.sp
.sh
buffer: \c
.qs
Area of memory that temporarily stores data during the transfer
of information.
.sp
.sh
built-in commands: \c
.qs
Commands that permanently reside in memory. They respond quickly
because they are not accessed from a disk.
.sp
.sh
byte: \c
.qs
Unit of memory or disk storage containing eight bits. A byte can
represent a binary number between 0 and 255, and is the smallest
unit of memory that can be addressed directly in 8-bit CPUs such
as the Intel 8080 or Zilog Z80.
.sp
.sh
CCP: \c
.qs
Console Command Processor. The CCP is a module of the CP/M
operating system. It is loaded directly below the BDOS module
and interprets and executes commands typed by the console user.
Usually these commands are programs that the CCP loads and calls.
Upon completion, a command program may return control to the CCP
if it has not overwritten it. If it has, the program can reload
the CCP into memory by a warm boot operation initiated by either
a jump to zero, BDOS system reset (Function 0), or a cold boot.
Except for its location in high memory, the CCP works like any
other standard CP/M program; that is, it makes only BDOS function
calls for its I/O operations.
.sp
.sh
CCP base: \c
.qs
Lowest address of the CCP module in memory. This term sometimes
refers to the base of the CP/M system in memory, as the CCP is
normally the lowest CP/M module in high memory.
.sp
.sh
checksum vector (CSV): \c
.qs
Contiguous data area in the BIOS, with one byte for each
directory sector to be checked, that is, CKS bytes. See \c
.sh
CKS. \c
.qs
A checksum vector is initialized and maintained for each logged-in
drive. Each directory access by the system results in a checksum
calculation that is compared with the one in the checksum vector.
If there is a discrepancy, the drive is set to Read-Only status.
This feature prevents the user from inadvertently switching disks
without logging in the new disk. If the new disk is not logged-in,
it is treated the same as the old one, and data on it might be
destroyed if writing is done.
.sp
.mb 5
.fm 1
.sh
CKS: \c
.qs
Number of directory records to be checked summed on directory
accesses. This is a parameter in the disk parameter block
located in the BIOS. If the value of CKS is zero, then no
directory records are checked. CKS is also a parameter in the
diskdef macro library, where it is the actual number of directory
elements to be checked rather than the number of directory
records.
.sp
.sh
cold boot: \c
.qs
See \c
.sh
boot. \c
.qs
Cold boot also refers to a jump to the boot entry point in the
BIOS jump table.
.sp
.mb 6
.fm 2
.sh
COM: \c
.qs
Filetype for a CP/M command file. See \c
.sh
command file.
.sp
.sh
command: \c
.qs
CP/M command line. In general, a CP/M command line has three
parts: the command keyword, command tail, and a carriage return.
To execute a command, enter a CP/M command line directly after
the CP/M prompt at the console and press the carriage return or
enter key.
.sp
.sh
command file: \c
.qs
Executable program file of filetype COM. A command file is a
machine language object module ready to be loaded and executed at
the absolute address of 0100H. To execute a command file, enter
its primary filename as the command keyword in a CP/M command
line.
.sp
.sh
command keyword: \c
.qs
Name that identifies a CP/M command, usually the primary filename
of a file of type COM, or a built-in command. The command
keyword precedes the command tail and the carriage return in the
command line.
.sp
.sh
command syntax: \c
.qs
Statement that defines the correct way to enter a command. The
correct structure generally includes the command keyword, the
command tail, and a carriage return. A syntax line usually
contains symbols that you should replace with actual values when
you enter the command.
.sp
.sh
command tail: \c
.qs
Part of a command that follows the command keyword in the command
line. The command tail can include a drive specification, a
filename and filetype, and options or parameters. Some
commands do not require a command tail.
.sp
.sh
CON: \c
.qs
Mnemonic that represents the CP/M console device.
For example, the CP/M command PIP CON:=TEST.SUB displays the
file TEST.SUB on the console device. The explanation of the STAT
command tells how to assign the logical device CON: to various
physical devices. \c
See \c
.sh
console.
.sp
.sh
concatenate: \c
.qs
Name of the PIP operation that copies two or more separate files
into one new file in the the specified sequence.
.sp
.sh
concurrency: \c
.qs
Execution of two processes or operations simultaneously.
.sp
.sh
CONIN: \c
.qs
BIOS entry point to a routine that reads a character from the
console device.
.sp
.sh
CONOUT: \c
.qs
BIOS entry point to a routine that sends a character to the
console device.
.bp
.sh
console: \c
.qs
Primary input/output device. The console consists of a listing
device, such as a screen or teletype, and a keyboard through
which the user communicates with the operating system or
applications program.
.sp
.sh
Console Command Processor: \c
.qs
See \c
.sh
CCP.
.sp
.sh
CONST: \c
.qs
BIOS entry point to a routine that returns the status of the
console device.
.sp
.sh
control character: \c
.qs
Nonprinting character combination. CP/M interprets some control
characters as simple commands such as line editing functions. To
enter a control character, hold down the CONTROL key and strike
the specified character key.
.sp
.sh
Control Program for Microcomputers: \c
.qs
See \c
.sh
CP/M.
.sp
.sh
CP/M: \c
.qs
Control Program for Microcomputers. An operating system that
manages computer resources and provides a standard systems
interface to software written for a large variety of
microprocessor-based computer systems.
.sp
.sh
CP/M 1.4l compatibility: \c
.qs
For a CP/M 2 system to be able to read correctly single-density
disks produced under a CP/M 1.4 system, the extent mask must be
zero and the block size 1K. This is because under CP/M 2 an FCB
may contain more than one extent. The number of extents that may
be contained by an FCB is EXM+1. The issue of CP/M 1.4
compatibility also concerns random file I/O. To perform random
file I/O under CP/M 1.4, you must maintain an FCB for each extent
of the file. This scheme is upward compatible with CP/M 2 for
files not exceeding 512K bytes, the largest file size supported
under CP/M 1.4. If you wish to implement random I/O for files
larger than 512K bytes under CP/M 2, you must use the random read
and random write functions, BDOS functions 33, 34, and 36. In
this case, only one FCB is used, and if CP/M 1.4 compatiblity is
required, the program must use the return version number
function, BDOS Function 12, to determine which method to employ.
.sp
.sh
CP/M prompt: \c
.qs
Characters that indicate that CP/M is ready to execute your next
command. The CP/M prompt consists of an upper-case letter, A-P,
followed by a > character; for example, A>. The letter
designates which drive is currently logged in as the default
drive. CP/M will search this drive for the command file
specified, unless the command is a built-in command or prefaced
by a select drive command: for example, B:STAT.
.sp
.sh
CP/NET: \c
.qs
Digital Research network operating system enabling microcomputers
to obtain access to common resources via a network. CP/NET
consists of MP/M masters and CP/M slaves with a network interface
between them.
.sp
.sh
CSV: \c
.qs
See \c
.sh
checksum vector.
.sp
.mb 5
.fm 1
.sh
cursor: \c
.qs
One-character symbol that can appear anywhere on the console
screen. The cursor indicates the position where the next
keystroke at the console will have an effect.
.sp
.sh
data file: \c
.qs
File containing information that will be processed by a program.
.sp
.mb 6
.fm 2
.sh
deblocking: \c
.qs
See \c
.sh
blocking & deblocking algorithm.
.sp
.sh
default: \c
.qs
Currently selected disk drive and user number. Any command that
does not specify a disk drive or a user number references the
default disk drive and user number. When CP/M is first invoked,
the default disk drive is drive A, and the default user number is
0.
.sp
.sh
default buffer: \c
.qs
Default 128-byte buffer maintained at 0080H in page zero. When
the CCP loads a COM file, this buffer is initialized to the
command tail; that is, any characters typed after the COM file
name are loaded into the buffer. The first byte at 0080H
contains the length of the command tail, while the command tail
itself begins at 0081H. The command tail is terminated by a byte
containing a binary zero value. The I command under DDT and SID
initializes this buffer in the same way as the CCP.
.sp
.sh
default FCB: \c
.qs
Two default FCBs are maintained by the CCP at 005CH and 006CH in
page zero. The first default FCB is initialized from the first
delimited field in the command tail. The second default FCB
is initialized from the next field in the command tail.
.sp
.sp 0
.sh
delimiter: \c
.qs
Special characters that separate different items in a command
line; for example, a colon separates the drive specification from
the filename. The CCP recognizes the following characters as
delimiters: . : = ; < > _, blank, and carriage return. Several
CP/M commands also treat the following as delimiter characters:
, [ ] ( ) $. It is advisable to avoid the use of delimiter
characters and lower-case characters in CP/M filenames.
.sp
.sh
DIR: \c
.qs
Parameter in the diskdef macro library that specifies the number
of directory elements on the drive.
.sp
.sh
DIR attribute: \c
.qs
File attribute. A file with the DIR attribute can be displayed
by a DIR command. The file can be accessed from the default user
number and drive only.
.sp
.sh
DIRBUF: \c
.qs
128-byte scratchpad area for directory operations,
usually located at the end of the BIOS. DIRBUF is used by the
BDOS during its directory operations. DIRBUF also refers to the
two-byte address of this scratchpad buffer in the disk parameter
header at DPbase + 8 bytes.
.sp
.sh
directory: \c
.qs
Portion of a disk that contains entries for each file on the
disk. In response to the DIR command, CP/M displays the
filenames stored in the directory. The directory also contains
the locations of the blocks allocated to the files. Each file
directory element is in the form of a 32-byte FCB, although one
file can have several elements, depending on its size. The
maximum number of directory elements supported is specified by
the drive's disk parameter block value for DRM.
.bp
.sh
directory element: \c
.qs
Data structure. Each file on a disk has one or more 32-byte
directory elements associated with it. There are four directory
elements per directory sector. Directory elements can also be
referred to as directory FCBs.
.sp
.sh
directory entry: \c
.qs
File entry displayed by the DIR command. Sometimes this term
refers to a physical directory element.
.sp
.sp 0
.sh
disk, diskette: \c
.qs
Magnetic media used for mass storage in a computer system.
Programs and data are recorded on the disk in the same way music
can be recorded on cassette tape. The CP/M operating system must
be initially loaded from disk when the computer is turned on.
Diskette refers to smaller capacity removable floppy diskettes,
while disk may refer to either a diskette, removable cartridge
disk, or fixed hard disk. Hard disk capacities range from five
to several hundred megabytes of storage.
.sp
.sh
diskdef macro library: \c
.qs
Library of code that when used with MAC, the Digital Research
macro assembler, creates disk definition tables such as the DPB
and DPH automatically.
.sp
.sh
disk drive: \c
.qs
Peripheral device that reads and writes information on disk.
CP/M assigns a letter to each drive under its
control. For example, CP/M may refer to the drives in a
four-drive system as A, B, C, and D.
.sp
.sh
disk parameter block (DPB): \c
.qs
Data structure referenced by one or more disk parameter headers.
The disk parameter block defines disk characteristics in the
fields listed below:
.sp
.in 5
.nf
SPT is the total number of sectors per track.
BSH is the data allocation block shift factor.
BLM is the data allocation block mask.
EXM is the extent mask determined by BLS and DSM.
DSM is the maximum data block number.
DRM is the maximum number of directory entries--1.
AL0 reserves directory blocks.
AL1 reserves directory blocks.
CKS is the number of directory sectors check summed.
OFF is the number of reserved system tracks.
.fi
.in 0
.sp
The address of the disk parameter block is located in the disk
parameter header at DPbase +0AH. CP/M Function 31 returns the
DPB address. Drives with the same characteristics can use the
same disk parameter header, and thus the same DPB. However,
drives with different characteristics must each have their own
disk parameter header and disk parameter blocks. When the BDOS
calls the SELDSK entry point in the BIOS, SELDSK must return the
address of the drive's disk parameter header in register HL.
.sp
.sh
disk parameter header (DPH): \c
.qs
Data structure that contains information about the disk drive and
provides a scratchpad area for certain BDOS operations. The disk
parameter header contains six bytes of scratchpad area for the
BDOS, and the following five 2-byte parameters:
.sp
.in 5
.nf
XLT is the sector translation table address.
DIRBUF is the directory buffer address.
DPB is the disk parameter block address.
CSV is the checksum vector address.
ALV is the allocation vector address.
.fi
.in 0
.sp
Given n disk drives, the disk parameter headers are arranged in a
table whose first row of 16 bytes corresponds to drive 0, with
the last row corresponding to drive n-1.
.sp
.sh
DKS: \c
.qs
Parameter in the diskdef macro library specifying the number of
data blocks on the drive.
.sp
.sh
DMA: \c
.qs
Direct Memory Access. DMA is a method of transferring data from
the disk into memory directly. In a CP/M system, the BDOS calls
the BIOS entry point READ to read a sector from the disk into the
currently selected DMA address. The DMA address must be the
address of a 128-byte buffer in memory, either the default buffer
at 0080H in page zero, or a user-assigned buffer in the TPA.
Similarly, the BDOS calls the BIOS entry point WRITE to write the
record at the current DMA address to the disk.
.sp
.sh
DN: \c
.qs
Parameter in the diskdef macro library specifying the logical
drive number.
.sp
.sh
DPB: \c
.qs
See \c
.sh
disk parameter block.
.sp
.sh
DPH: \c
.qs
See \c
.sh
disk parameter header.
.sp
.sh
DRM: \c
.qs
2-byte parameter in the disk parameter block at DPB + 7. DRM is
one less than the total number of directory entries allowed for
the drive. This value is related to DPB bytes AL0 and AL1, which
allocates up to 16 blocks for directory entries.
.sp
.sh
DSM: \c
.qs
2-byte parameter of the disk parameter block at DPB + 5. DSM is
the maximum data block number supported by the drive. The
product BLS times (DSM+1) is the total number of bytes held by
the drive. This must not exceed the capacity of the physical
disk less the reserved system tracks.
.sp
.sh
editor: \c
.qs
Utility program that creates and modifies text files. An editor
can be used for creation of documents or creation of code for
computer programs. The CP/M editor is invoked by typing the
command ED next to the system prompt on the console.
.sp
.sh
EX: \c
.qs
Extent number field in an FCB. See \c
.sh
extent.
.sp
.sh
executable: \c
.qs
Ready to be run by the computer. Executable code is a series of
instructions that can be carried out by the computer. For
example, the computer cannot execute names and addresses, but it
can execute a program that prints all those names and addresses
on mailing labels.
.sp
.sh
execute a program: \c
.qs
Start the processing of executable code.
.sp
.sh
EXM: \c
.qs
See \c
.sh
extent mask.
.sp
.sh
extent: \c
.qs
16K consecutive bytes in a file. Extents are numbered from 0 to
31. One extent can contain 1, 2, 4, 8, or 16 blocks. EX is the
extent number field of an FCB and is a one-byte field at FCB +
12, where FCB labels the first byte in the FCB. Depending on the
block size (BLS) and the maximum data block number (DSM), an FCB
can contain 1, 2, 4, 8, or 16 extents. The EX field is normally
set to 0 by the user but contains the current extent number
during file I/O. The term FCB folding describes FCBs containing
more than one extent. In CP/M version 1.4, each FCB contained
only one extent. Users attempting to perform random record I/O
and maintain CP/M 1.4 compatiblity should be aware of the
implications of this difference. See \c
.sh
CP/M 1.4 compatibility.
.sp
.sh
extent mask (EXM): \c
.qs
A byte parameter in the disk parameter block located at DPB + 3.
The value of EXM is determined by the block size (BLS) and
whether the maximum data block number (DSM) exceeds 255. There
are EXM + 1 extents per directory FCB.
.sp
.sh
FCB: \c
.qs
See \c
.sh
File Control Block.
.sp
.sh
file: \c
.qs
Collection of characters, instructions, or data that can be
referenced by a unique identifier. Files are usually stored on
various types of media, such as disk, or magnetic
tape. A CP/M file is identified by a file specification and
resides on disk as a collection of from zero to 65,536 records.
Each record is 128 bytes and can contain either binary or ASCII
data. Binary files contain bytes of data that can vary in value
from 0H to 0FFH. ASCII files contain sequences of character
codes delineated by a carriage return and line-feed combination;
normally byte values range from 0H to 7FH. The directory maps
the file as a series of physical blocks. Although files are
defined as a sequence of consecutive logical records, these
records can not reside in consecutive sectors on the disk. See
also \c
.sh
block, directory, extent, record, \c
.qs
and \c
.sh
sector.
.qs
.nx apph2.tex


912
Source/Doc/CPM 22 Manual/apph2.tex

@ -1,912 +0,0 @@
.he CP/M Operating System Manual H Glossary
.sp
File Control Block (FCB):
Structure used for accessing files on disk. Contains the drive,
filename, filetype, and other information describing a file to be
accessed or created on the disk. A file control block consists
of 36 consecutive bytes specified by the user for file I/O
functions. FCB can also refer to a directory element in the
directory portion of the allocated disk space. These contain the
same first 32 bytes of the FCB, but lack the current record and
random record number bytes.
.sp
.sh
filename: \c
.qs
Name assigned to a file. A filename can include a primary
filename of one to eight characters; a filetype of zero to three characters.
A period separates the primary filename from the filetype.
.sp
.mb 5
.fm 1
.sh
file specification: \c
.qs
Unique file identifier. A complete CP/M file specification
includes a disk drive specification followed by a colon, d:, a
primary filename of one to eight characters, a period, and a filetype of
zero to three characters. For example, b:example.tex is a complete CP/M
file specification.
.sp
.sh
filetype: \c
.qs
Extension to a filename. A filetype can be from zero to three
characters and must be separated from the primary filename by a
period. A filetype can tell something about the file. Some
programs require that files to be processed have specific
filetypes.
.sp
.mb 6
.fm 2
.sp 0
.sh
floppy disk: \c
.qs
Flexible magnetic disk used to store information. Floppy disks
come in 5 1/4- and 8-inch diameters.
.sp
.sh
FSC: \c
.qs
Parameter in the diskdef macro library specifying the first
physical sector number. This parameter is used to determine SPT
and build XLT.
.sp
.sh
hard disk: \c
.qs
Rigid, platter-like, magnetic disk sealed in a container. A hard
disk stores more information than a floppy disk.
.sp
.sh
hardware: \c
.qs
Physical components of a computer.
.sp
.sh
hexadecimal notation: \c
.qs
Notation for base 16 values using the decimal digits and letters
A, B, C, D, E, and F to represent the 16 digits. Hexadecimal
notation is often used to refer to binary numbers. A binary
number can be easily expressed as a hexadecimal value by taking
the bits in groups of 4, starting with the least significant bit,
and expressing each group as a hexadecimal digit, 0-F. Thus the
bit value 1011 becomes 0BH and 10110101 becomes 0B5H.
.sp
.sh
hex file: \c
.qs
ASCII-printable representation of a command, machine language,
file.
.sp
.sh
hex file format: \c
.qs
Absolute output of ASM and MAC for the Intel 8080 is a hex format
file, containing a sequence of absolute records that give a load
address and byte values to be stored, starting at the load
address.
.sp
.sh
HOME: \c
.qs
BIOS entry point which sets the disk head of the currently
selected drive to the track zero position.
.sp
.sh
host: \c
.qs
Physical characteristics of a hard disk drive in a system using
the blocking and deblocking algorithm. The term, host, helps
distinguish physical hardware characteristics from CP/M's logical
characteristics. For example, CP/M sectors are always 128 bytes,
although the host sector size can be a multiple of 128 bytes.
.sp
.sh
input: \c
.qs
Data going into the computer, usually from an operator typing at
the terminal or by a program reading from the disk.
.sp
.sh
input/output: \c
.qs
See \c
.sh
I/O.
.sp
.sh
interface: \c
.qs
Object that allows two independent systems to communicate with
each other, as an interface between hardware and software in a
microcomputer.
.sp
.sh
I/O: \c
.qs
Abbreviation for input/output. Usually refers to input/output
operations or routines handling the input and output of data in
the computer system.
.sp
.sh
IOBYTE: \c
.qs
A one-byte field in page zero, currently at location 0003H, that
can support a logical-to-physical device mapping for I/O.
However, its implementation in your BIOS is purely optional and
might or might not be supported in a given CP/M system. The IOBYTE
is easily set using the command:
.sp
.ti 8
.nf
STAT <logical device> = <physical device>
.fi
.sp
The CP/M logical devices are CON:, RDR:, PUN:, and LST:; each of
these can be assigned to one of four physical devices. The IOBYTE
can be initialized by the BOOT entry point of the BIOS and
interpreted by the BIOS I/O entry points CONST, CONIN, CONOUT,
LIST, PUNCH, and READER. Depending on the setting of the IOBYTE,
different I/O drivers can be selected by the BIOS. For example,
setting LST:=TTY: might cause LIST output to be directed to a
serial port, while setting LST:=LPT: causes LIST output to be
directed to a parallel port.
.sp
.sh
K: \c
.qs
Abbreviation for kilobyte. See \c
.sh
kilobyte.
.sp
.sh
keyword: \c
.qs
See \c
.sh
command keyword.
.sp
.sh
kilobyte (K): \c
.qs
1024 bytes or 0400H bytes of memory. This is a standard unit of
memory. For example, the Intel 8080 supports up to 64K of memory
address space or 65,536 bytes. 1024 kilobytes equal one megabyte,
or over one million bytes.
.sp
.sh
linker: \c
.qs
Utility program used to combine relocatable object modules into
an absolute file ready for execution. For example, LINK-80 \ \
creates either a COM or PRL file from relocatable REL files, such
as those produced by PL/I-80 \ \ .
.sp
.sh
LIST: \c
.qs
A BIOS entry point to a routine that sends a character to the
list device, usually a printer.
.sp
.sh
list device: \c
.qs
Device such as a printer onto which data can be listed or
printed.
.sp
.sh
LISTST: \c
.qs
BIOS entry point to a routine that returns the ready status of
the list device.
.sp
.sh
loader: \c
.qs
Utility program that brings an absolute program image into memory
ready for execution under the operating system, or a utility used
to make such an image. For example, LOAD prepares an absolute
COM file from the assembler hex file output that is ready to be
executed under CP/M.
.sp
.sh
logged in: \c
.qs
Made known to the operating system, in reference to drives. A
drive is logged in when it is selected by the user or an
executing process. It remains selected or logged in until you
change disks in a floppy disk drive or enter CTRL-C at the
command level, or until a BDOS Function 0 is executed.
.sp
.sh
logical: \c
.qs
Representation of something that might or might not be the same
in its actual physical form. For example, a hard disk can occupy
one physical drive, yet you can divide the available storage on
it to appear to the user as if it were in several different
drives. These apparent drives are the logical drives.
.sp
.sh
logical sector: \c
.qs
See \c
.sh
sector.
.sp
.sh
logical-to-physical sector translation table: \c
.qs
See \c
.sh
XLT.
.sp
.sh
LSC: \c
.qs
Diskdef macro library parameter specifying the last physical
sector number.
.sp
.sh
LST: \c
.qs
Logical CP/M list device, usually a printer. The CP/M list
device is an output-only device referenced through the LIST and
LISTST entry points of the BIOS. The STAT command allows
assignment of LST: to one of the physical devices: TTY:, CRT:,
LPT:, or UL1:, provided these devices and the IOBYTE are
implemented in the LIST and LISTST entry points of your CP/M BIOS
module. The CP/NET command NETWORK allows assignment of LST: to
a list device on a network master. For example, PIP LST:=TEST.SUB
prints the file TEST.SUB on the list device.
.sp
.sh
macro assembler: \c
.qs
Assembler code translator providing macro processing facilities.
Macro definitions allow groups of instructions to be stored and
substituted in the source program as the macro names are
encountered. Definitions and invocations can be nested and macro
parameters can be formed to pass arbitrary strings of text to a
specific macro for substitution during expansion.
.sp
.sh
megabyte: \c
.qs
Over one million bytes; 1024 kilobytes. See \c
.sh
byte, \c
.qs
and \c
.sh
kilobyte.
.sp
.sh
microprocessor: \c
.qs
Silicon chip that is the central processing unit (CPU) of the
microcomputer. The Intel 8080 and the Zilog Z80 are
microprocessors commonly used in CP/M systems.
.sp
.sh
MOVCPM image: \c
.qs
Memory image of the CP/M system created by MOVCPM. This image
can be saved as a disk file using the SAVE command or placed on
the system tracks using the SYSGEN command without specifying a
source drive. This image varies, depending on the presence of a
one-sector or two-sector boot. If the boot is less than 128
bytes (one sector), the boot begins at 0900H, the CP/M system at
0980H, and the BIOS at 1F80H. Otherwise, the boot is at 0900H,
the CP/M system at 1000H, and the BIOS at 2000H. In a CP/M 1.4
system with a one-sector boot, the addresses are the same as for
the CP/M 2 system--except that the BIOS begins at 1E80H instead
of 1F80H.
.mb 4
.fm 1
.sp
.sh
MP/M: \c
.qs
Multi-Programming Monitor control program. A microcomputer
operating system supporting multi-terminal access with multi-
programming at each terminal.
.sp
.sh
multi-programming: \c
.qs
The capability of initiating and executing more than one program
at a time. These programs, usually called processes, are time-shared,
each receiving a slice of CPU time on a round-robin
basis. See \c
.sh
concurrency.
.sp
.sh
nibble: \c
.qs
One half of a byte, usually the high-order or low-order 4 bits in
a byte.
.sp
.sh
OFF: \c
.qs
Two-byte parameter in the disk parameter block at DPB + 13 bytes.
This value specifies the number of reserved system tracks. The
disk directory begins in the first sector of track OFF.
.sp
.sh
OFS: \c
.qs
Diskdef macro library parameter specifying the number of reserved
system tracks. See \c
.sh
OFF.
.sp
.sh
operating system: \c
.qs
Collection of programs that supervises the execution of other
programs and the management of computer resources. An operating
system provides an orderly input/output environment between the
computer and its peripheral devices. It enables user-written
programs to execute safely. An operating system standardizes the
use of computer resources for the programs running under it.
.mb 6
.fm 2
.sp
.sh
option: \c
.qs
One of many parameters that can be part of a command tail. Use
options to specify additional conditions for a command's
execution.
.sp
.sh
output: \c
.qs
Data that is sent to the console, disk, or printer.
.sp
.sh
page: \c
.qs
256 consecutive bytes in memory beginning on a page boundary,
whose base address is a multiple of 256 (100H) bytes. In hex
notation, pages always begin at an address with a least
significant byte of zero.
.sp
.sh
page relocatable program: \c
.qs
See \c
.sh
PRL.
.sp
.sh
page zero: \c
.qs
Memory region between 0000H and 0100H used to hold critical
system parameters. Page zero functions primarily as an interface
region between user programs and the CP/M BDOS module. Note that
in non-standard systems this region is the base page of the
system and represents the first 256 bytes of memory used by the
CP/M system and user programs running under it.
.sp
.sh
parameter: \c
.qs
Value in the command tail that provides additional information
for the command. Technically, a parameter is a required element
of a command.
.sp
.sh
peripheral devices: \c
.qs
Devices external to the CPU. For example, terminals, printers,
and disk drives are common peripheral devices that are not part
of the processor but are used in conjunction with it.
.sp
.sh
physical: \c
.qs
Characteristic of computer components, generally hardware, that
actually exist. In programs, physical components can be
represented by logical components.
.sp
.sh
primary filename: \c
.qs
First 8 characters of a filename. The primary filename is a
unique name that helps the user identify the file contents. A
primary filename contains one to eight characters and can include any
letter or number and some special characters. The primary
filename follows the optional drive specification and precedes
the optional filetype.
.sp
.sh
PRL: \c
.qs
Page relocatable program. A page relocatable program is stored
on disk with a PRL filetype. Page relocatable programs are
easily relocated to any page boundary and thus are suitable for
execution in a nonbanked MP/M system.
.sp
.sh
program: \c
.qs
Series of coded instructions that performs specific tasks when
executed by a computer. A program can be written in a
processor-specific language or a high-level language that can be
implemented on a number of different processors.
.sp
.sh
prompt: \c
.qs
Any characters displayed on the video screen to help the user
decide what the next appropriate action is. A system prompt is a
special prompt displayed by the operating
system. The alphabetic character indicates the default drive. Some
applications programs have their own special prompts. See \c
.sh
CP/M prompt.
.qs
.sp
.mb 5
.fm 1
PUN:
Logical CP/M punch device. The punch device is an output-only
device accessed through the PUNCH entry point of the BIOS. In
certain implementations, PUN: can be a serial device such as a
modem.
.sp
PUNCH:
BIOS entry point to a routine that sends a character to the punch
device.
.sp
RDR:
Logical CP/M reader device. The reader device is an input-only
device accessed through the READER entry point in the BIOS.
See
PUN:.
.sp
READ:
Entry point in the BIOS to a routine that reads 128 bytes from
the currently selected drive, track, and sector into the current
DMA address.
.sp
READER:
Entry point to a routine in the BIOS that reads the next
character from the currently assigned reader device.
.sp
Read-Only (R/O):
Attribute that can be assigned to a disk file or a disk drive.
When assigned to a file, the Read-Only attribute allows you to
read from that file but not write to it. When assigned to a
drive, the Read-Only attribute allows you to read any file on the
disk, but prevents you from adding a new file, erasing or changing
a file, renaming a file, or writing on the disk. The STAT
command can set a file or a drive to Read-Only. Every file and
drive is either Read-Only or Read-Write. The default setting for
drives and files is Read-Write, but an error in resetting the
disk or changing media automatically sets the drive to Read-Only
until the error is corrected. See also \c
.sh
ROM.
.sp
.sh
Read-Write (R/W): \c
.qs
Attribute that can be assigned to a disk file or a disk drive.
The Read-Write attribute allows you to read from and write to a
specific Read-Write file or to any file on a disk that is in a
drive set to Read-Write. A file or drive can be set to either
Read-Only or Read-Write.
.sp
.sh
record: \c
.qs
Group of bytes in a file. A physical record consists of 128
bytes and is the basic unit of data transfer between the
operating system and the application program. A logical record
might vary in length and is used to represent a unit of
information. Two 64-byte employee records can be stored in one
128-byte physical record. Records are grouped together to form a
file.
.sp
.sh
recursive procedure: \c
.qs
Code that can call itself during execution.
.sp
.mb 6
.fm 2
.sh
reentrant procedure: \c
.qs
Code that can be called by one process while another is already
executing it. Thus, reentrant code can be shared between
different users. Reentrant procedures must not be self-
modifying; that is, they must be pure code and not contain data.
The data for reentrant procedures can be kept in a separate data
area or placed on the stack.
.sp
.sh
restart (RST): \c
.qs
One-byte call instruction usually used during interrupt sequences
and for debugger break pointing. There are eight restart
locations, RST 0 through RST 7, whose addresses are given by the
product of 8 times the restart number.
.sp
.sh
R/O: \c
.qs
See \c
.sh
Read-Only.
.sp
.sh
ROM: \c
.qs
Read-Only memory. This memory can be read but not written and so
is suitable for code and preinitialized data areas only.
.sp
.sh
RST: \c
.qs
See \c
.sh
restart.
.sp
.sh
R/W: \c
.qs
See \c
.sh
Read-Write.
.sp
.sh
sector: \c
.qs
In a CP/M system, a sector is always 128 consecutive bytes. A
sector is the basic unit of data read and written on the disk by
the BIOS. A sector can be one 128-byte record in a file or a
sector of the directory. The BDOS always requests a logical
sector number between 0 and (SPT-1). This is typically
translated into a physical sector by the BIOS entry point
SECTRAN. In some disk subsystems, the disk sector size is larger
than 128 bytes, usually a power of two, such as 256, 512, 1024, or
2048 bytes. These disk sectors are always referred to as host
sectors in CP/M documentation and should not be confused with
other references to sectors, in which cases the CP/M 128-byte
sectors should be assumed. When the host sector size is larger
than 128 bytes, host sectors must be buffered in memory and the
128-byte CP/M sectors must be blocked and deblocked from them.
This can be done by adding an additional module, the blocking and
deblocking algorithm, between the BIOS disk I/O routines and the
actual disk I/O.
.sp
.sh
sectors per track (SPT): \c
.qs
A two-byte parameter in the disk parameter block at DPB + 0. The
BDOS makes calls to the BIOS entry point SECTRAN with logical
sector numbers ranging between 0 and (SPT - 1) in register BC.
.sp
.sh
SECTRAN: \c
.qs
Entry point to a routine in the BIOS that performs
logical-to-physical sector translation for the BDOS.
.sp
.sh
SELDSK: \c
.qs
Entry point to a routine in the BIOS that sets the currently
selected drive.
.sp
.sh
SETDMA: \c
.qs
Entry point to a routine in the BIOS that sets the currently
selected DMA address. The DMA address is the address of a
128-byte buffer region in memory that is used to transfer data to
and from the disk in subsequent reads and writes.
.sp
.sh
SETSEC: \c
.qs
Entry point to a routine in the BIOS that sets the currently
selected sector.
.sp
.sh
SETTRK: \c
.qs
Entry point to a routine in the BIOS that sets the currently
selected track.
.sp
.sh
skew factor: \c
.qs
Factor that defines the logical-to-physical sector number
translation in XLT. Logical sector numbers are used by the BDOS
and range between 0 and (SPT - 1). Data is written in
consecutive logical 128-byte sectors grouped in data blocks. The
number of sectors per block is given by BLS/128. Physical
sectors on the disk media are also numbered consecutively. If
the physical sector size is also 128 bytes, a one-to-one
relationship exists between logical and physical sectors. The
logical-to-physical translation table (XLT) maps this
relationship, and a skew factor is typically used in generating
the table entries. For instance, if the skew factor is 6, XLT
will be:
.sp
.nf
.in 8
Logical: 0 1 2 3 4 5 6 ... 25
Physical: 1 7 13 19 25 5 11 ... 22
.fi
.in 0
.sp
The skew factor allows time for program processing without
missing the next sector. Otherwise, the system must wait for an
entire disk revolution before reading the next logical sector.
The skew factor can be varied, depending on hardware speed and
application processing overhead. Note that no sector translation
is done when the physical sectors are larger than 128 bytes, as
sector deblocking is done in this case. See also \c
.sh
sector, SKF, \c
.qs
and \c
.sh
XLT.
.sp
.sh
SKF: \c
.qs
A diskdef macro library parameter specifying the skew factor to
be used in building XLT. If SKF is zero, no translation table is
generated and the XLT byte in the DPH will be 0000H.
.sp
.sh
software: \c
.qs
Programs that contain machine-readable instructions, as opposed
to hardware, which is the actual physical components of a
computer.
.sp
.sh
source file: \c
.qs
ASCII text file usually created with an editor that is an input
file to a system program, such as a language translator or text
formatter.
.sp
.sh
SP: \c
.qs
Stack pointer. See \c
.sh
stack.
.bp
.sh
spooling: \c
.qs
Process of accumulating printer output in a file while the
printer is busy. The file is printed when the printer becomes
free; a program does not have to wait for the slow printing
process.
.sp
.sh
SPT: \c
.qs
See \c
.sh
sectors per track.
.sp
.sh
stack: \c
.qs
Reserved area of memory where the processor saves the return
address when a call instruction is received. When a return
instruction is encountered, the processor restores the current
address on the stack to the program counter. Data such as the
contents of the registers can also be saved on the stack. The
push instruction places data on the stack and the pop instruction
removes it. An item is pushed onto the stack by decrementing the
stack pointer (SP) by 2 and writing the item at the SP address.
In other words, the stack grows downward in memory.
.sp
.sh
syntax: \c
.qs
Format for entering a given command.
.sp
.sh
SYS: \c
.qs
See \c
.sh
system attribute.
.sp
.sh
SYSGEN image: \c
.qs
Memory image of the CP/M system created by SYSGEN when a
destination drive is not specified. This is the same as the
MOVCPM image that can be read by SYSGEN if a source drive is
not specified. See \c
.sh
MOVCPM image.
.sp
.sh
system attribute (SYS): \c
.qs
File attribute. You can give a file the system attribute by
using the SYS option in the STAT command or by using the set file
attributes function, BDOS Function 12. A file with the SYS
attribute is not displayed in response to a DIR command. If you
give a file with user number 0 the SYS attribute, you can read
and execute that file from any user number on the same drive.
Use this feature to make your commonly used programs available
under any user number.
.sp
system prompt:
Symbol displayed by the operating system indicating that the
system is ready to receive input.
See prompt and CP/M prompt.
.sp
.sh
system tracks: \c
.qs
Tracks reserved on the disk for the CP/M system. The number of
system tracks is specified by the parameter OFF in the disk
parameter block (DPB). The system tracks for a drive always
precede its data tracks. The command SYSGEN copies the CP/M
system from the system tracks to memory, and vice versa. The
standard SYSGEN utility copies 26 sectors from track 0 and 26
sectors from track 1. When the system tracks contain additional
sectors or tracks to be copied, a customized SYSGEN must be used.
.sp
.sh
terminal: \c
.qs
See \c
.sh
console.
.sp
.sh
TPA: \c
.qs
Transient Program Area. Area in memory where user programs run
and store data. This area is a region of memory beginning at
0100H and extending to the base of the CP/M system in high
memory. The first module of the CP/M system is the CCP, which
can be overwritten by a user program. If so, the TPA is extended
to the base of the CP/M BDOS module. If the CCP is overwritten,
the user program must terminate with either a system reset
(Function 0) call or a jump to location zero in page zero. The
address of the base of the CP/M BDOS is stored in location 0006H
in page zero least significant byte first.
.sp
.sh
track: \c
.qs
Data on the disk media is accessed by combination of track and
sector numbers. Tracks form concentric rings on the disk; the
standard IBM single-density disks have 77 tracks. Each track
consists of a fixed number of numbered sectors. Tracks are
numbered from zero to one less than the number of tracks on the
disk.
.sp
.sh
Transient Program Area: \c
.qs
See \c
.sh
TPA.
.sp
.sh
upward compatible: \c
.qs
Term meaning that a program created for the previously released
operating system, or compiler, runs under the newly released
version of the same operating system.
.sp
.sh
USER: \c
.qs
Term used in CP/M and MP/M systems to distinguish distinct
regions of the directory.
.sp
.sh
user number: \c
.qs
Number assigned to files in the disk directory so that different
users need only deal with their own files and have their own
directories, even though they are all working from the same disk.
In CP/M, files can be divided into 16 user groups.
.sp
.sh
utility: \c
.qs
Tool. Program that enables the user to perform certain
operations, such as copying files, erasing files, and editing
files. The utilities are created for the convenience of
programmers and users.
.sp
.sh
vector: \c
.qs
Location in memory. An entry point into the operating system
used for making system calls or interrupt handling.
.sp
.sh
warm start: \c
.qs
Program termination by a jump to the warm start vector at
location 0000H, a system reset (BDOS Function 0), or a CTRL-C
typed at the keyboard. A warm start reinitializes the disk
subsystem and returns control to the CP/M operating system at the
CCP level. The warm start vector is simply a jump to the WBOOT
entry point in the BIOS.
.sp
.sh
WBOOT: \c
.qs
Entry point to a routine in the BIOS used when a warm start
occurs. A warm start is performed when a user program branches
to location 0000H, when the CPU is reset from the front panel, or
when the user types CTRL-C. The CCP and BDOS are reloaded from
the system tracks of drive A.
.sp
.sh
wildcard characters: \c
.qs
Special characters that match certain specified items. In CP/M
there are two wildcard characters: ? and *. The ? can be
substituted for any single character in a filename, and the * can
be substituted for the primary filename, the filetype, or both.
By placing wildcard characters in filenames, the user creates an
ambiguous filename and can quickly reference one or more files.
.bp
.sh
word: \c
.qs
16-bit or two-byte value, such as an address value. Although the
Intel 8080 is an 8-bit CPU, addresses occupy two bytes and are
called word values.
.sp
.sh
WRITE: \c
.qs
Entry point to a routine in the BIOS that writes the record at
the currently selected DMA address to the currently selected
drive, track, and sector.
.sp
.sh
XLT: \c
.qs
Logical-to-physical sector translation table located in the BIOS.
SECTRAN uses XLT to perform logical-to-physical sector number
translation. XLT also refers to the two-byte address in the disk
parameter header at DPBASE + 0. If this parameter is zero, no
sector translation takes place. Otherwise this parameter is the
address of the translation table.
.sp
.sh
ZERO PAGE: \c
.qs
See \c
.sh
page zero.
.qs
.sp 2
.ce
End of Appendix H
.nx appi


939
Source/Doc/CPM 22 Manual/appi.tex

@ -1,939 +0,0 @@
.bp 1
.op
.cs 5
.mt 5
.mb 6
.pl 66
.ll 65
.po 10
.hm 2
.fm 2
.he
.ft I-%
.pc 1
.tc I CP/M Error Messages
.ce 2
.sh
Appendix I
.sp
.sh
CP/M Error Messages
.qs
.he CP/M Operating System Manual I CP/M Error Messages
.sp 2
.pp
Messages come from several different sources. CP/M displays
error messages when there are errors in calls to the Basic Disk
Operating System (BDOS). CP/M also displays messages when there
are errors in command lines. Each utility supplied with CP/M has
its own set of messages. The following lists CP/M messages and
utility messages. One might see messages other than those listed
here if one is running an application program. Check the
application program's documentation for explanations of those
messages.
.sp 2
.sh
Table I-1. CP/M Error Messages
.sp
.ll 60
.nf
Message Meaning
.sp
.fi
.in 20
.ti -15
?
.sp
DDT. This message has four possible meanings:
.sp
.in 23
.ti -2
o DDT does not understand the assembly language instruction.
.ti -2
o The file cannot be opened.
.ti -2
o A checksum error occurred in a HEX file.
.ti -2
o The assembler/disassembler was overlayed.
.sp 2
.in 20
.ti -15
ABORTED
.sp
PIP. You stopped a PIP operation by pressing a key.
.sp 2
.ti -15
ASM Error Messages
.sp
.in 24
.ti -4
D Data error: data statement element cannot be placed in
specified data area.
.sp
.ti -4
E Expression error: expression cannot be evaluated during
assembly.
.sp
.ti -4
L Label error: label cannot appear in this context (might be
duplicate label).
.in 0
.bp
.sh
Table I-1. (continued)
.sp
.nf
Message Meaning
.sp
ASM Error Messages (continued)
.fi
.sp
.in 24
.ti -4
N Not implemented: unimplemented features, such as macros, are
trapped.
.sp
.ti -4
O Overflow: expression is too complex to evaluate.
.sp
.ti -4
P Phase error: label value changes on two passes through
assembly.
.sp
.ti -4
R Register error: the value specified as a register is
incompatible with the code.
.sp
.ti -4
S Syntax error: improperly formed expression.
.sp
.ti -4
U Undefined label: label used does not exist.
.sp
.ti -4
V Value error: improperly formed operand encountered in an
expression.
.sp 2
.in 20
.ti -15
BAD DELIMITER
.sp
STAT. Check command line for typing errors.
.sp 2
.ti -15
Bad Load
.sp
CCP error message, or SAVE error message.
.sp 2
.ti -15
Bdos Err On d:
.sp
Basic Disk Operating System error on the designated drive: CP/M
replaces d: with the drive specification of the drive where the
error occurred. This message is followed by one of the four
phrases in the situations described below.
.in 0
.bp
.sh
Table I-1. (continued)
.sp
.nf
Message Meaning
.fi
.sp
.in 20
.ti -15
Bdos Err On d: Bad Sector
.sp
This message appears when CP/M finds no disk in the drive, when
the disk is improperly formatted, when the drive latch is open,
or when power to the drive is off. Check for one of these
situations and try again. This could also indicate a hardware
problem or a worn or improperly formatted disk. Press ^C to
terminate the program and return to CP/M, or press RETURN
to ignore the error.
.sp 2
.ti -15
Bdos Err On d: File R/O
.sp
You tried to erase, rename, or set file attributes on a Read-Only
file. The file should first be set to Read-Write (R/W) with the
command: STAT filespec $R/W.
.sp 2
.ti -15
Bdos Err On d: R/O
.sp
Drive has been assigned Read-Only status with a STAT command, or
the disk in the drive has been changed without being initialized
with a ^C. CP/M terminates the current program as soon as you
press any key.
.sp 2
.ti -15
Bdos Err on d: Select
.sp
CP/M received a command line specifying a nonexistent drive.
CP/M terminates the current program as soon as you press any key.
Press RETURN or CTRL-C to recover.
.sp 2
.ti -15
Break "x" at c
.sp
ED. "x" is one of the symbols described below and c is the
command letter being executed when the error occurred.
.sp
.in 24
.ti -4
# Search failure. ED cannot find the string specified in an F,
S, or N command.
.in 0
.bp
.sh
Table I-1. (continued)
.sp
.nf
Message Meaning
.fi
.sp
.in 24
.ti -4
? Unrecognized command letter c. ED does not recognize the
indicated command letter, or an E, H, Q, or O command is not
alone on its command line.
.sp
.ti -4
O The file specified in an R command cannot be found.
.sp
.ti -4
> Buffer full. ED cannot put any more characters in the memory
buffer, or the string specified in an F, N, or S command is too
long.
.sp
.ti -4
E Command aborted. A keystroke at the console aborted command
execution.
.sp
Break "x" at c (continued)
.sp
.ti -4
F Disk or directory full. This error is followed by either the
disk or directory full message. Refer to the recovery procedures
listed under these messages.
.sp 2
.in 20
.ti -15
CANNOT CLOSE DESTINATION FILE--{filespec}
.sp
PIP. An output file cannot be closed. You should take
appropriate action after checking to see if the correct disk is
in the drive and that the disk is not write-protected.
.sp 2
.nf
.in 5
Cannot close, R/O
CANNOT CLOSE FILES
.fi
.in 20
.sp
CP/M cannot write to the file. This usually occurs because the
disk is write-protected.
.sp
ASM. An output file cannot be closed. This is a fatal error
that terminates ASM execution. Check to see that the disk is in
the drive, and that the disk is not write-protected.
.in 0
.bp
.sh
Table I-1. (continued)
.sp
.nf
Message Meaning
.fi
.sp
.in 20
DDT. The disk file written by a W command cannot be closed.
This is a fatal error that terminates DDT execution. Check if
the correct disk is in the drive and that the disk is not write-protected.
.sp
SUBMIT. This error can occur during SUBMIT file processing.
Check if the correct system disk is in the A drive and that the
disk is not write-protected. The SUBMIT job can be restarted
after rebooting CP/M.
.sp 2
.ti -15
CANNOT READ
.sp
PIP. PIP cannot read the specified source. Reader cannot be
implemented.
.sp 2
.ti -15
CANNOT WRITE
.sp
PIP. The destination specified in the PIP command is illegal.
You probably specified an input device as a destination.
.sp 2
.ti -15
Checksum error
.sp
PIP. A HEX record checksum error was encountered. The HEX
record that produced the error must be corrected, probably by
recreating the HEX file.
.sp 2
.nf
.in 5
CHECKSUM ERROR
LOAD ADDRESS hhhh
ERROR ADDRESS hhhh
BYTES READ:
hhhh:
.fi
.in 20
.sp
LOAD. File contains incorrect data. Regenerate HEX file from
the source.
.sp 2
.ti -15
Command Buffer Overflow
.sp
SUBMIT. The SUBMIT buffer allows up to 2048 characters in the
input file.
.in 0
.bp
.sh
Table I-1. (continued)
.sp
.nf
Message Meaning
.fi
.sp
.in 20
.ti -15
Command too long
.sp
SUBMIT. A command in the SUBMIT file cannot exceed 125
characters.
.sp 2
.ti -15
CORRECT ERROR, TYPE RETURN OR CTRL-Z
.sp
PIP. A HEX record checksum was encountered during the transfer
of a HEX file. The HEX file with the checksum error should be
corrected, probably by recreating the HEX file.
.sp 2
.ti -15
DESTINATION IS R/O, DELETE (Y/N)?
.sp
PIP. The destination file specified in a PIP command already
exists and it is Read-Only. If you type Y, the destination file
is deleted before the file copy is done.
.sp 2
.ti -15
Directory full
.sp
ED. There is not enough directory space for the file being
written to the destination disk. You can use the OXfilespec
command to erase any unnecessary files on the disk without
leaving the editor.
.sp
SUBMIT. There is not enough directory space to write the $$$.SUB
file used for processing SUBMITs. Erase some files or select a
new disk and retry.
.sp 2
.ti -15
Disk full
.sp
ED. There is not enough disk space for the output file. This
error can occur on the W, E, H, or X commands. If it occurs with
X command, you can repeat the command prefixing the filename with
a different drive.
.in 0
.bp
.sh
Table I-1. (continued)
.sp
.nf
Message Meaning
.fi
.sp
.in 20
.ti -15
DISK READ ERROR--{filespec}
.sp
PIP. The input disk file specified in a PIP command cannot be
read properly. This is usually the result of an unexpected end-of-file.
Correct the problem in your file.
.sp 2
.ti -15
DISK WRITE ERROR--{filespec}
.sp
DDT. A disk write operation cannot be successfully performed
during a W command, probably due to a full disk. You should
either erase some unnecessary files or get another disk with more
space.
.sp
PIP. A disk write operation cannot be successfully performed
during a PIP command, probably due to a full disk. You should
either erase some unnecessary files or get another disk with more
space and execute PIP again.
.sp
SUBMIT. The SUBMIT program cannot write the $$$.SUB file to the
disk. Erase some files, or select a new disk and try again.
.sp 2
.ti -15
ERROR: BAD PARAMETER
.sp
PIP. You entered an illegal parameter in a PIP command. Retype
the entry correctly.
.sp 2
.ti -15
ERROR: CANNOT OPEN SOURCE, LOAD ADDRESS hhhh
.sp
LOAD. Displayed if LOAD cannot find the specified file or if no
filename is specified.
.sp 2
.ti -15
ERROR: CANNOT CLOSE FILE, LOAD ADDRESS hhhh
.sp
LOAD. Caused by an error code returned by a BDOS function call.
Disk might be write-protected.
.in 0
.bp
.sh
Table I-1. (continued)
.sp
.nf
Message Meaning
.fi
.sp
.in 20
.ti -15
ERROR: CANNOT OPEN SOURCE, LOAD ADDRESS hhhh
.sp
LOAD. Cannot find source file. Check disk directory.
.sp 2
.ti -15
ERROR: DISK READ, LOAD ADDRESS hhhh
.sp
LOAD. Caused by an error code returned by a BDOS function call.
.sp 2
.ti -15
ERROR: DISK WRITE, LOAD ADDRESS hhhh
.sp
LOAD. Destination disk is full.
.sp 2
.ti -15
ERROR: INVERTED LOAD ADDRESS, LOAD ADDRESS hhhh
.sp
LOAD. The address of a record was too far from the address of
the previously-processed record. This is an internal limitation
of LOAD, but it can be circumvented. Use DDT to read the HEX
file into memory, then use a SAVE command to store the memory
image file on disk.
.sp 2
.ti -15
ERROR: NO MORE DIRECTORY SPACE, LOAD ADDRESS hhhh
.sp
LOAD. Disk directory is full.
.sp 2
.ti -15
Error on line nnn message
.sp
SUBMIT. The SUBMIT program displays its messages in the format
shown above, where nnn represents the line number of the SUBMIT
file. Refer to the message following the line number.
.sp 2
.ti -15
FILE ERROR
.sp
ED. Disk or directory is full, and ED cannot write anything more
on the disk. This is a fatal error, so make sure there is enough
space on the disk to hold a second copy of the file before
invoking ED.
.in 0
.bp
.sh
Table I-1. (continued)
.sp
.nf
Message Meaning
.fi
.sp
.in 20
.ti -15
FILE EXISTS
.sp
You have asked CP/M to create or rename a file using a file
specification that is already assigned to another file. Either
delete the existing file or use another file specification.
.sp
REN. The new name specified is the name of a file that already
exists. You cannot rename a file with the name of an existing
file. If you want to replace an existing file with a newer
version of the same file, either rename or erase the existing
file, or use the PIP utility.
.sp 2
.ti -15
File exists, erase it
.sp
ED. The destination filename already exists when you are placing
the destination file on a different disk than the source. It
should be erased or another disk selected to receive the output
file.
.sp 2
.ti -15
** FILE IS READ/ONLY **
.sp
ED. The file specified in the command to invoke ED has the
Read-Only attribute. Ed can read the file so that the user can
examine it, but ED cannot change a Read-Only file.
.sp 2
.mb 4
.fm 1
.ti -15
File Not Found
.sp
CP/M cannot find the specified file. Check that you have entered
the correct drive specification or that you have the correct disk
in the drive.
.sp
ED. ED cannot find the specified file. Check that you have
entered the correct drive specification or that you have the
correct disk in the drive.
.sp
STAT. STAT cannot find the specified file. The message might
appear if you omit the drive specification. Check to see if the
correct disk is in the drive.
.in 0
.bp
.sh
Table I-1. (continued)
.sp
.nf
Message Meaning
.fi
.sp
.in 20
.ti -15
FILE NOT FOUND--{filespec}
.sp
.mb 6
.fm 2
PIP. An input file that you have specified does not exist.
.sp 2
.ti -15
Filename required
.sp
ED. You typed the ED command without a filename. Reenter the ED
command followed by the name of the file you want to edit or
create.
.sp 2
.ti -15
hhhh??=dd
.sp
DDT. The ?? indicates DDT does not know how to represent the
hexadecimal value dd encountered at address hhhh in 8080 assembly
language. dd is not an 8080 machine instruction opcode.
.sp 2
.ti -15
Insufficient memory
.sp
DDT. There is not enough memory to load the file specified in an
R or E command.
.sp 2
.ti -15
Invalid Assignment
.sp
STAT. You specified an invalid drive or file assignment, or
misspelled a device name. This error message might be followed
by a list of the valid file assignments that can follow a
filename. If an invalid drive assignment was attempted the
message Use: d:=RO is displayed, showing the proper syntax for
drive assignments.
.in 0
.bp
.sh
Table I-1. (continued)
.sp
.nf
Message Meaning
.fi
.sp
.in 20
.ti -15
Invalid control character
.sp
SUBMIT. The only valid control characters in the SUBMIT files of
the type SUB are ^ A through ^ Z. Note that in a SUBMIT file the
control character is represented by typing the circumflex, ^, not
by pressing the control key.
.sp 2
.ti -15
INVALID DIGIT--{filespec}
.sp
PIP. An invalid HEX digit has been encountered while reading a
HEX file. The HEX file with the invalid HEX digit should be
corrected, probably by recreating the HEX file.
.sp 2
.ti -15
Invalid Disk Assignment
.sp
STAT. Might appear if you follow the drive specification with
anything except =R/O.
.sp 2
.ti -15
INVALID DISK SELECT
.sp
CP/M received a command line specifying a nonexistent drive, or
the disk in the drive is improperly formatted. CP/M terminates
the current program as soon as you press any key.
.sp 2
.ti -15
INVALID DRIVE NAME (Use A, B, C, or D)
.sp
SYSGEN. SYSGEN recognizes only drives A, B, C, and D as valid
destinations for system generation.
.sp 2
.ti -15
Invalid File Indicator
.sp
STAT. Appears if you do not specify RO, RW, DIR, or SYS.
.in 0
.bp
.sh
Table I-1. (continued)
.sp
.nf
Message Meaning
.fi
.sp
.in 20
.ti -15
INVALID FORMAT
.sp
PIP. The format of your PIP command is illegal. See the
description of the PIP command.
.sp 2
.nf
.in 5
INVALID HEX DIGIT
LOAD ADDRESS hhhh
ERROR ADDRESS hhhh
BYTES READ:
hhhh
.fi
.in 20
.sp
LOAD. File contains incorrect HEX digit.
.sp 2
.ti -15
INVALID MEMORY SIZE
.sp
MOVCPM. Specify a value less than 64K or your computer's actual
memory size.
.sp 2
.ti -15
INVALID SEPARATOR
.sp
PIP. You have placed an invalid character for a separator
between two input filenames.
.sp 2
.ti -15
INVALID USER NUMBER
.sp
PIP. You have specified a user number greater than 15. User
numbers are in the range 0 to 15.
.sp 2
.ti -15
n?
.sp
USER. You specified a number greater than fifteen for a user
area number. For example, if you type USER 18<cr>, the screen
displays 18?.
.in 0
.bp
.sh
Table I-1. (continued)
.sp
.nf
Message Meaning
.fi
.sp
.in 20
.ti -15
NO DIRECTORY SPACE
.sp
ASM. The disk directory is full. Erase some files to make room
for PRN and HEX files. The directory can usually hold only 64
filenames.
.sp 2
.ti -15
NO DIRECTORY SPACE--{filespec}
.sp
PIP. There is not enough directory space for the output file.
You should either erase some unnecessary files or get another
disk with more directory space and execute PIP again.
.sp 2
.ti -15
NO FILE--{filespec}
.sp
DIR, ERA, REN, PIP. CP/M cannot find the specified file, or no
files exist.
.sp
ASM. The indicated source or include file cannot be found on the
indicated drive.
.sp
DDT. The file specified in an R or E command cannot be found on
the disk.
.sp 2
.ti -15
NO INPUT FILE PRESENT ON DISK
.sp
DUMP. The file you requested does not exist.
.sp 2
.ti -15
No memory
.sp
There is not enough (buffer?) memory available for loading the
program specified.
.sp 2
.ti -15
NO SOURCE FILE ON DISK
.sp
SYSGEN. SYSGEN cannot find CP/M either in CPMxx.com form or on
the system tracks of the source disk.
.in 0
.bp
.sh
Table I-1. (continued)
.sp
.nf
Message Meaning
.fi
.sp
.in 20
.ti -15
NO SOURCE FILE PRESENT
.sp
ASM. The assembler cannot find the file you specified. Either
you mistyped the file specification in your command line, or the
filetype is not ASM.
.sp 2
.ti -15
NO SPACE
.sp
SAVE. Too many files are already on the disk, or no room is left
on the disk to save the information.
.sp 2
.ti -15
No SUB file present
.sp
SUBMIT. For SUBMIT to operate properly, you must create a file
with filetype of SUB. The SUB file contains usual CP/M commands.
Use one command per line.
.sp 2
.ti -15
NOT A CHARACTER SOURCE
.sp
PIP. The source specified in your PIP command is illegal. You
have probably specified an output device as a source.
.sp 2
.ti -15
** NOT DELETED **
.sp
PIP. PIP did not delete the file, which might have had the R/O
attribute.
.sp 2
.ti -15
NOT FOUND
.sp
PIP. PIP cannot find the specified file.
.sp 2
.ti -15
OUTPUT FILE WRITE ERROR
.sp
ASM. You specified a write-protected disk as the destination for
the PRN and HEX files, or the disk has no space left. Correct
the problem before assembling your program.
.in 0
.bp
.sh
Table I-1. (continued)
.sp
.nf
Message Meaning
.fi
.sp
.in 20
.ti -15
Parameter error
.sp
SUBMIT. Within the SUBMIT file of type sub, valid parameters are
$0 through $9.
.sp 2
.ti -15
PARAMETER ERROR, TYPE RETURN TO IGNORE
.sp
SYSGEN. If you press RETURN, SYSGEN proceeds without processing
the invalid parameter.
.sp 2
.ti -15
QUIT NOT FOUND
.sp
PIP. The string argument to a Q parameter was not found in your
input file.
.sp 2
.ti -15
Read error
.sp
TYPE. An error occurred when reading the file specified in the
type command. Check the disk and try again. The STAT filespec
command can diagnose trouble.
.sp 2
.ti -15
READER STOPPING
.sp
PIP. Reader operation interrupted.
.sp 2
.ti -15
Record Too Long
.sp
PIP. PIP cannot process a record longer than 128 bytes.
.sp 2
.ti -15
Requires CP/M 2.0 or later
.sp
XSUB. XSUB requires the facilities of CP/M 2.0 or newer version.
.in 0
.bp
.sh
Table I-1. (continued)
.sp
.nf
Message Meaning
.fi
.sp
.in 20
.ti -15
Requires CP/M 2.0 or new for operation
.sp
PIP. This version of PIP requires the facilities of CP/M 2.0 or
newer version.
.sp 2
.ti -15
START NOT FOUND
.sp
PIP. The string argument to an S parameter cannot be found in
the source file.
.sp 2
.ti -15
SOURCE FILE INCOMPLETE
.sp
SYSGEN. SYSGEN cannot use your CP/M source file.
.sp 2
.ti -15
SOURCE FILE NAME ERROR
.sp
ASM. When you assemble a file, you cannot use the wildcard
characters * and ? in the filename. Only one file can be
assembled at a time.
.sp 2
.ti -15
SOURCE FILE READ ERROR
.sp
ASM. The assembler cannot understand the information in the file
containing the assembly-language program. Portions of another
file might have been written over your assembly-language file, or
information was not properly saved on the disk. Use the TYPE
command to locate the error. Assembly-language files contain the
letters, symbols, and numbers that appear on your keyboard. If
your screen displays unrecognizable output or behaves strangely,
you have found where computer instructions have crept into your
file.
.sp 2
.ti -15
SYNCHRONIZATION ERROR
.sp
MOVCPM. The MOVCPM utility is being used with the wrong CP/M
system.
.in 0
.bp
.sh
Table I-1. (continued)
.sp
.nf
Message Meaning
.fi
.sp
.in 20
.ti -15
"SYSTEM" FILE NOT ACCESSIBLE
.sp
You tried to access a file set to SYS with the STAT command.
.sp 2
.ti -15
** TOO MANY FILES **
.sp
STAT. There is not enough memory for STAT to sort the files
specified, or more than 512 files were specified.
.sp 2
.ti -15
UNEXPECTED END OF HEX FILE--{filespec}
.sp
PIP. An end-of-file was encountered prior to a termination HEX
record. The HEX file without a termination record should be
corrected, probably by recreating the HEX file.
.sp 2
.ti -15
Unrecognized Destination
.sp
PIP. Check command line for valid destination.
.sp 2
.ti -15
Use: STAT d:=RO
.sp
STAT. An invalid STAT drive command was given. The only valid
drive assignment in STAT is STAT d:=RO.
.sp 2
.ti -15
VERIFY ERROR:--{filespec}
.sp
PIP. When copying with the V option, PIP found a difference when
rereading the data just written and comparing it to the data in
its memory buffer. Usually this indicates a failure of either
the destination disk or drive.
.sp 2
.ti -15
WRONG CP/M VERSION (REQUIRES 2.0)
.sp 2
.ti -15
XSUB ACTIVE
.sp
SUBMIT. XSUB has been invoked.
.in 0
.bp
.sh
Table I-1. (continued)
.sp
.nf
Message Meaning
.fi
.sp
.in 20
.ti -15
XSUB ALREADY PRESENT
.sp
SUBMIT. XSUB is already active in memory.
.sp
.ti -15
Your input?
.sp
If CP/M cannot find the command you specified, it returns the
command name you entered followed by a question mark. Check that
you have typed the command line correctly, or that the command
you requested exists as a .COM file on the default or specified
disk.
.in 0
.ll 65
.sp 2
.ce
End of Appendix I


BIN
Source/Doc/CPM 22 Manual/cpm22tex.zip

Binary file not shown.

671
Source/Doc/CPM 22 Manual/fivea.tex

@ -1,671 +0,0 @@
.bp 1
.op
.cs 5
.mt 5
.mb 6
.pl 66
.ll 65
.po 10
.hm 2
.fm 2
.he
.ft 5-%
.pc 1
.ce
.sh
Section 5
.qs
.sp
.ce
.sh
CP/M 2 System Interface
.qs
.tc 5 CP/M 2 System Interface
.sp 2
.he CP/M Operating System Manual 5.1 Introduction
.tc 5.1 Introduction
5.1 Introduction
.fi
.pp 5
This chapter describes CP/M (release 2) system organization including the
structure of memory and system entry points. This section provides
the information you need to write programs that operate under CP/M and
that use the peripheral and disk I/O facilities of the system.
.pp
CP/M is logically divided into four parts, called the Basic Input/Output
System (BIOS), the Basic Disk Operating System (BDOS), the Console Command
Processor (CCP), and the Transient Program Area (TPA). The BIOS is a
hardware-dependent module that defines the exact low level interface with a
particular computer system that is necessary for peripheral device I/O.
Although a standard BIOS is supplied by Digital Research, explicit
instructions are provided for field reconfiguration of the BIOS to match
nearly any hardware environment, see Section 6.
.pp
The BIOS and BDOS are
logically combined into a single module with a common entry point and
referred to as the FDOS. The CCP is a distinct program that uses the FDOS to
provide a human-oriented interface with the information that is cataloged on
the back-up storage device. The TPA is an area of memory,
not used by the FDOS and CCP, where various nonresident operating
system commands and user programs are executed. The lower portion of memory
is reserved for system information and is detailed in later sections. Memory
organization of the CP/M system is shown in Figure 5-1.
.sp 3
.nf
High
Memory FDOS (BDOS+BIOS)
FBASE:
CCP
CBASE:
TPA
TBASE:
System Parameters
BOOT:
.sp 2
.ce
.sh
Figure 5-1. CP/M Memory Organization
.qs
.fi
.sp 2
.pp
The exact memory addresses corresponding to BOOT, TBASE, CBASE, and FBASE
vary from version to version and are described fully in Section 6. All
standard CP/M versions assume BOOT=0000H, which is the base of
random access memory. The machine code found at location BOOT performs a
system warm start, which loads and initializes the programs and variables
necessary to return control to the CCP. Thus, transient programs need only
jump to location BOOT to return control to CP/M at the command level.
Further, the standard versions assume TBASE=BOOT+0100H, which is normally
location 0100H. The principal entry point to the FDOS is at location
BOOT+0005H (normally 0005H) where a jump to FBASE is found. The address
field at BOOT+0006H (normally 0006H) contains the value of FBASE and can be
used to determine the size of available memory, assuming that the CCP is
being overlaid by a transient program.
.pp
Transient programs are loaded into the TPA and executed as follows. The
operator communicates with the CCP by typing command lines following each
prompt. Each command line takes one of the following forms:
.sp
.nf
.in 8
command
command file1
command file1 file2
.fi
.in 0
.sp
where command is either a built-in function, such as DIR or TYPE, or the name
of a transient command or program. If the command is a built-in function of
CP/M, it is executed immediately. Otherwise, the CCP searches the currently
addressed disk for a file by the name
.sp
.ti 8
command.COM
.pp
If the file is found, it is assumed to be a memory image of a program that
executes in the TPA and thus implicity originates at TBASE in memory. The
CCP loads the COM file from the disk into memory starting at TBASE and can
extend up to CBASE.
.pp
If the command is followed by one or two file specifications, the CCP prepares
one or two File Control Block (FCB) names in the system
parameter area. These optional FCBs are in the form necessary to
access files through the FDOS and are described in Section 5.2.
.pp
The transient program receives control from the CCP and begins
execution, using the I/O facilities of the FDOS. The transient
program is called from the CCP. Thus, it can simply return to the CCP upon
completion of its processing, or can jump to BOOT to pass control back to
CP/M. In the first case, the transient program must not use memory above
CBASE, while in the latter case, memory up through FBASE-1 can be used.
.pp
The transient program can use the CP/M I/O facilities to communicate with the
operator's console and peripheral devices, including the disk subsystem. The
I/O system is accessed by passing a function number and an information address
to CP/M through the FDOS entry point at BOOT+0005H. In the case of a disk
read, for example, the transient program sends the number corresponding to a
disk read, along with the address of an FCB to the CP/M FDOS. The FDOS, in
turn, performs the operation and returns with either a disk read completion
indication or an error number indicating that the disk read was unsuccessful.
.sp 2
.tc 5.2 Operating System Call Conventions
.he CP/M Operating System Manual 5.2 Call Conventions
.sh
5.2 Operating System Call Conventions
.qs
.pp
This section provides detailed information for performing direct operating
system calls from user programs. Many of the functions listed below, however,
are accessed more simply through the I/O macro library provided with the
MAC macro assembler and listed in the Digital Research manual
entitled, \c
.ul
Programmer's Utilities Guide for the CP/M Family of Operating Systems.
.qu
.pp
CP/M facilities that are available for access by transient programs fall into
two general categories: simple device I/O and disk file I/O. The simple
device operations are
.sp
.nf
.in 5
.ti -2
o read a console character
.ti -2
o write a console character
.ti -2
o read a sequential character
.ti -2
o write a sequential character
.ti -2
o get or set I/O status
.ti -2
o print console buffer
.ti -2
o interrogate console ready
.sp
The following FDOS operations perform disk I/O:
.sp
.ti -2
o disk system reset
.ti -2
o drive selection
.ti -2
o file creation
.ti -2
o file close
.ti -2
o directory search
.ti -2
o file delete
.ti -2
o file rename
.ti -2
o random or sequential read
.ti -2
o random or sequential write
.ti -2
o interrogate available disks
.ti -2
o interrogate selected disk
.ti -2
o set DMA address
.ti -2
o set/reset file indicators.
.fi
.in 0
.pp
As mentioned above, access to the FDOS functions is accomplished by passing
a function number and information address through the primary point at
location BOOT+0005H. In general, the function number is passed in register C
with the information address in the double byte pair DE. Single byte values
are returned in register A, with double byte values returned in HL, a zero
value is returned when the function number is out of range. For reasons of
compatibility, register A = L and register B = H upon return in all cases.
Note that the register passing conventions of CP/M agree with
those of the Intel PL/M systems programming language. CP/M functions and
their numbers are listed below.
.bp
.nf
.in 5
O System Reset 19 Delete File
1 Console Input 20 Read Sequential
2 Console Output 21 Write Sequential
3 Reader Input 22 Make File
4 Punch Output 23 Rename File
5 List Output 24 Return Login Vector
6 Direct Console I/O 25 Return Current Disk
7 Get I/O Byte 26 Set DMA Address
8 Set I/O Byte 27 Get Addr(Alloc)
9 Print String 28 Write Protect Disk
10 Read Console Buffer 29 Get R/0 Vector
11 Get Console Status 30 Set File Attributes
12 Return Version Number 31 Get Addr(Disk Parms)
13 Reset Disk System 32 Set/Get User Code
14 Select Disk 33 Read Random
15 Open File 34 Write Random
16 Close File 35 Compute File Size
17 Search for First 36 Set Random Record
18 Search for Next 37 Reset Drive
40 Write Random with Zero Fill
.fi
.in 0
.sp
.pp
Functions 28 and 32 should be avoided in application programs to
maintain upward compatibility with CP/M.
.pp
Upon entry to a transient program, the CCP leaves the stack
pointer set to an eight-level stack area with the CCP return
address pushed onto the stack, leaving seven levels before
overflow occurs. Although this stack is usually not used by a
transient program (most transients return to the CCP
through a jump to location 0000H) it is large enough to
make CP/M system calls because the FDOS switches to a local stack
at system entry. For example, the assembly-language program segment below
reads characters continuously until an asterisk is
encountered, at which time control returns to the CCP, assuming a
standard CP/M system with BOOT = 0000H.
.sp 2
.nf
.in 8
BDOS EQU 0005H ;STANDARD CP/M ENTRY
CONIN EQU 1 ;CONSOLE INPUT FUNCTION
;
ORG 0100H ;BASE OF TPA
NEXTC: MVI C,CONIN ;READ NEXT CHARACTER
CALL BDOS ;RETURN CHARACTER IN <A>
CPI '*' ;END OF PROCESSING?
JNZ NEXTC ;LOOP IF NOT
RET ;RETURN TO CCP
END
.fi
.in 0
.sp
.pp
CP/M implements a named file structure on each disk, providing a
logical organization that allows any particular file to contain
any number of records from completely empty to the full capacity
of the drive. Each drive is logically distinct with a disk
directory and file data area. The disk filenames are in three
parts: the drive select code, the filename (consisting of one to
eight nonblank characters), and the filetype (consisting of zero
to three nonblank characters). The filetype names the generic
category of a particular file, while the filename distinguishes
individual files in each category. The filetypes listed in Table 5-1
name a few generic categories that have been established,
although they are somewhat arbitrary.
.sp 2
.sh
Table 5-1. CP/M Filetypes
.qs
.sp
.nf
Filetype Meaning
.sp
.in 30
.ti -11
ASM Assembler Source
.ti -11
PRN Printer Listing
.ti -11
HEX Hex Machine Code
.ti -11
BAS Basic Source File
.ti -11
INT Intermediate Code
.ti -11
COM Command File
.ti -11
PLI PL/I Source File
.ti -11
REL Relocatable Module
.ti -11
TEX TEX Formatter Source
.ti -11
BAK ED Source Backup
.ti -11
SYM SID Symbol File
.ti -11
$$$ Temporary File
.fi
.in 0
.sp
.pp
Source files are treated as a sequence of ASCII characters, where
each line of the source file is followed by a carriage return, and
line-feed sequence (0DH followed by 0AH). Thus, one 128-byte CP/M
record can contain several lines of source text. The end of an
ASCII file is denoted by a CTRL-Z character (1AH) or a real
end-of-file returned by the CP/M read operation. CTRL-Z characters embedded
within machine code files (for example, COM files) are ignored and
the end-of-file condition returned by CP/M is used to terminate
read operations.
.pp
Files in CP/M can be thought of as a sequence of up to 65536
records of 128 bytes each, numbered from 0 through 65535, thus
allowing a maximum of 8 megabytes per file. Note, however,
that although the records may be considered logically
contiguous, they may not be physically contiguous in the disk
data area. Internally, all files are divided into 16K byte
segments called logical extents, so that counters are easily
maintained as 8-bit values. The division into extents is
discussed in the paragraphs that follow: however, they are not
particularly significant for the programmer, because each extent is
automatically accessed in both sequential and random access
modes.
.pp
In the file operations starting with Function 15, DE
usually addresses a FCB. Transient programs
often use the default FCB area reserved by CP/M at
location BOOT+005CH (normally 005CH) for simple file operations.
The basic unit of file information is a 128-byte record used for
all file operations. Thus, a default location for disk I/O is
provided by CP/M at location BOOT+0080H (normally 0080H) which
is the initial default DMA address. See Function 26.
.pp
All directory operations take place in a reserved area that does not
affect write buffers as was the case in release 1, with the
exception of Search First and Search Next, where compatibility is
required.
.pp
The FCB data area consists of a sequence of 33 bytes for
sequential access and a series of 36 bytes in the case when the
file is accessed randomly. The default FCB, normally located at
005CH, can be used for random access files, because the three bytes
starting at BOOT+007DH are available for this purpose. Figure 5-2 shows
the FCB format with the following fields.
.sp 3
.nf
dr f1 f2 / / f8 t1 t2 t3 ex s1 s2 rc d0 / / dn cr r0 r1 r2
00 01 02 ... 08 09 10 11 12 13 14 15 16 ... 31 32 33 34 35
.fi
.sp 2
.sh
Figure 5-2. File Control Block Format
.sp 3
The following table lists and describes each of the fields in the File Control
Block figure.
.sp 2
.sh
Table 5-2. File Control Block Fields
.nf
.sp
Field Definition
.sp
dr drive code (0-16)
0 = use default drive for file
1 = auto disk select drive A,
2 = auto disk select drive B,
.
.
.
16= auto disk select drive P.
.sp
f1...f8 contain the filename in ASCII
upper-case, with high bit = 0
.sp
t1, t2, t3 contain the filetype in ASCII
upper-case, with high bit = 0
t1', t2', and t3' denote the
bit of these positions,
t1' = 1 =>Read-Only file,
t2' = 1 =>SYS file, no DIR list
.sp
ex contains the current extent
number, normally set to 00 by
the user, but in range 0-31
during file I/O
.bp
.sh
Table 5-2. (continued)
.qs
.sp
Field Definition
.sp
s1 reserved for internal system use
.sp
s2 reserved for internal system use,
set to zero on call to OPEN, MAKE,
SEARCH
.sp
rc record count for extent ex;
takes on values from 0-127
.sp
d0...dn filled in by CP/M; reserved for
system use
.sp
cr current record to read or write in
a sequential file operation;
normally set to zero by user
.sp
r0, r1, r2 optional random record number in
the range 0-65535, with overflow
to r2, r0, r1 constitute a 16-bit
value with low byte r0, and high
byte r1
.fi
.sp
.pp
Each file being accessed through CP/M must have a corresponding
FCB, which provides the name and allocation information for all
subsequent file operations. When accessing files, it is the
programmer's responsibility to fill the lower 16 bytes of the FCB
and initialize the cr field. Normally, bytes 1 through 11 are
set to the ASCII character values for the filename and filetype,
while all other fields are zero.
.pp
FCBs are stored in a directory area of the disk, and are brought
into central memory before the programmer proceeds with file
operations (see the OPEN and MAKE functions). The memory copy of
the FCB is updated as file operations take place and later
recorded permanently on disk at the termination of the file
operation, (see the CLOSE command).
.pp
The CCP constructs the first 16 bytes of two optional FCBs for a
transient by scanning the remainder of the line following the
transient name, denoted by file1 and file2 in the prototype
command line described above, with unspecified fields set to
ASCII blanks. The first FCB is constructed at location
BOOT+005CH and can be used as is for subsequent file operations.
The second FCB occupies the d0...dn portion of the first FCB and
must be moved to another area of memory before use. If, for
example, the following command line is typed:
.sp
.ti 8
PROGNAME B:X.ZOT Y.ZAP
.bp
the file PROGNAME.COM is loaded into the TPA, and the default FCB
at BOOT+005CH is initialized to drive code 2, filename X, and
filetype ZOT. The second drive code takes the default value 0,
which is placed at BOOT-006CH, with the filename Y placed into
location BOOT+006DH and filetype ZAP located 8 bytes later at
BOOT+0075H. All remaining fields through cr are set to zero.
Note again that it is the programmer's
responsibility to move this second filename and filetype to another
area, usually a separate file control block, before opening the
file that begins at BOOT+005CH, because the open operation
overwrites the second name and type.
.pp
If no filenames are specified in the original command, the
fields beginning at BOOT+005DH and BOOT+006DH contain blanks. In
all cases, the CCP translates lower-case alphabetics to upper-case
to be consistent with the CP/M file naming conventions.
.pp
As an added convenience, the default buffer area at location
BOOT+0080H is initialized to the command line tail typed by the
operator following the program name. The first position contains
the number of characters, with the characters themselves
following the character count. Given the above command line, the
area beginning at BOOT+0080H is initialized as follows:
.sp 2
.nf
.in 5
BOOT+0080H:
.sp
+00 +01 +02 +03 +04 +05 +06 +07 +08 +09 +A +B +C +D +E
E '' 'B' ':' 'X' '.' 'Z' 'O' 'T' '' 'Y' '.' 'Z' 'A' 'P'
.fi
.in 0
.sp 2
where the characters are translated to upper-case ASCII with
uninitialized memory following the last valid character. Again,
it is the responsibility of the programmer to extract the
information from this buffer before any file operations are
performed, unless the default DMA address is explicitly changed.
.pp
Individual functions are described in detail in the pages that
follow.
.bp
.sp 4
.nf
FUNCTION 0: SYSTEM RESET
.sp
Entry Parameters:
Register C: 00H
.fi
.sp 2
.pp
The System Reset function returns control to the CP/M operating
system at the CCP level. The CCP reinitializes the disk
subsystem by selecting and logging-in disk drive A. This
function has exactly the same effect as a jump to location BOOT.
.sp 6
.nf
FUNCTION 1: CONSOLE INPUT
.sp
Entry Parameters:
Register C: 01H
.sp
Returned Value:
Register A: ASCII Character
.fi
.sp 2
.pp
The Console Input function reads the next console character to
register A. Graphic characters, along with carriage return, line-feed,
and back space (CTRL-H) are echoed to the console. Tab
characters, CTRL-I, move the cursor to the next tab stop. A check
is made for start/stop scroll, CTRL-S, and start/stop printer echo,
CTRL-P. The FDOS does not return to the calling program until a
character has been typed, thus suspending execution if a
character is not ready.
.bp
.sp 4
.nf
FUNCTION 2: CONSOLE OUTPUT
.sp
Entry Parameters
Register C: 02H
Register E: ASCII Character
.fi
.sp 2
.pp
The ASCII character from register E is sent to the console
device. As in Function 1, tabs are expanded and checks are made
for start/stop scroll and printer echo.
.sp 6
.nf
FUNCTION 3: READER INPUT
.sp
Entry Parameters:
Register C: 03H
.sp
Returned Value:
Register A: ASCII Character
.fi
.sp 2
.pp
The Reader Input function reads the next character from the
logical reader into register A. See the IOBYTE definition in
Chapter 6. Control does not return until the character has been
read.
.bp
.sp 4
.nf
FUNCTION 4: PUNCH OUTPUT
.sp
Entry Parameters:
Register C: 04H
register E: ASCII Character
.fi
.sp 2
.pp
The Punch Output function sends the character from register E to
the logical punch device.
.sp 6
.nf
FUNCTION 5: LIST OUTPUT
.sp
Entry Parameters:
Register C: 05H
Register E: ASCII Character
.fi
.sp 2
.pp
The List Output function sends the ASCII character in register E
to the logical listing device.
.bp
.sp 4
.nf
FUNCTION 6: DIRECT CONSOLE I/O
.sp
Entry Parameters:
Register C: 06H
Register E: 0FFH (input) or
char (output)
.sp
Returned Value:
Register A: char or status
.fi
.sp 2
.pp
Direct Console I/O is supported under CP/M for those specialized
applications where basic console input and output are required.
Use of this function should, in general, be avoided since it
bypasses all of the CP/M normal control character functions (for example,
CTRL-S and CTRL-P). Programs that perform direct I/O
through the BIOS under previous releases of CP/M, however, should
be changed to use direct I/O under BDOS so that they can be fully
supported under future releases of MP/M \ and CP/M.
.pp
Upon entry to Function 6, register E either contains hexadecimal
FF, denoting a console input request, or an ASCII character. If
the input value is FF, Function 6 returns A = 00 if no character
is ready, otherwise A contains the next console input character.
.pp
If the input value in E is not FF, Function 6 assumes that E
contains a valid ASCII character that is sent to the console.
.pp
Function 6 must not be used in conjunction with other console I/O
functions.
.sp 6
.nf
FUNCTION 7: GET I/O BYTE
.sp
Entry Parameters:
Register C: 07H
.sp
Returned Value:
Register A: I/O Byte Value
.fi
.sp 2
.pp
The Get I/O Byte function returns the current value of IOBYTE in
register A. See Chapter 6 for IOBYTE definition.
.bp
.sp 4
.nf
FUNCTION 8: SET I/O BYTE
.sp
Entry Parameters:
Register C: 08H
Register E: I/O Byte Value
.fi
.sp 2
.pp
The SET I/O Byte function changes the IOBYTE value to that given
in register E.
.sp 6
.nf
FUNCTION 9: PRINT STRING
.sp
Entry Parameters:
Register C: 09H
Registers DE: String Address
.fi
.sp 2
.pp
The Print String function sends the character string stored in
memory at the location given by DE to the console device, until a
$ is encountered in the string. Tabs are expanded as in Function
2, and checks are made for start/stop scroll and printer echo.
.nx fiveb.tex


806
Source/Doc/CPM 22 Manual/fiveb.tex

@ -1,806 +0,0 @@
.cs 5
.mt 5
.mb 6
.pl 66
.ll 65
.po 10
.hm 2
.fm 2
.bp
.sp 4
.nf
FUNCTION 10: READ CONSOLE BUFFER
.sp
Entry Parameters:
Register C: 0AH
Registers DE: Buffer Address
.sp
Returned Value:
Console Characters in Buffer
.fi
.sp 2
.pp
The Read Buffer functions reads a line of edited console input
into a buffer addressed by registers DE. Console input is
terminated when either input buffer overflows or a carriage return
or line-feed is typed. The Read Buffer takes the form:
.sp
.nf
.in 8
DE:+0 +1 +2 +3 +4 +5 +6 +7 +8 . . .+n
.sp
mx nc c1 c2 c3 c4 c5 c6 c7 ... ??
.fi
.in 0
.sp
where mx is the maximum number of characters that the buffer will
hold, 1 to 255, and nc is the number of characters read (set by
FDOS upon return) followed by the characters read from the
console. If nc < mx, then uninitialized positions follow the
last character, denoted by ?? in the above figure. A number of
control functions, summarized in Table 5-3, are recognized during
line editing.
.sp 2
.sh
Table 5-3. Edit Control Characters
.sp
.nf
Character Edit Control Function
.sp
.fi
.in 8
rub/del removes and echoes the last character
.sp
CTRL-C reboots when at the beginning of line
.sp
CTRL-E causes physical end of line
.sp
CTRL-H backspaces one character position
.sp
CTRL-J (line feed) terminates input line
.sp
CTRL-M (return) terminates input line
.sp
CTRL-R retypes the current line after new line
.sp
CTRL-U removes current line
.sp
CTRL-X same as CTRL-U
.in 0
.sp 2
The user should also note that certain functions that return the
carriage to the leftmost position (for example, CTRL-X) do so only to the
column position where the prompt ended. In earlier releases, the
carriage returned to the extreme left margin. This convention
makes operator data input and line correction more legible.
.bp
.sp 4
.nf
FUNCTION 11: GET CONSOLE STATUS
.sp
Entry Parameters:
Register C: 0BH
.sp
Returned Value:
Register A: Console Status
.fi
.sp 2
.pp
The Console Status function checks to see if a character has been
typed at the console. If a character is ready, the value 0FFH is
returned in register A. Otherwise a 00H value is returned.
.sp 6
.nf
FUNCTION 12: RETURN VERSION NUMBER
.sp
Entry Parameters:
Register C: 0CH
.sp
Returned Value:
Registers HL: Version Number
.fi
.sp 2
.pp
Function 12 provides information that allows version independent
programming. A two-byte value is returned, with H = 00
designating the CP/M release (H = 01 for MP/M) and L = 00 for
all releases previous to 2.0. CP/M 2.0 returns a hexadecimal 20
in register L, with subsequent version 2 releases in the
hexadecimal range 21,22, through 2F. Using Function 12, for
example, the user can write application programs that provide
both sequential and random access functions.
.bp
.sp 4
.nf
FUNCTION 13: RESET DISK SYSTEM
.sp
Entry Parameters:
Register C: 0DH
.fi
.sp 2
.pp
The Reset Disk function is used to programmatically restore the
file system to a reset state where all disks are set to
Read-Write. See functions 28 and 29, only disk drive A is
selected, and the default DMA address is reset to BOOT+0080H.
This function can be used, for example, by an application program
that requires a disk change without a system reboot.
.sp 6
.nf
FUNCTION 14: SELECT DISK
.sp
Entry Parameters:
Register C: 0EH
Register E: Selected Disk
.fi
.sp 2
.pp
The Select Disk function designates the disk drive named in register
E as the default disk for subsequent file operations, with E = O
for drive A, 1 for drive B, and so on through 15, corresponding to drive
P in a full 16 drive system. The drive is placed in an on-line
status, which activates its directory until the next cold start,
warm start, or disk system reset operation. If the disk medium
is changed while it is on-line, the drive automatically goes to
a Read-Only status in a standard CP/M environment, see Function
28. FCBs that specify drive code zero (dr = 00H) automatically
reference the currently selected default drive. Drive code
values between 1 and 16 ignore the selected default
drive and directly reference drives A through P.
.bp
.sp 4
.nf
FUNCTION 15: OPEN FILE
.sp
Entry Parameters:
Register C: 0FH
Registers DE: FCB Address
.sp
Returned Value:
Register A: Directory Code
.fi
.sp 2
.pp
The Open File operation is used to activate a file that currently
exists in the disk directory for the currently active user
number. The FDOS scans the referenced disk directory for a match
in positions 1 through 14 of the FCB referenced by DE (byte s1 is
automatically zeroed) where an ASCII question mark (3FH) matches
any directory character in any of these positions. Normally, no
question marks are included, and bytes ex and s2 of the FCB are
zero.
.pp
If a directory element is matched, the relevant directory
information is copied into bytes d0 through dn of FCB, thus
allowing access to the files through subsequent read and write
operations. The user should note that an existing file must not
be accessed until a successful open operation is completed. Upon
return, the open function returns a directory code with the value
0 through 3 if the open was successful or 0FFH (255 decimal) if
the file cannot be found. If question marks occur in the FCB,
the first matching FCB is activated. Note that the current
record, (cr) must be zeroed by the program if the file is to be
accessed sequentially from the first record.
.bp
.sp 4
.nf
FUNCTION 16: CLOSE FILE
.sp
Entry Parameters:
Register C: 10H
Registers DE: FCB Address
.sp
Returned Value:
Register A: Directory Code
.fi
.sp 2
.pp
The Close File function performs the inverse of the Open File
function. Given that the FCB addressed by DE has been previously
activated through an open or make function, the close function
permanently records the new FCB in the reference disk directory
see functions 15 and 22. The FCB matching process for the close
is identical to the open function. The directory code returned
for a successful close operation is 0, 1, 2, or 3, while a 0FFH
(255 decimal) is returned if the filename cannot be found in the
directory. A file need not be closed if only read operations
have taken place. If write operations have occurred, the close
operation is necessary to record the new directory information
permanently.
.bp
.sp 4
.nf
FUNCTION 17: SEARCH FOR FIRST
.sp
Entry Parameters:
Register C: 11H
Registers DE: FCB Address
.sp
Returned Value:
Register A: Directory Code
.fi
.sp 2
.pp
Search First scans the directory for a match with the file given
by the FCB addressed by DE. The value 255 (hexadecimal FF) is
returned if the file is not found; otherwise, 0, 1, 2, or 3 is
returned indicating the file is present. When the file is found,
the current DMA address is filled with the record containing the
directory entry, and the relative starting position is A *32
(that is, rotate the A register left 5 bits, or ADD A five times).
Although not normally required for application programs, the
directory information can be extracted from the buffer at this
position.
.pp
An ASCII question mark (63 decimal, 3F hexadecimal) in any
position from f1 through ex matches the corresponding field of
any directory entry on the default or auto-selected disk drive.
If the dr field contains an ASCII question mark, the auto disk
select function is disabled and the default disk is searched,
with the search function returning any matched entry, allocated
or free, belonging to any user number. This latter function is
not normally used by application programs, but it allows complete
flexibility to scan all current directory values. If the dr
field is not a question mark, the s2 byte is automatically
zeroed.
.bp
.sp 4
.nf
FUNCTION 18: SEARCH FOR NEXT
.sp
Entry Parameters:
Register C: 12H
.sp
Returned Value:
Register A: Directory Code
.fi
.sp 2
.pp
The Search Next function is similar to the Search First function, except
that the directory scan continues from the last matched entry.
Similar to Function 17, Function 18 returns the decimal value 255
in A when no more directory items match.
.sp 6
.nf
FUNCTION 19: DELETE FILE
.sp
Entry Parameters:
Register C: 13H
Registers DE: FCB Address
.sp
Returned Value:
Register A: Directory Code
.fi
.sp 2
.pp
The Delete File function removes files that match the FCB
addressed by DE. The filename and type may contain ambiguous
references (that is, question marks in various positions), but the
drive select code cannot be ambiguous, as in the Search and
Search Next functions.
.pp
Function 19 returns a decimal 255 if the referenced file or files
cannot be found; otherwise, a value in the range 0 to 3 returned.
.bp
.sp 4
.nf
FUNCTION 20: READ SEQUENTIAL
.sp
Entry Parameters:
Register C: 14H
Registers DE: FCB Address
.sp
Returned Value:
Register A: Directory Code
.fi
.sp 2
.pp
Given that the FCB addressed by DE has been activated through an
Open or Make function, the Read Sequential function reads the
next 128-byte record from the file into memory at the current DMA
address. The record is read from position cr of the extent, and
the cr field is automatically incremented to the next record
position. If the cr field overflows, the next logical extent is
automatically opened and the cr field is reset to zero in
preparation for the next read operation. The value 00H is
returned in the A register if the read operation was successful,
while a nonzero value is returned if no data exist at the next
record position (for example, end-of-file occurs).
.sp 6
.nf
FUNCTION 21: WRITE SEQUENTAIL
.sp
Entry Parameters:
Register C: 15H
Registers DE: FCB Address
.sp
Returned Value:
Register A: Directory Code
.fi
.sp 2
.pp
Given that the FCB addressed by DE has been activated through an
Open or Make function, the Write Sequential
function writes the 128-byte data record at the current DMA
address to the file named by the FCB. The record is placed at
position cr of the file, and the cr field is automatically
incremented to the next record position. If the cr field
overflows, the next logical extent is automatically opened and
the cr field is reset to zero in preparation for the next write
operation. Write operations can take place into an existing
file, in which case, newly written records overlay those that
already exist in the file. Register A = 00H upon return from a
successful write operation, while a nonzero value indicates an
unsuccessful write caused by a full disk.
.bp
.sp 4
.nf
FUNCTION 22: MAKE FILE
.sp
Entry Parameters:
Register C: 16H
Registers DE: FCB Address
.sp
Returned Value:
Register A: Directory Code
.fi
.sp 2
.pp
The Make File operation is similar to the Open File operation
except that the FCB must name a file that does not exist in the
currently referenced disk directory (that is, the one named
explicitly by a nonzero dr code or the default disk if dr is
zero). The FDOS creates the file and initializes both the
directory and main memory value to an empty file. The programmer
must ensure that no duplicate filenames occur, and a preceding
delete operation is sufficient if there is any possibility of
duplication. Upon return, register A = 0, 1, 2, or 3 if the
operation was successful and 0FFH (255 decimal) if no more
directory space is available. The Make function has the side
effect of activating the FCB and thus a subsequent open is not
necessary.
.sp 6
.nf
FUNCTION 23: RENAME FILE
.sp
Entry Parameters:
Register C: 17H
Registers DE: FCB Address
.sp
Returned Value:
Register A: Directory Code
.fi
.sp 2
.pp
The Rename function uses the FCB addressed by DE to change all
occurrences of the file named in the first 16 bytes to the file
named in the second 16 bytes. The drive code dr at postion 0 is
used to select the drive, while the drive code for the new
filename at position 16 of the FCB is assumed to be zero. Upon
return, register A is set to a value between 0 and 3 if the
rename was successful and 0FFH (255 decimal) if the first
filename could not be found in the directory scan.
.bp
.sp 4
.nf
FUNCTION 24: RETURN LOG-IN VECTOR
.sp
Entry Parameters:
Register C: 18H
.sp
Returned Value:
Registers HL: Log-in Vector
.fi
.sp 2
.pp
The log-in vector value returned by CP/M is a 16-bit value in HL, where the
least significant bit of L corresponds to the first drive A and
the high-order bit of H corresponds to the sixteenth drive,
labeled P. A 0 bit indicates that the drive is not on-line,
while a 1 bit marks a drive that is actively on-line as a result
of an explicit disk drive selection or an implicit drive select
caused by a file operation that specified a nonzero dr field.
The user should note that compatibility is maintained with
earlier releases, because registers A and L contain the same values
upon return.
.sp 6
.nf
FUNCTION 25: RETURN CURRENT DISK
.sp
Entry Parameters:
Register C: 19H
.sp
Returned Value:
Register A: Current Disk
.fi
.sp 2
.pp
Function 25 returns the currently selected default disk number in
register A. The disk numbers range from 0 through 15
corresponding to drives A through P.
.bp
.sp 4
.nf
FUNCTION 26: SET DMA ADDRESS
.sp
Entry Parameters:
Register C: 1AH
Registers DE: DMA Address
.fi
.sp 2
.pp
DMA is an acronym for Direct Memory Address, which is often used
in connection with disk controllers that directly access the
memory of the mainframe computer to transfer data to and from the
disk subsystem. Although many computer systems use non-DMA
access (that is, the data is transferred through programmed I/O
operations), the DMA address has, in CP/M, come to mean the
address at which the 128-byte data record resides before a disk
write and after a disk read. Upon cold start, warm start, or
disk system reset, the DMA address is automatically set to
BOOT+0080H. The Set DMA function can be used to change
this default value to address another area of memory where the
data records reside. Thus, the DMA address becomes the value
specified by DE until it is changed by a subsequent Set DMA
function, cold start, warm start, or disk system reset.
.sp 6
.nf
FUNCTION 27: GET ADDR (ALLOC)
.sp
Entry Parameters:
Register C: 1BH
.sp
Returned Value:
Registers HL: ALLOC Address
.fi
.sp 2
.pp
An allocation vector is maintained in main memory for each on-
line disk drive. Various system programs use the information
provided by the allocation vector to determine the amount of
remaining storage (see the STAT program). Function 27 returns
the base address of the allocation vector for the currently
selected disk drive. However, the allocation information might be
invalid if the selected disk has been marked Read-Only. Although
this function is not normally used by application programs,
additional details of the allocation vector are found in Chapter
6.
.bp
.sp 4
.nf
FUNCTION 28: WRITE PROTECT DISK
.sp
Entry Parameters:
Register C: 1CH
.fi
.sp 2
.pp
The Write Protect Disk function provides temporary write
protection for the currently selected disk. Any attempt to write
to the disk before the next cold or warm start operation produces
the message:
.sp
.ti 8
BDOS ERR on d:R/O
.sp 6
.nf
FUNCTION 29: GET READ-ONLY VECTOR
.sp
Entry Parameters:
Register C: 1DH
.sp
Returned Value:
Registers HL: R/O Vector Value
.fi
.sp 2
.pp
Function 29 returns a bit vector in register pair HL, which
indicates drives that have the temporary Read-Only bit set. As
in Function 24, the least significant bit corresponds to drive A,
while the most significant bit corresponds to drive P. The R/O
bit is set either by an explicit call to Function 28 or by the
automatic software mechanisms within CP/M that detect changed
disks.
.bp
.sp 4
.nf
FUNCTION 30: SET FILE ATTRIBUTES
.sp
Entry Parameters:
Register C: 1EH
Registers DE: FCB Address
.sp
Returned Value:
Register A: Directory Code
.fi
.sp 2
.pp
The Set File Attributes function allows programmatic manipulation
of permanent indicators attached to files. In particular, the R/O
and System attributes (t1' and t2') can be set or reset. The DE
pair addresses an unambiguous filename with the appropriate
attributes set or reset. Function 30 searches for a match and
changes the matched directory entry to contain the selected
indicators. Indicators f1' through f4' are not currently used,
but may be useful for applications programs, since they are not
involved in the matching process during file open and close
operations. Indicators f5' through f8' and t3' are reserved for
future system expansion.
.sp 6
.nf
FUNCTION 31: GET ADDR (DISK PARMS)
.sp
Entry Parameters:
Register C: 1FH
.sp
Returned Value:
Registers HL: DPB Address
.fi
.sp 2
.pp
The address of the BIOS resident disk parameter block is returned
in HL as a result of this function call. This address can be
used for either of two purposes. First, the disk parameter
values can be extracted for display and space computation
purposes, or transient programs can dynamically change the values
of current disk parameters when the disk environment changes, if
required. Normally, application programs will not require this
facility.
.bp
.sp 4
.nf
FUNCTION 32: SET/GET USER CODE
.sp
Entry Parameters:
Register C: 20H
Register E: OFFH (get) or
User Code (set)
.sp
Returned Value:
Register A: Current Code or
(no value)
.fi
.sp 2
.pp
An application program can change or interrogate the currently
active user number by calling Function 32. If register E = 0FFH,
the value of the current user number is returned in register A,
where the value is in the range of 0 to 15. If register E is not
0FFH, the current user number is changed to the value of E,
modulo 16.
.bp
.sp 4
.nf
FUNCTION 33: READ RANDOM
.sp
Entry Parameters:
Register C: 21H
.sp
Returned Value:
Register A: Return Code
.fi
.sp 2
.pp
The Read Random function is similar to the sequential file read
operation of previous releases, except that the read operation
takes place at a particular record number, selected by the 24-bit
value constructed from the 3-byte field following the FCB (byte
positions r0 at 33, r1 at 34, and r2 at 35). The user should
note that the sequence of 24 bits is stored with least
significant byte first (r0), middle byte next (r1), and high byte
last (r2). CP/M does not reference byte r2, except in computing
the size of a file (Function 35). Byte r2 must be zero, however,
since a nonzero value indicates overflow past the end of file.
.pp
Thus, the r0, r1 byte pair is treated as a double-byte, or word
value, that contains the record to read. This value ranges from
0 to 65535, providing access to any particular record of the 8-
megabyte file. To process a file using random access, the base
extent (extent 0) must first be opened. Although the base extent
might or might not contain any allocated data, this ensures that the
file is properly recorded in the directory and is visible in DIR
requests. The selected record number is then stored in the
random record field (r0, r1), and the BDOS is called to read the
record.
.pp
Upon return from the call, register A either contains an error
code, as listed below, or the value 00, indicating the operation
was successful. In the latter case, the current DMA address
contains the randomly accessed record. Note that
contrary to the sequential read operation, the record number is
not advanced. Thus, subsequent random read operations continue
to read the same record.
.pp
Upon each random read operation, the logical extent and current
record values are automatically set. Thus, the file can be
sequentially read or written, starting from the current randomly
accessed position. However, note that, in this
case, the last randomly read record will be reread as one
switches from random mode to sequential read and the last record
will be rewritten as one switches to a sequential write operation.
The user can simply advance the random record
position following each random read or write to obtain the effect
of sequential I/O operation.
.bp
.pp
Error codes returned in register A following a random read are
listed below.
.sp 2
.nf
.in 8
01 reading unwritten data
.sp
02 (not returned in random mode)
.sp
03 cannot close current extent
.sp
04 seek to unwritten extent
.sp
05 (not returned in read mode)
.sp
06 seek past physical end of disk
.fi
.in 0
.sp
.pp
Error codes 01 and 04 occur when a random read operation accesses
a data block that has not been previously written or an extent
that has not been created, which are equivalent conditions.
Error code 03 does not normally occur under proper system
operation. If it does, it can be cleared by simply rereading or
reopening extent zero as long as the disk is not physically write
protected. Error code 06 occurs whenever byte r2 is nonzero
under the current 2.0 release. Normally, nonzero return codes
can be treated as missing data, with zero return codes indicating
operation complete.
.bp
.sp 4
.nf
FUNCTION 34: WRITE RANDOM
.sp
Entry Parameters:
Register C: 22H
Registers DE: FCB Address
.sp
Returned Value:
Register A: Return Code
.fi
.sp 2
.pp
The Write Random operation is initiated similarly to the Read
Random call, except that data is written to the disk from the
current DMA address. Further, if the disk extent or data block
that is the target of the write has not yet been allocated, the
allocation is performed before the write operation continues. As
in the Read Random operation, the random record number is not
changed as a result of the write. The logical extent number and
current record positions of the FCB are set to correspond to the
random record that is being written. Again, sequential read or
write operations can begin following a random write, with the
notation that the currently addressed record is either read or
rewritten again as the sequential operation begins. You can
also simply advance the random record position following each
write to get the effect of a sequential write operation.
Note that reading or writing the last record of an extent in
random mode does not cause an automatic extent switch as it does
in sequential mode.
.pp
The error codes returned by a random write are identical to the
random read operation with the addition of error code 05, which
indicates that a new extent cannot be created as a result of
directory overflow.
.bp
.sp 4
.nf
FUNCTION 35: COMPUTE FILE SIZE
.sp
Entry Parameters:
Register C: 23H
Registers DE: FCB Address
.sp
Returned Value:
Random Record Field Set
.fi
.sp 2
.pp
When computing the size of a file, the DE register pair addresses
an FCB in random mode format (bytes r0, r1, and r2 are present).
The FCB contains an unambiguous filename that is used in the
directory scan. Upon return, the random record bytes contain the
virtual file size, which is, in effect, the record address of
the record following the end of the file. Following a call to
Function 35, if the high record byte r2 is 01, the file contains
the maximum record count 65536. Otherwise, bytes r0 and r1
constitute a 16-bit value as before (r0 is the least significant byte),
which is the file size.
.pp
Data can be appended to the end of an existing file by simply
calling Function 35 to set the random record position to the end
of file and then performing a sequence of random writes starting
at the preset record address.
.pp
The virtual size of a file corresponds to the physical size when
the file is written sequentially. If the file was created in
random mode and holes exist in the allocation, the file might
contain fewer records than the size indicates. For example,
if only the last record of an 8-megabyte file is written in
random mode (that is, record number 65535), the virtual size is
65536 records, although only one block of data is actually
allocated.
.bp
.sp 4
.nf
FUNCTION 36: SET RANDOM RECORD
.sp
Entry Parameters:
Register C: 24H
Registers DE: FCB Address
.sp
Returned Value:
Random Record Field Set
.fi
.sp 2
.pp
The Set Random Record function causes the BDOS automatically
to produce the random record position from a file that has been
read or written sequentially to a particular point. The function
can be useful in two ways.
.pp
First, it is often necessary initially to read and scan a
sequential file to extract the positions of various key fields.
As each key is encountered, Function 36 is called to compute the
random record position for the data corresponding to this key. If
the data unit size is 128 bytes, the resulting record position is
placed into a table with the key for later retrieval. After
scanning the entire file and tabulating the keys and their record
numbers, the user can move instantly to a particular keyed record
by performing a random read, using the corresponding random
record number that was saved earlier. The scheme is easily
generalized for variable record lengths, because the program need
only store the buffer-relative byte position along with the key
and record number to find the exact starting position of the
keyed data at a later time.
.pp
A second use of Function 36 occurs when switching from a
sequential read or write over to random read or write. A file is
sequentially accessed to a particular point in the file, Function
36 is called, which sets the record number, and subsequent random
read and write operations continue from the selected point in the
file.
.bp
.sp 4
.nf
FUNCTION 37: RESET DRIVE
.sp
Entry Parameters:
Register C: 25H
Registers DE: Drive Vector
.sp
Returned Value:
Register A: 00H
.fi
.sp 2
.pp
The Reset Drive function allows resetting of specified drives.
The passed parameter is a 16-bit vector of drives to be reset;
the least significant bit is drive A:.
.pp
To maintain compatibility with MP/M, CP/M returns a zero value.
.sp 6
.nf
FUNCTION 40: WRITE RANDOM WITH ZERO FILL
.sp
Entry Parameters:
Register C: 28H
Registers DE: FCB Address
.sp
Returned Value:
Register A: Return Code
.fi
.sp 2
.pp
The Write With Zero Fill operation is similar to Function 34,
with the exception that a previously unallocated block is filled
with zeros before the data is written.
.nx fivec


444
Source/Doc/CPM 22 Manual/fivec.tex

@ -1,444 +0,0 @@
.cs 5
.mt 5
.mb 6
.pl 66
.ll 65
.po 10
.hm 2
.fm 2
.he
.bp
.tc 5.3 A Sample File-to-File Copy Program
.he CP/M Operating System Manual 5.3 A Sample Copy Program
.sh
5.3 A Sample File-to-File Copy Program
.qs
.pp
The following program provides a relatively simple example of file
operations. The program source file is created as COPY.ASM using
the CP/M ED program and then assembled using ASM or MAC, resulting
in a HEX file. The LOAD program is used to produce a COPY.COM
file that executes directly under the CCP. The program begins
by setting the stack pointer to a local area and proceeds to move
the second name from the default area at 006CH to a 33-byte File
Control Block called DFCB. The DFCB is then prepared for file
operations by clearing the current record field. At this point,
the source and destination FCBs are ready for processing, because
the SFCB at 005CH is properly set up by the CCP upon entry to the
COPY program. That is, the first name is placed into the default
FCB, with the proper fields zeroed, including the current record
field at 007CH. The program continues by opening the source
file, deleting any existing destination file, and creating the destination
file. If all this is successful, the program loops at the label
COPY until each record is read from the source file and placed into the
destination file. Upon completion of the data transfer, the
destination file is closed and the program returns to the
CCP command level by jumping to BOOT.
.ll 75
.sp 3
.nf
; sample file-to-file copy program
;
; at the ccp level, the command
;
; copy a:x.y b:u.v
;
; copies the file named x.y from drive
; a to a file named u.v. on drive b.
;
0000 = boot equ 0000h ;system reboot
0005 = bdos equ 0005h ;bdos entry point
005c = fcbl equ 005ch ;first file name
005c = sfcb equ fcbl ;source fcb
006c = fcb2 equ 006ch ;second file name
0080 = dbuff equ 0080h ;default buffer
0100 = tpa equ 0100h ;beginning of tpa
;
0009 = printf equ 9 ;print buffer func#
000f = openf equ 15 ;open file func#
0010 = closef equ 16 ;close file func#
0013 = deletef equ 19 ;delete file func#
0014 = readf equ 20 ;sequential read
0015 = writef equ 21 ;sequential write
0016 = makef equ 22 ;make file func#
;
0100 org tpa ;beginning of tpa
0100 311b02 lxi sp,stack ;local stack
;
; move second file name to dfcb
0103 0e10 mvi c,16 ;half an fcb
0105 116c00 lxi d,fcb2 ;source of move
0108 21da01 lxi h,dfcb ;destination fcb
010b 1a mfcb: Idax d ;source fcb
010c 13 inx d ;ready next
010d 77 mov m,a ;dest fcb
010e 23 inx h ;ready next
010f 0d dcr c ;count 16...0
0110 c10b01 jnz mfcb ;loop 16 times
;
; name has been removed, zero cr
0113 af xra a ;a = 00h
0114 32fa01 sta dfcbcr ;current rec = 0
;
; source and destination fcb's ready
;
0117 115c00 lxi d,sfcb ;source file
011a cd6901 call open ;error if 255
011d 118701 lxi d,nofile ;ready message
0120 3c inr a ;255 becomes 0
0121 cc6101 cz finis ;done if no file
;
; source file open, prep destination
0124 11da01 lxi d,dfcb ;destination
0127 cd7301 call delete ;remove if present
;
012a 11da01 lxi d,dfcb ;destination
012d cd8201 call make ;create the file
0130 119601 lxi d,nodir ;ready message
0133 3c inr a ;255 becomes 0
0134 cc6101 cz finis ;done if no dir space
;
; source file open, dest file open
; copy until end of file on source
;
0137 115c00 copy: lxi d,sfcb ;source
013a cd7801 call read ;read next record
013d b7 ora a ;end of file?
013e c25101 jnz eofile ;skip write if so
;
; not end of file, write the record
0141 11da01 lix d,dfcb ;destination
0144 cd7d01 call write ;write record
0147 11a901 lxi d,space ;ready message
014a b7 ora a ;00 if write ok
014b c46101 cnz finis ;end if so
014e c33701 jmp copy ;loop until eof
;
eofile: ;end of file, close destination
0151 11da01 lxi d,dfcb ;destination
0154 cd6e01 call close ;255 if error
0157 21bb01 lxi h,wrprot ;ready message
015a 3c inr a ;255 becomes 00
015b cc6101 cz finis ;shouldn't happen
;
; copy operation complete, end
015e 11cc01 lxi d,normal ;ready message
;
finis ;write message given by de, reboot
0161 0e09 mvi c,printf
0163 cd0500 call bdos ;write message
0166 c30000 jmp boot ;reboot system
;
; system interface subroutines
; (all return directly from bdos)
;
0169 0e0f open: mvi c,openf
016b c30500 jmp bdos
;
016e 0e10 close: mvi c,closef
0170 c30500 jmp bdos
;
0173 0e13 delete mvi c,deletef
0175 c30500 jmp bdos
;
0178 0e14 read: mvi c,readf
017a c30500 jmp bdos
;
017d 0e15 write: mvi c,writef
017f c30500 jmp bdos
;
0182 0e16 make: mvi c,makef
0184 c30500 jmp bdos
;
; console messages
0187 6e6f20f nofile: db 'no source file$'
0196 6e6f209 nodir: db 'no directory space$'
01a9 6f7574f space: db 'out of dat space$'
01bb 7772695 wrprot: db 'write protected?$'
01cc 636f700 normal: db 'copy complete$'
;
; data areas
01da dfcb: ds 33 ;destination fcb
01fa dfcbcr equ dfcb+32 ;current record
;
01fb ds 32 ;16 level stack
stack:
021b end
.ll 65
.fi
.in 0
.sp 2
.pp
Note that there are several simplifications in this
particular program. First, there are no checks for invalid filenames
that could contain ambiguous references. This
situation could be detected by scanning the 32-byte default area
starting at location 005CH for ASCII question marks. A check
should also be make to ensure that the filenames have
been included (check locations 005DH and 006DH for nonblank ASCII
characters). Finally, a check should be made to ensure that the
source and destination filenames are different. An improvement
in speed could be obtained by buffering more data on each read
operation. One could, for example, determine the size of memory
by fetching FBASE from location 0006H and using the entire
remaining portion of memory for a data buffer. In this case, the
programmer simply resets the DMA address to the next successive
128-byte area before each read. Upon writing to the destination
file, the DMA address is reset to the beginning of the buffer and
incremented by 128 bytes to the end as each record is
transferred to the destination file.
.sp 2
.he CP/M Operating System Manual 5.4 A Sample File Dump Utility
.tc 5.4 A Sample File Dump Utility
.sh
5.4 A Sample File Dump Utility
.qs
.pp
The following file dump program is slightly more complex than
the simple copy program given in the previous section. The dump
program reads an input file, specified in the CCP command line,
and displays the content of each record in hexadecimal format at
the console. Note that the dump program saves the CCP's stack
upon entry, resets the stack to a local area, and restores the
CCP's stack before returning directly to the CCP. Thus, the
dump program does not perform and warm start at the end of
processing.
.ll 75
.sp 3
.nf
x.in 5
;DUMP program reads input file and displays
hex data
;
0100 org 100h
0005 = bdos equ 0005h = ;bdos entry point
0001 = cons equ 1 ;read console
0002 = typef equ 2 ;type function
0009 = printf equ 9 ;buffer print entry
000b = brkf equ 11 ;break key function
;(true if char
000f = openf equ 15 ;file open
0014 = readf equ 20 ;read function
;
005c = fcb equ 5ch ;file control block
;address
0080 = buff equ 80h ;input disk buffer
;address
;
; non graphic characters
000d = cr equ 0dh ;carriage return
000a = If equ 0ah ;line feed
;
; file control block definitions
005c = fcbdn equ fcb+0 ;disk name
005d = fcbfn equ fcb+1 ;file name
0065 = fcbft equ fcb+9 ;disk file type (3
;characters)
0068 = fcbrl equ fcb+12 ;file's current reel
;number
006b = fcbrc equ fcb+15 ;file's record count (0 to
;128)128)
007c = fcbcr' equ fcb+32 ;current (next) record
;number (0
007d = fcbin equ fcb+33 ;fcb length
;
; set up stack
0100 210000 lxi h,0
0103 39 dad sp
; entry stack pointer in hl from the ccp
0104 221502 shld oldsp
; set sp to local stack area (restored at
; finis)
0107 315702 lxi sp,stktop
; read and print successive buffers
010a cdc101 call setup ;set up input file
010d feff cpi 255 ;255 if file not present
010f c21b01 jnz openok ;skip if open is ok
;
; file not there, give error message and
; return
0112 11f301 lxi d,opnmsg
0115 cd9c01 call err
0118 c35101 jmp finis ;to return
;
openok: ;open operation ok, set buffer index to
;end
011b 3e80 mvi a,80h
011d 321302 sta ibp ;set buffer pointer to 80h
; hl contains next address to print
0120 210000 lxi h,0 ;start with 0000
;
gloop:
0123 e5 push h ;save line position
0124 cda201 call gnb
0127 e1 pop h ;recall line position
0138 da5101 jc finis ;carry set by gnb if end
;file
012b 47 mov b,a
; print hex values
; check for line fold
012c 7d
mov a,l
012d e60f ani 0fh ;check low 4 bits
012f c24401 jnz nonum
; print line number
0132 cd7201 call crlf
;
; check for break key
0135 cd5901 call break
; accum lsb = 1 if character ready
0138 0f rrc ;into carry
0139 da5101 jc finis ;don't print any more
;
013c 7c mov a,h
013d cd8f01 call phex
0140 7d mov a,l
0141 cd8f01 call phex
nonum
0144 23 inx h ;to next line number
0145 3e20 mvi a,''
0147 cd6501 call pchar
014a 78 mov a,b
014b cd8f01 call phex
014e c32301 jmp gloop
;
finis
; end of dump, return to cco
; (note that a jmp to 0000h reboots)
0151 cd7201 call crif
0154 2a1502 lhld oldsp
0157 f9 sphl
; stack pointer contains ccp's stack
; location
0158 c9 ret ;to the ccp
;
;
; subroutines
;
break: ;check break key (actually any key will
;do)
0159 e5d5c5 push h! push d! push b; environment
;saved
015c 0e0b mvi c,brkf
015e cd0500 call bdos
0161 c1d1e1 pop b! pop d! pop h; environment
restored
0164 c9 ret
;
pchar: ;print a character
0165 e5d5c5 push h! push d! push b; saved
0168 0e02 mvi c, typef
016a 5f mov e,a
016b cd0500 call bdos
016e c1d1e1 pop b! pop d! pop h; restored
0171 c9 ret
;
crlf
0172 3e0d mvi a,cr
0174 cd6501 call pchar
0177 3e0a mvi a,lf
0179 cd6501 call pchar
017c c9 ret
;
;
pnib: ;print nibble in reg a
017d e60f ani ofh ;low 4 bits
017f fe0a cpi 10
0181 d28901 jnc p10
; less than or equal to 9
0184 c630 adi '0'
0186 c38b01 jmp prn
;
; greater or equal to 10
0189 c637 p10: adi 'a' - 10
018b cd6501 prn: call pchar
018e c9 ret
;
phex ;print hex char in reg a
018f f5 pushpsw
0190 0f rrc
0191 0f rrc
0192 0f rrc
0193 0f rrc
0194 cd7d01 call pnib ;print nibble
0197 f1 pop psw
0198 cd7d01 call pnip
019b c9 ret
;
err: ;print error message
; d,e addresses message ending with "$"
019c 0e09 mvi c,printf ;print buffer
;function
019e cd0500 call bdos
01a1 c9 ret
;
;
gnb: ;get next byte
01a2 3a1302 lda ibp
01a5 fe80 cpi 80h
01a7 c2b301 jnz g0
; read another buffer
;
;
01aa cdce01 call diskr
01ad b7 ora a ;zero value if read ok
01ae cab301 jz g0 ;for another byte
; end of data, return with carry set for eof
01b1 37 stc
01b2 c9 ret
;
g0: ;read the byte at buff+reg a
01b3 5f mov e,a ;Is byte of buffer index
01b4 1600 mvi d,0 ;double precision
;index to de
01b6 3c inr a ;index=index+1
01b7 321302 sta ibp ;back to memory
; pointer is incremented
; save the current file address
01ba 218000 lxi h,buff
01bd 19 dad d
; absolute character address is in hl
01be 7e mov a,m
; byte is in the accumulator
01bf b7 ora a ;reset carry bit
01c0 c9 ret
;
setup: ;set up file
; open the file for input
01c1 af xra a ;zero to accum
01c2 327c00 sta fcbcr ;clear current record
;
01c5 115c00 lxi d,fcb
01c8 0e0f mvi c,openf
01ca cd0500 call bdos
; 255 in accum if open error
01cd c9 ret
;
diskr: ;read disk file record
01ce e5d5c5 push h! push d! push b
01d1 115c00 lxi d,fcb
01d4 0e14 mvi c,readf
01d6 cd0500 call bdos
01d9 c1d1e1 pop b! pop d! pop h
01dc c9 ret
;
; fixed message area
01dd 46494c0 signon: db 'file dump version 2.0$'
01f3 0d0a4e0 opnmsg: db cr,lf,'no input file present on
disk$'
; variable area
0213 ibp: ds 2 ;input buffer pointer
0215 oldsp: ds 2 ;entry sp value from ccp
;
; stack area
0217 ; ds 64 ;reserve 32 level stack
stktop:
;
0257 end
.ll 65
.fi
.in 0
.nx fived


497
Source/Doc/CPM 22 Manual/fived.tex

@ -1,497 +0,0 @@
.cs 5
.mt 5
.mb 6
.pl 66
.ll 65
.po 10
.hm 2
.fm 2
.sp 3
.he CP/M Operating System Manual 5.5 Sample Random Access Program
.sh
5.5 A Sample Random Access Program
.qs
.tc 5.5 A Sample Random Access Program
.pp
This chapter concludes with an extensive example of random access operation.
The program listed below performs the simple function of reading or writing
random records upon command from the terminal. When a
program has been created, assembled, and placed into a file
labeled RANDOM.COM, the CCP level command
.sp
.ti 8
RANDOM X.DAT
.sp
starts the test program. The program looks for a file by the
name X.DAT and, if found, proceeds to prompt the console for
input. If not found, the file is created before the prompt is
given. Each prompt takes the form
.sp
.ti 8
next command?
.sp
and is followed by operator input, followed by a carriage
return. The input commands take the form
.sp
.ti 8
nW nR Q
.sp
where n is an integer value in the range 0 to 65535, and W, R,
and Q are simple command characters corresponding to random
write, random read, and quit processing, respectively. If the W
command is issued, the RANDOM program issues the prompt
.sp
.ti 8
type data:
.sp
The operator then responds by typing up to 127 characters,
followed by a carriage return. RANDOM then writes the character
string into the X.DAT file at record n. If the R command is
issued, RANDOM reads record number n and displays the string
value at the console, If the Q command is issued, the X.DAT file
is closed, and the program returns to the CCP. In the interest
of brevity, the only error message is
.sp
.ti 8
error, try again.
.pp
The program begins with an initialization section where the input
file is opened or created, followed by a continuous loop at the
label ready where the individual commands are interpreted. The
DFBC at 005CH and the default buffer at 0080H are used in all
disk operations. The utility subroutines then follow, which
contain the principal input line processor, called readc. This
particular program shows the elements of random access
processing, and can be used as the basis for further program
development.
.ll 75
.sp 3
.nf
.sh
Sample Random Access Program for CP/M 2.0
.qs
0100 org 100h ;base of tpa
;
0000 = reboot equ 0000h ;system reboot
0005 = bdos equ 0005h ;bdos entry point
;
0001 = coninp equ 1 ;console input function
0002 = conout equ 2 ;console output function
0009 = pstring equ 9 ;print string until '$'
000a = rstring equ 10 ;read console buffer
000c = version equ 12 ;return version number
000f = openf equ 15 ;file open function
0010 = closef equ 16 ;close function
0016 = makef equ 22 ;make file function
0021 = readr equ 33 ;read random
0022 = writer equ 34 ;write random
;
005c = fcb equ 005ch ;default file control
;block
007d = ranrec equ fcb+33 ;random record position
007f = ranovf equ fcb+35 ;high order (overflow)
;byte
0080 = buff equ 0080h ;buffer address
;
000d = cr equ 0dh ;carriage return
000a = lf equ 0ah ;line feed
;
.sh
Load SP, Set-Up File for Random Access
.qs
0100 31bc00 lxi sp,stack
;
; version 2.0
0103 0e0c mvi c,version
0105 cd0500 call bdos
0108 fe20 cpi 20h ;version 2.0 or better?
010a d21600 jnc versok
; bad version, message and go back
010d 111b00 lxi d,badver
0110 cdda00 call print
0113 c30000 jmp reboot
;
versok:
; correct versionm for random access
0116 0e0f mvi c,openf ;open default fcb
0118 115c00 lxi d,fcb
011b cd 0500 call bdos
011e 3c inr a ;err 255 becomes zero
011f c23700 jnz ready
;
; connot open file, so create it
0122 0e16 mvi c,makef
0124 115c00 lxi d,fcb
0127 cd0500 call bdos
012a 3c inr a ;err 255 becomes zero
012b c23700 jnz ready
;
; cannot create file, directory full
012e 113a00 lxi d,nospace
0131 cdda00 call print
0134 c30000 jmp reboot ;back to ccp
.sp 2
.sh
Loop Back to Ready After Each Command
.qs
.sp
;
ready:
; file is ready for processing
;
0137 cde500 call readcom ;read next command
013a 227d00 shld ranrec ;store input record#
013d 217f00 lxi h,ranovf
0140 3600 mvi m,0 ;clear high byte if set
0142 fe51 cpi 'Q' ;quit?
0144 c25600 jnz notq
;
; quit processing, close file
0147 0e10 mvi c,closef
0149 115c00 lxi d,fcb
014c cd0500 call bdos
014f 3c inr a ;err 255 becomes 0
0150 cab900 jz error ;error message, retry
0153 c30000 jmp reboot ;back to ccp
;
.sp 2
.sh
End of Quit Command, Process Write
.qs
.sp
notq:
; not the quit command, random write?
0156 fe57 cpi 'W'
0158 c28900 jnz notw
;
; this is a random write, fill buffer untill cr
015b 114d00 lxi d,datmsg
015e cdda00 call print ;data prompt
0161 0e7f mvi c,127 ;up to 127 characters
0163 218000 lxi h,buff ;destination
rloop: ;read next character to buff
0166 c5 push b ;save counter
0167 e5 push h ;next destination
0168 cdc200 call getchr ;character to a
016b e1 pop h ;restore counter
016c c1 pop b ;restore next to fill
016d fe0d cpi cr ;end of line?
016f ca7800 jz erloop
; not end, store character
0172 77 mov m,a
0173 23 inx h ;next to fill
0174 0d dcr c ;counter goes down
0175 c26600 jnz rloop ;end of buffer?
erloop:
; end of read loop, store 00
0178 3600 mvi m,0
;
; write the record to selected record number
017a 0e22 mvi c,writer
017c 115c00 lxi d,fcb
017c cd0500 call bdos
0182 b7 ora a ;erro code zero?
0183 c2b900 jnz error ;message if not
0186 c33700 jmp ready ;for another record
;
.sp 2
.sh
End of Write Command, Process Read
.qs
.sp
notw:
; not a write command, read record?
0189 fe52 cpi 'R'
018b c2b900 jnz error ;skip if not
;
; read random record
018e 0e21 mvi c,readr
0190 115c00 lxi d,fcb
0193 cd0500 call bdos
0196 b7 ora a ;return code 00?
0197 c2b900 jnz error
;
; read was successful, write to console
019a cdcf00 call crlf ;new line
019d 0e80 mvi c,128 ;max 128 characters
019f 218000 lxi h,buff ;next to get
wloop:
01a2 7e mov a,m ;next character
01a3 23 inx h ;next to get
01a4 e67f ani 7fh ;mask parity
01a6 ca3700 jz ready ;for another command
;if 00
01a9 c5 push b ;save counter
01aa e5 push h ;save next to get
01ab fe20 cpi '' ;graphic?
01ad d4c800 cnc putchr ;skip output if not
01b0 e1 pop h
01b1 c1 pop b
01b2 0d dcr c ;count=count-1
01b3 c2a200 jnz wloop
01b6 c33700 jmp ready
.bp
.sh
End of Read Command, All Errors End Up Here
.qs
.sp
;
error:
01b9 115900 lxi d,errmsg
01bc cdda00 call print
01bf c33700 jmp ready
;
.sp 2
.sh
Utility Subroutines for Console I/O
.qs
.sp
getchr:
;read next console character to a
01c2 0e01 mvi c,coninp
01c4 cd0500 call bdos
01c7 c9 ret
;
putchr:
;write character from a to console
01c8 0e02 mvi c,conout
01ca 5f mov e,a ;character to send
01cb cd0500 call bdos ;send character
01ce c9 ret
;
crlf:
;send carriage return line feed
01cf 3e0d mvi a,cr ;carriage return
01d1 cdc800 call putchr
01d4 3e0a mvi a,lf ;line feed
01d6 cdc800 call putchr
01d9 c9 ret
;
print:
;print the buffer addressed by de untill $
01da d5 push d
01db cdcf00 call crlf
01de d1 pop d ;new line
01df 0e09 mvi c,pstring
01e0 cd0500 call bdos ;print the string
01e4 c9 ret
;
readcom:
;read the next command line to the conbuf
01e5 116b00 lxi d,prompt
01e8 cdda00 call print ;command?
01eb 0e0a mvi c,rstring
01ed 117a00 lxi d,conbuf
01f0 cd0500 call bdos ;read command line
; command line is present, scan it
01f3 210000 lxi h,0 ;start with 0000
01f6 117c00 lxi d,conlin ;command line
01f9 1a readc: ldax d ;next command
;character
01fa 13 inx d ;to next command
;position
01fb b7 ora a ;cannot be end of
;command
01fc c8 rz
; not zero, numeric?
01fd d630 sui '0'
01ff fe0a cpi 10 ;carry if numeric
0201 d21300 jnc endrd
; add-in next digit
0204 29 dad h ;*2
0205 4d mov c,l
0206 44 mov b,h ;bc = value * 2
0207 29 dad h ;*4
0208 29 dad h ;*8
0209 09 dad b ;*2 + *8 = *10
020a 85 add l ;*digit
020b 6f mov l,a
020c d2f900 jnc readc ;for another char
020f24 inr h ;overflow
0210 c3f900 jmp readc ;for another char
endrd:
; end of read, restore value in a
0213 c630 adi '0' ;command
0215 fe61 cpi 'a' ;translate case?
0217 d8 rc
; lower case, mask lower case bits
0218 e65f ani 101$1111b
021a c9 ret
;
.sp 2
.sh
String Data Area for Console Messages
.qs
.sp
badver:
021b 536f79 db 'sorry, you need cp/m version 2$'
nospace:
023a 4e6f29 db 'no directory space$'
datmsg:
024d 547970 db 'type data: $'
errmsg:
0259 457272 db 'error, try again.$'
prompt:
026b 4e6570 db 'next command? $'
;
.sp 2
.mb 5
.fm 1
.sh
Fixed and Variable Data Area
.qs
.sp
027a 21 conbuf: db conlen ;length of console buffer
027b consiz: ds 1 ;resulting size after read
027c conlin: ds 32 ;length 32 buffer
0021 = conlen equ $-consiz
;
029c ds 32 ;16 level stack
stack:
02bc end
.ll 65
.fi
.pp
Major improvements could be made to this particular program to enhance
its operation. In fact, with some work, this program could
evolve into a simple data base management system. One could, for
example, assume a standard record size of 128 bytes, consisting
to arbitrary fields within the record. A program, called GETKEY,
could be developed that first reads a sequential file and
extracts a specific field defined by the operator. For example,
the command
.mb 6
.fm 2
.sp
.ti 8
GETKEY NAMES.DAT LASTNAME 10 20
.sp
would cause GETKEY to read the data base file NAMES.DAT and
extract the LAST-NAME field from each record, starting in
position 10 and ending at character 20. GETKEY builds a table in
memory consisting of each particular LASTNAME field, along with
its 16-bit record number location within the file. The GETKEY
program then sorts this list and writes a new file, called
LASTNAME.KEY, which is an alphabetical list of LASTNAME fields
with their corresponding record numbers. This list is called an
inverted index in information retrieval parlance.
.pp
If the programmer were to rename the program shown above as QUERY
and modify it so that it reads a sorted key file into memory,
the command line might appear as
.sp
.ti 8
QUERY NAMES.DAT LASTNAME.KEY
.sp
Instead of reading a number, the QUERY program reads an
alphanumeric string that is a particular key to find in the
NAMES.DAT data base. Because the LASTNAME.KEY list is sorted, one
can find a particular entry rapidly by performing a binary
search, similar to looking up a name in the telephone book.
Starting at both ends of the list, one examines the
entry halfway in between and, if not matched, splits either the
upper half or the lower half for the next search. You will
quickly reach the item you are looking for and find the
corresponding record number. You should fetch and display
this record at the console, just as was done in the program shown
above.
.pp
With some more work, you can allow a fixed grouping size
that differs from the 128-byte record shown above. This is
accomplished by keeping track of the record number and the
byte offset within the record. Knowing the group size, you
randomly access the record containing the proper group, offset
to the beginning of the group within the record read sequentially
until the group size has been exhausted.
.pp
Finally, you can improve QUERY considerably by allowing boolean
expressions, which compute the set of records that satisfy
several relationships, such as a LASTNAME between HARDY and
LAUREL and an AGE lower than 45. Display all the records that
fit this description. Finally, if your lists are getting
too big to fit into memory, randomly access key
files from the disk as well.
.bp
.tc 5.6 System Function Summary
.he CP/M Operating System Manual 5.6 System Function Summary
.sh
5.6 System Function Summary
.qs
.sp
.nf
Function Function Input Output
Number Name
.sp
Decimal Hex
.sp
0 0 System Reset C = 00H none
1 1 Console Input C = 01H A = ASCII char
2 2 Console Output E = char none
3 3 Reader Input A = ASCII char
4 4 Punch Output E = char none
5 5 List Output E = char none
6 6 Direct Console I/O C = 06H A = char or status
E = 0FFH (input) or (no value)
0FEH (status) or
char (output)
7 7 Get I/O Byte none A = I/O byte
Value
8 8 Set I/O Byte E = I/O Byte none
9 9 Print String DE = Buffer Address none
10 A Read Console Buffer DE = Buffer Console
Characters
in Buffer
11 B Get Console Status none A = 00/non zero
12 C Return Version Number none HL: Version
Number
13 D Reset Disk System none none
14 E Select Disk E = Disk Number none
15 F Open File DE = FCB Address FF if not found
16 10 Close File DE = FCB Address FF if not found
17 11 Search For First DE = FCB Address A = Directory
Code
18 12 Search For Next none A = Directory
Code
19 13 Delete File DE = FCB Address A = none
20 14 Read Sequential DE = FCB Address A = Error Code
21 15 Write Sequential DE = FCB Address A = Error Code
22 16 Make File DE = FCB Address A = FF if no DIR
Space
23 17 Rename File DE = FCB Address A = FF in not
found
24 18 Return Login Vector none HL = Login
Vector*
25 19 Return Current Disk none A = Current Disk
Number
26 1A Set DMA Address DE = DMA Address none
27 1B Get ADDR (ALLOC) none HL = ALLOC
Address*
28 1C Write Protect Disk none none
29 1D Get Read/only Vector none HL = R/O
Vector Value*
30 1E Set File Attributes DE = FCB Address A = none
31 1F Get ADDR (Disk Parms) none HL = DPB
Address
32 20 Set/Get User Code E = 0FFH for Get User Number
E = 00 to 0FH for Set
33 21 Read Random DE = FCB Address A = Error Code
34 22 Write Random DE = FCB Address A = Error Code
35 23 Compute File Size DE = FCB Address r0, r1, r2
36 24 Set Random Record DE = FCB Address r0, r1, r2
37 25 Reset Drive DE = Drive Vector A = 0
38 26 Access Drive not supported
39 27 Free Drive not supported
40 28 Write Random with Fill DE = FCB A = Error Code
.fi
.sp 4
*Note that A = L, and B = H upon return.
.sp 2
.ce
End of Section 5
.nx sixa


693
Source/Doc/CPM 22 Manual/foura.tex

@ -1,693 +0,0 @@
.bp 1
.op
.cs 5
.mt 5
.mb 6
.pl 66
.ll 65
.po 10
.hm 2
.fm 2
.he
.ft 4-%
.pc 1
.tc 4 CP/M Dynamic Debugging Tool
.nf
.sh
Section 4
.sp
.sh
CP/M Dynamic Debugging Tool
.qs
.fi
.sp 3
.tc 4.1 Introduction
.he CP/M Operating System Manual 4.1 Introduction
.sh
4.1 Introduction
.pp 5
The DDT program allows dynamic interactive testing and debugging of
programs generated in the CP/M environment. Invoke the debugger with
a command of one of the following forms:
.sp
.in 8
.nf
DDT
DDT filename.HEX
DDT filename.COM
.fi
.in 0
.sp
where filename is the name of the program to be loaded and
tested. In both cases, the DDT program is brought into main
memory in place of the Console Command Processor (CCP) and resides
directly below the Basic Disk Operating System (BDOS)
portion of CP/M. Refer to Section 5 for standard memory
organization. The BDOS
starting address, located in the address field of the
JMP instruction at location 5H, is altered to reflect the
reduced Transient Program Area (TPA) size.
.pp
The second and third forms of the DDT command perform the same
actions as the first, except there is a subsequent automatic load
of the specified HEX or COM file. The action is identical to the
following sequence of commands:
.sp
.in 8
.nf
DDT
Ifilename.HEX or Ifilename.COM
R
.fi
.in 0
.sp
where the I and R commands set up and read the specified program
to test. See the explanation of the I and R
commands below for exact details.
.pp
Upon initiation, DDT prints a sign-on message in the form:
.sp
.ti 8
DDT VER m.m
.sp
where m.m is the revision number.
.pp
Following the sign-on message, DDT prompts you with the
hyphen character, -, and waits for input commands from the
console. You can type any of several single-character commands,
followed by a carriage return to execute the command. Each
line of input can be line-edited using the following standard
CP/M controls:
.bp
.ce
.sh
Table 4-1. Line-editing Controls
.ll 60
.sp
.in 5
.nf
Control Result
.sp
rubout removes the last character typed
CTRL-U removes the entire line, ready for retyping
CTRL-C reboots system
.fi
.in 0
.ll 65
.sp
.pp
Any command can be up to 32 characters in length. An automatic
carriage return is inserted as character 33, where the
first character determines the command type. Table 4-2 describes DDT
commands.
.sp 2
.sh
Table 4-2. DDT Commands
.sp
.nf
Command Result
Character
.fi
.sp
.ll 57
.in 16
.ti -9
A enters assembly-language mnemonics with operands.
.sp
.ti -9
D displays memory in hexadecimal and ASCII.
.sp
.ti -9
F fills memory with constant data.
.sp
.ti -9
G begins execution with optional breakpoints.
.sp
.ti -9
I sets up a standard input File Control Block.
.sp
.ti -9
L lists memory using assembler mnemonics.
.sp
.ti -9
M moves a memory segment from source to destination.
.sp
.ti -9
R reads a program for subsequent testing.
.sp
.ti -9
S substitutes memory values.
.sp
.ti -9
T traces program execution.
.sp
.ti -9
U untraced program monitoring.
.sp
.ti -9
X examines and optionally alters the CPU state.
.in 0
.ll 65
.mb 4
.fm 1
.sp 2
The command character, in some cases, is followed by zero, one,
two, or three hexadecimal values, which are separated by commas
or single blank characters. All DDT numeric output is in
hexadecimal form. The commands are not execution until the
carriage return is typed at the end of the command.
.pp
At any point in the debug run, you can stop execution of
DDT by using either a CTRL-C or G0 (jump to location 0000H) and
save the current memory image by using a SAVE command of the form:
.sp
.ti 8
SAVE n filename. COM
.sp
where n is the number of pages (256 byte blocks) to be saved on
disk. The number of blocks is determined by taking the high-order
byte of the address in the TPA and converting this number to
decimal. For example, if the highest address in the TPA is 134H,
the number of pages is 12H or 18 in decimal. You could type a
CTRL-C during the debug run, returning to the CCP level, followed
by
.mb 6
.fm 2
.sp
.ti 8
SAVE 18 X.COM
.sp
The memory image is saved as X.COM on the disk and can be
directly executed by typing the name X. If further testing is
required, the memory image can be recalled by typing
.sp
.ti 8
DDT X.COM
.sp
which reloads the previously saved program from location 100H
through page 18, 23FFH. The CPU state is not a part of the COM
file; thus, the program must be restarted from the beginning to
test it properly.
.sp 2
.tc 4.2 DDT Commands
.he CP/M Operating System Manual 4.2 DDT Commands
.sh
4.2 DDT Commands
.pp
The individual commands are detailed below. In each case, the
operator must wait for the hyphen prompt character before entering
the command. If control is passed to a program under test, and
the program has not reached a breakpoint, control can be returned
to DDT by executing a RST 7 from the front panel. In the
explanation of each command, the command letter is shown in some
cases with numbers separated by commas, the the numbers are
represented by lower-case letters. These numbers are always
assumed to be in a hexadecimal radix and from one to four digits
in length. Longer numbers are automatically truncated on the
right.
.pp
Many of the commands operate upon a CPU state that corresponds
to the program under test. The CPU state holds the registers of
the program being debugged and initially contains zeros for all
registers and flags except for the program counter, P, and stack
pointer, S, which default to 100H. The program counter is
subsequently set to the starting address given in the last record
of a HEX file if a file of this form is loaded, see the I and R
commands.
.sp 2
.tc 4.2.1 The A (Assembly) Command
.sh
4.2.1 The A (Assembly) Command
.pp
DDT allows in-line assembly language to be inserted into the
current memory image using the A command, which takes the form:
.sp
.ti 8
As
.sp
where s is the hexadecimal starting address for the in-line
assembly. DDT prompts the console with the address of the next
instruction to fill and reads the console, looking for assembly-language
mnemonics followed by register references and operands in
absolute hexadecimal form. See the \c
.ul
Intel 8080 Assembly Language Reference Card \c
.qu
for a list of mnemonics. Each
successive load address is printed before reading the console.
The A command terminates when the first empty line is input from
the console.
.pp
Upon completion of assembly language input, you can
review the memory segment using the DDT disassembler (see the L
command).
.pp
Note that the assembler/disassembler portion of
DDT can be overlaid by the transient program being tested, in
which case the DDT program responds with an error condition when
the A and L commands are used.
.sp 2
.tc 4.2.2 The D (Display) Command
.sh
4.2.2 The D (Display) Command
.pp
The D command allows you to view the contents of memory
in hexadecimal and ASCII formats. The D command takes the forms:
.sp
.in 8
.nf
D
Ds
Ds,f
.fi
.in 0
.pp
In the first form, memory is displayed from the current display
address, initially 100H, and continues for 16 display lines.
Each display line takes the followng form:
.sp
.nf
aaaa bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb cccccccccccccccc
.fi
.sp
where aaaa is the display address in hexadecimal and bb
represents data present in memory starting at aaaa. The ASCII
characters starting at aaaa are to the right (represented by the
sequence of character c) where nongraphic characters are printed as a
period. You should note that both upper- and lower-case
alphabetics are displayed, and will appear as upper-case symbols
on a console device that supports only upper-case. Each display
line gives the values of 16 bytes of data, with the first line
truncated so that the next line begins at an address that is a
multiple of 16.
.pp
The second form of the D command is similar to the first, except
that the display address is first set to address s.
.pp
The third form causes the display to continue from address s
through address f. In all cases, the display address is set to
the first address not displayed in this command, so that a
continuing display can be accomplished by issuing successive D
commands with no explicit addresses.
.pp
Excessively long displays can be aborted by pressing the return key.
.sp 2
.tc 4.2.3 The F (Fill) Command
.sh
4.2.3 The F (Fill) Command
.pp
The F command takes the form:
.sp
.ti 8
Fs,f,c,
.sp
where s is the starting address, f is the final address, and c is
a hexadecimal byte constant. DDT stores the constant c at
address s, increments the value of s and test against f. If s
exceeds f, the operation terminates, otherwise the operation is
repeated. Thus, the fill command can be used to set a memory
block to a specific constant value.
.sp 2
.tc 4.2.4 The G (Go) Command
.sh
4.2.4 The G (Go) Command
.pp
A program is executed using the G command, with up to two
optional breakpoint addresses. The G command takes the forms:
.sp 2
.in 8
.nf
G
Gs
Gs,b
Gs,b,c
G,b
G,b,c
.fi
.in 0
.sp
.pp
The first form executes the program at the current value of the
program counter in the current machine state, with no breakpoints
set. The only way to regain control in DDT is through a RST 7
execution. The current program counter can be viewed by typing
an X or XP command.
.pp
The second form is similar to the first, except that the program
counter in the current machine state is set to address s before
execution begins.
.pp
The third form is the same as the second, except that program
execution stops when address b is encountered (b must be in the
area of the program under test). The instruction at location b is
not executed when the breakpoint is encountered.
.pp
The fourth form is identical to the third, except that two
breakpoints are specified, one at b and the other at c.
Encountering either breakpoint causes execution to stop, and both
breakpoints are cleared. The last two forms take the program
counter from the current machine state and set one and two
breakpoints, respectively.
.pp
Execution continues from the starting address in real-time to the
next breakpoint. There is no intervention between the starting
address and the break address by DDT. If the program under test
does not reach a breakpoint, control cannot return to DDT without
executing a RST 7 instruction. Upon encountering a breakpoint,
DDT stops execution and types
.sp
.ti 8
*d
.sp
where d is the stop address. The machine state can be examined
at this point using the X (Examine) command. You must
specify breakpoints that differ from the program counter address
at the beginning of the G command. Thus, if the current program
counter is 1234H, then the following commands:
.sp
.nf
.in 8
G,1234
G400,400
.fi
.in 0
.sp
both produce an immediate breakpoint without executing any
instructions.
.sp 2
.tc 4.2.5 The I (Input) Command
.sh
4.2.5 The I (Input) Command
.pp
The I command allows you to insert a filename into the default
File Control Block (FCB) at 5CH. The FCB created by CP/M for
transient programs is placed at this location (see Section 5).
The default FCB can be used by the program under test as if it
had been passed by the CP/M Console Processor. Note that this
filename is also used by DDT for reading additional HEX and COM
files. The I command takes the forms:
.sp
.nf
.in 8
Ifilename
Ifilename.typ
.fi
.in 0
.pp
If the second form is used and the filetype is either HEX or COM,
subsequent R commands can be used to read the pure binary or hex
format machine code. Section 4.2.8 gives further details.
.sp 2
.tc 4.2.6 The L (List) Command
.sh
4.2.6 The L (List) Command
.pp
The L command is used to list assembly-language mnemonics in a
particular program region. The L command takes the forms:
.sp
.in 8
.nf
L
Ls
Ls,f
.fi
.in 0
.pp
The first form lists twelve lines of disassembled machine code
from the current list address. The second form sets the list
address to s and then lists twelve lines of code. The last form
lists disassembled code from s through address f. In all three
cases, the list address is set to the next unlisted location in
preparation for a subsequent L command. Upon encountering an
execution breakpoint, the list address is set to the current
value of the program counter (G and T commands). Again, long
typeouts can be aborted by pressing RETURN during the list
process.
.sp 2
.tc 4.2.7 The M (Move) Command
.sh
4.2.7 The M (Move) Command
.pp
The M command allows block movement of program or data areas from
one location to another in memory. The M command takes the form:
.sp
.ti 8
Ms,f,d
.sp
where s is the start address of the move, f is the final address,
and d is the destination address. Data is first removed from s
to d, and both addresses are incremented. If s exceeds f, the
move operation stops; otherwise, the move operation is repeated.
.sp 2
.tc 4.2.8 The R (Read) Command
.sh
4.2.8 The R (Read) Command
.pp
The R command is used in conjunction with the I command to read
COM and HEX files from the disk into the transient program
area in preparation for the debug run. The R command takes the forms:
.sp
.in 8
.nf
R
RB
.fi
.in 0
.sp
where b is an optional bias address that is added to each program
or data address as it is loaded. The load operation must not
overwrite any of the system parameters from 000H through 0FFH
(that is, the first page of memory). If b is omitted, then
b=0000 is assumed. The R command requires a previous I command,
specifying the name of a HEX or COM file. The load address for
each record is obtained from each individual HEX record, while an
assumed load address of 100H is used for COM files. Note that
any number of R commands can be issued following the I command to
reread the program under test, assuming the tested program does
not destroy the default area at 5CH. Any file specified with the
filetype COM is assumed to contain machine code in pure binary
form (created with the LOAD or SAVE command), and all others are
assumed to contain machine code in Intel hex format (produced,
for example, with the ASM command).
.pp
Recall that the command,
.sp
.ti 8
DDT filename.filetype
.sp
which initiates the DDT program, equals to the following commands:
.sp
.in 8
.nf
DDT
-Ifilename.filetype
-R
.fi
.in 0
.bp
.pp
Whenever the R command is issued, DDT responds with either the
error indicator ? (file cannot be opened, or a checksum error
occurred in a HEX file) or with a load message. The load message
takes the form:
.sp
.in 8
.nf
NEXT PC
nnnn pppp
.fi
.in 0
.sp
where nnnn is the next address following the loaded program and
pppp is the assumed program counter (100H for COM files, or
taken from the last record if a HEX file is specified).
.sp 2
.tc 4.2.9 The S (Set) Command
.sh
4.2.9 The S (Set) Command
.pp
The S command allows memory locations to be examined and
optionally altered. The S command takes the form:
.sp
.ti 8
Ss
.sp
where s is the hexadecimal starting address for examination and
alteration of memory. DDT responds with a numeric prompt, giving
the memory location, along with the data currently held in
memory. If you type a carriage return, the data is
not altered. If a byte value is typed, the value is stored at
the prompted address. In either case, DDT continues to prompt
with successive addresses and values until you type either a period
or an invalid input value is detected.
.sp 2
.tc 4.2.10 The T (Trace) Command
.sh
4.2.10 The T (Trace) Command
.pp
The T command allows selective tracing of program execution for 1
to 65535 program steps. The T command takes the forms:
.sp
.in 8
.nf
T
Tn
.fi
.in 0
.mb 4
.fm 1
.pp
In the first form, the CPU state is displayed and the next
program step is executed. The program terminates immediately,
with the termination address displayed as
.sp
.ti 8
*hhhh
.sp
where hhhh is the next address to execute. The display address
(used in the D command) is set to the value of H and L, and the
list address (used in the L command) is set to hhhh. The CPU
state at program termination can then be examined using the X
command.
.pp
The second form of the T command is similar to the first, except
that execution is traced for n steps (n is a hexadecimal value)
before a program breakpoint occurs. A breakpoint can be forced
in the trace mode by typing a rubout character. The CPU state is
displayed before each program step is taken in trace mode. The
format of the display is the same as described in the X command.
.mb 6
.fm 2
.pp
You should note that program tracing is discontinued at the
CP/M interface and resumes after return from CP/M to the program
under test. Thus, CP/M functions that access I/O devices, such
as the disk drive, run in real-time, avoiding I/O timing
problems. Programs running in trace mode execute approximately
500 times slower than real-time because DDT gets control after each
user instruction is executed. Interrupt processing routines can
be traced, but commands that use the breakpoint facility (G, T,
and U) accomplish the break using an RST 7 instruction, which
means that the tested program cannot use this interrupt location.
Further, the trace mode always runs the tested program with
interrupts enabled, which may cause problems if asynchronous
interrupts are received during tracing.
.pp
To get control back to DDT during trace, press RETURN rather than
executing an RST 7. This ensures that the trace for current
instruction is completed before interruption.
.sp 2
.tc 4.2.11 The U (Untrace) Command
.sh
4.2.11 The U (Untrace) Command
.pp
The U command is identical to the T command, except that
intermediate program steps are not displayed. The untrace mode
allows from 1 to 65535, (0FFFFH) steps to be executed in monitored
mode and is used principally to retain control of an executing
program while it reaches steady state conditions. All conditions
of the T command apply to the U command.
.sp 2
.tc 4.2.12 The X (Examine) Command
.sh
4.2.12 The X (Examine) Command
.pp
The X command allows selective display and alteration of the
current CPU state for the program under test. The X command
takes the forms:
.sp
.in 8
.nf
X
Xr
.fi
.in 0
.sp
where r is one of the 8080 CPU registers listed in the following table.
.sp 2
.sh
Table 4-3. CPU Registers
.sp
.nf
Register Meaning Value
.sp
C Carry flag (0/1)
Z Zero flag (0/1)
M Minus flag (0/1)
E Even parity flag (0/1)
I Interdigit carry (0/1)
A Accumulator (0-FF)
B BC register pair (0-FFFF)
D DE register pair (0-FFFF)
.bp
.sh
Table 4-3. (continued)
.sp
.nf
Register Meaning Value
.sp
H HL register pair (0-FFFF)
S Stack pointer (0-FFFF)
P Program counter (0-FFFF)
.fi
.sp 2
In the first case, the CPU register state is displayed in the
format:
.sp
.ti 8
CfZfMfEflf A=bb B=dddd D=dddd H=dddd S=dddd P=dddd inst
.sp
where f is a 0 or 1 flag value, bb is a byte value, and dddd is a
double-byte quantity corresponding to the register pair. The
inst field contains the disassembled instruction, that occurs at
the location addressed by the CPU state's program counter.
.pp
The second form allows display and optional alteration of
register values, where r is one of the registers given above (C,
Z, M, E, I, A, B, D, H, S, or P). In each case, the flag or
register value is first displayed at the console. The DDT
program then accepts input from the console. If a carriage
return is typed, the flag or register value is not altered. If
a value in the proper range is typed, the flag or register value
is altered. You should note that BC, DE, and HL are
displayed as register pairs. Thus, you must type the entire
register pair when B, C, or the BC pair is altered.
.sp 2
.tc 4.3 Implementation Notes
.he CP/M Operating System Manual 4.3 Implementation Notes
.sh
4.3 Implementation Notes
.pp
The organization of DDT allows certain nonessential portions to
be overlaid to gain a larger transient program area for debugging
large programs. The DDT program consists of two parts: the DDT
nucleus and the assembler/disassembler module. The DDT nucleus
is loaded over the CCP and, although loaded with the DDT nucleus,
the assembler/disassembler is overlayable unless used to assemble
or disassemble.
.pp
In particular, the BDOS address at location 6H (address field of
the JMP instruction at location 5H) is modified by DDT to address
the base location of the DDT nucleus, which, in turn, contains a
JMP instruction to the BDOS. Thus, programs that use this
address field to size memory see the logical end of memory at the
base of the DDT nucleus rather than the base of the BDOS.
.pp
The assembler/disassembler module resides directly below the DDT
nucleus in the transient program area. If the A, L, T, or X
commands are used during the debugging process, the DDT program
again alters the address field at 6H to include this module,
further reducing the logical end of memory. If a program loads
beyond the beginning of the assembler/disassembler module, the A
and L commands are lost (their use produces a ? in response)
and the trace and display (T and X) commands list the inst field
of the display in hexadecimal, rather than as a decoded
instruction.
.nx fourb


583
Source/Doc/CPM 22 Manual/fourb.tex

@ -1,583 +0,0 @@
.sp 2
.tc 4.4 A Sample Program
.he CP/M Operating System Manual 4.4 A Sample Program
.sh
4.4 A Sample Program
.pp
The following example shows an edit, assemble, and debug for a
simple program that reads a set of data values and determines the
largest value in the set. The largest value is taken from the
vector and stored into LARGE at the termination of the program.
.ll 75
.sp 2
.nf
A>\c
.sh
ED SCAN.ASM \c
.qs
Create source program;
" " represents carriage return.
*I
ORG 1-00H ;START OF TRANSIENT
;AREA
MVI B, LEN ;LENGTH OF VECTOR TO SCAN
MVI C, 0 ;LARGER_RST VALUE SO FAR
LOOP LXI H, VECT ;BASE OF VECTOR
LOOP: MOV A, M ;GET VALUE
SUB C ;LARGER VALUE IN C?
JNC NFOUND ;JUMP IF LARGER VALUE NOT
;FOUND
; NEW LARGEST VALUE, STORE IT TO C
MOV C, A
NFOUND INX H ;TO NEXT ELEMENT
DCR B ;MORE TO SCAN?
JNZ LOOP ;FOR ANOTHER
;
; END OF SCAN, STORE C
MOV A, C ;GET LARGEST VALUE
STA LARGE
JMP 0 ;REBOOT
;
; TEST DATA
VECT: DB 2,0,4,3,5,6,1,5
LEN EQU $-VECT ;LENGTH
LARGE: DS 1 ;LARGEST VALUE ON EXIT
END
.bp
^-Z
*B0P
ORG 100H ;START OF TRANSIENT AREA
MVI B,LEN ;LENGTH OF VECTOR TO SCAN
MVI C,0 ;LARGEST VALUE SO FAR
LXI H,VECT ;BASE OF VECTOR
LOOP: MOV A,M ;GET VALUE
SUB C ;LARGER VALUE IN C?
JNC NFOUND ;JUMP IF LARGER VALUE NOT
;FOUND
; NEW LARGEST VALUE, STORE IT TO C
MOV C,A
NFOUND: INX H ;TO NEXT ELEMENT
DCR B ;MORE TO SCAN?
JNZ LOOP ;FOR ANOTHER
; END OF SCAN, STORE C
MOV A,C ;GET LARGEST VALUE
STA LARGE
JMP 0 ;REBOOT
;
; TEST DATA
VECT: DB 2,0,4,3,5,6,1,5
LEN EQU $-VECT ;LENGTH
LARGE: DS 1 ;LARGEST VALUE ON EXIT
END
*E <--End of edit
A>\c
.sh
ASM SCAN \c
.qs
Start Assembler
CP/M ASSEMBLER - VER 1.0
0122
002H USE FACTOR
END OF ASSEMBLY Assembly complete; lock at program listing
A>\c
.sh
TYPE SCAN.PRN
.qs
Code address Source program
0100 ORG 100H ;START OF TRANSIENT AREA
0100 0608 MVI B,LEN ;LENGTH OF VECTOR TO SCAN
0102 0E00 Machine code MVI C,0 ;LARGEST VALUE SO FAR
0104 211901 LXI H,VECT. ;BASE OF VECTOR
0107 7E LOOP: MOV A,M ;GET VALUE
0108 91 SUB C ;LARGER VALUE IN C?
0109 D20D01 JNC NFOUND ;JUMP IF LARGER VALUE NOT
;FOUND
; NEW LARGEST VALUE, STORE IT TO C
010C 4F MOV C,A
.bp
010D 23 NFOUND: INX H ;TO NEXT ELEMENT
010E 05 DCR B ;MORE TO SCAN?
010F C20701 JNZ LOOP ;FOR ANOTHER
;
; END OF SCAN, STORE C
0112 79 MOV A,C ;GET LARGEST VALUE
0113 322101 STA LARGE
0116 C30000 JMP 0 ;REBOOT
Code--data listing;
truncated ; TEST DATA
0119 0200040305 VECT: DB 2,0,4,3,5,6,1,5
0008 = Value of LEN EQU $-VECT ;LENGTH
0121 equate LARGE: DS 1 ;LARGEST VALUE ON EXIT
0122 END
A>\c
.sh
DDT SCAN.HEX \c
.qs
Start debugger using hex format machine code
DDT VER 1.0
NEXT PC Next instruction
0121 0000 to execute at
-X Last load address + 1 PC=0
C0Z0M0E0I0 A=00 B=0000 D=0000 H=0000 S=0100 P=0000 OUT 7F
-XP Examine registers before debug run
P=0000 100 Change PC to 100
-X Look at registers again
C0Z0M0E0I0 A=00 B=0000 D=0000 H=0000 S=0100 P=0100 MVI B,08
-L100
PC changed Next instruction
to execute at PC=100
0100 MVI B,08
0102 MVI C,00
0104 LXI H,0119
0107 MOV A,M
0108 SUB C Disassembled machine
0109 JNC 010D code at 100H
010C MOV C,A (see source listing
010D INX H for comparison)
010E DCR B
010F JNZ 0107
0112 MOV A,C
-L
.bp
0113 STA 0121
0116 JMP 0000
0119 STAX B
011A NOP A little more machine
011B INR B code. Note that pro-
011C INX B gram ends at location
011D DCR B 116 with a JMP to
011E MVI B,01 0000. Remainder of
0120 DCR B listing is assembly of
0121 LXI D,2200 data.
0124 LXI H,0200
-A116 Enter in-line assembly mode to change the JMP to 0000 into a RST 7,
which will cause the program under test to return to DDT if 116H is
ever executed.
0116 RST 7
0117 (Single carriage return stops assemble mode)
-L113 List code at 113H to check that RST 7 was properly inserted
0113 STA 0121
0116 RST 07 in place of JMP
0117 NOP
0118 NOP
0119 STAX B
011A NOP
011B INR B
011C INX B
-
-X Look at registers
C0Z0M0E0I0 A=00 B=0000 D=0000 H=0000 S=0100 P=0100 MVI B,08
-T
Execute Program for one stop. Initial CPU state, before is executed
C0Z0M0E0I0 A=00 B=0000 D=0000 H=0000 S=0100 P=0100 MVI B,08*0102
Automatic breakpoint
Trace one step again (note O8H in B)
C0Z0M0E0I0 A=00 B=0800 D=0000 H=0000 S=0100 P=0102 MVI C,00*0104
-T
Trace again (Register C is cleared)
C0Z0M0E0I0 A=00 B=0800 D=0000 H=0000 S=0100 P=0104 LXI H,0119*0107
-T3 Trace three steps
C0Z0M0E0I0 A=00 B=0800 D=0000 H=0119 S=0100 P=0107 MOV A,M
C0Z0M0E0I0 A=02 B=0800 D=0000 H=0119 S=0100 P=0108 SUB C
C0Z0M0E0I1 A=02 B=0800 D=0000 H=0119 S=0100 P=0109 JNC 010D*010D
-D119
Display memory starting at 119H. Automatic breakpoint at 10DH
0119 02 00 04 03 05 06 01.Program data Lower-case x
0120 05 11 00 22 21 00 02 7E EB 77 13 23 EB 0B 78 B1 ..."!.. . W .#..X.
0130 C2 27 01 C3 03 29 00 00 00 00 00 00 00 00 00 00 ...' ...).........
0140 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ..................
0150 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ..................
0160 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 Data are displayed
0170 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 in ASCI with a "."
0180 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 in the position of
0190 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 nongraphic........
01A0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 characters........
01B0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ..................
01C0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ..................
-X
Current CPU state
C0Z0M0E0I1 A=02 B=0800 D=0000 H=0119 S=0100 P=010D INX H
-T5
Trace 5 steps from current CPU state
C0Z0M0E0I1 A=02 B=0800 D=0000 H=0119 S=0100 P=010D INX H
C0Z0M0E0I1 A=02 B=0800 D=0000 H=011A S=0100 P=010E DCR B
C0Z0M0E0I1 A=02 B=0700 D=0000 H=011A S=0100 P=010F JNZ 0107
C0Z0M0E0I1 A=02 B=0700 D=0000 H=011A S=0100 P=0107 MOV A,M
C0Z0M0E0I1 A=00 B=0700 D=0000 H=011A S=0100 P=0108 SUB C*0109
U5
Automatic breakpoint
Trace without listing intermediate states
C0Z1M0E1I1 A=00 B=0700 D=0000 H=011A S=0100 P=0109 JNC 010D*0108
-X
CPU state at end of U5
C0Z0M0E1I1 A=04 B=0600 D=0000 H=011B S=0100 P=0108 SUB C
-G Run program from current PC until completion (in real-time)
*0116 breakpoint at 116H, caused by executing RST 7 in machine code.
-X
CPU state at end of program
C0Z1M0E1I1 A=00 B=0000 D=0000 H=0121 S=0100 P=0116 RST 07
-XP
Examine and change program counter
P=0116 100
-X
C0Z1M0E1I1 A=00 B=0000 D=0000 H=0121 S=0100 P=0100 MVI B,08
-T10
First data element
Current largest value
Subtract for comparison C
Trace 10 (hexadecimal) steps
C0Z1M0E1I1 A=00 B=0800 D=0000 H=0121 S=0100 P=0100 MVI B,08
C0Z1M0E1I1 A=00 B=0000 D=0000 H=0121 S=0100 P=0102 MVI C,00
C0Z1M0E1I1 A=00 B=0800 D=0000 H=0121 S=0100 P=0104 LXI H,0119
C0Z1M0E1I1 A=00 B=0800 D=0000 H=0119 S=0100 P=0107 MOV A,M
C0Z1M0E1I1 A=02 B=0800 D=0000 H=0119 S=0100 P=0108 SUB C
C0Z0M0E0I1 A=02 B=0800 D=0000 H=0119 S=0100 P=0109 JNC 010D
C0Z0M0E0I1 A=02 B=0800 D=0000 H=0119 S=0100 P=010D INX H
C0Z0M0E0I1 A=02 B=0800 D=0000 H=011A S=0100 P=010E DCR B
C0Z0M0E0I1 A=02 B=0700 D=0000 H=011A S=0100 P=010F JNZ 0107
C0Z0M0E0I1 A=02 B=0700 D=0000 H=011A S=0100 P=0107 MOV A,M
C0Z0M0E0I1 A=00 B=0700 D=0000 H=011A S=0100 P=0108 SUB C
C0Z1M0E1I1 A=00 B=0700 D=0000 H=011A S=0100 P=0109 JNC 010D
C0Z1M0E1I1 A=00 B=0700 D=0000 H=011A S=0100 P=010D INX H
C0Z1M0E1I1 A=00 B=0700 D=0000 H=011B S=0100 P=010E DCR B
C0Z0M0E1I1 A=00 B=0600 D=0000 H=011B S=0100 P=010F JNZ 0107
C0Z0M0E1I1 A=00 B=0600 D=0000 H=011B S=0100 P=0107 MOV A,M*0108
-A109
Insert a "hot patch" into Program should have moved the
the machine code value from A into C since A>C.
0109 JC 10D to change the Since this code was not executed,
JNC to JC it appears that the JNC should
010C have been a JC instruction
Stop DDT so that a version of
-G0 the patched program can be saved
A>\c
.sh
SAVE 1 SCAN.COM \c
.qs
Program resides on first
page, so save 1 page.
A>\c
.sh
DDT SCAN.COM
.qs
Restart DDT with the save memory
DDT VER 1.0 image to continue testing
NEXT PC
0200 0100
-L100 List some code
0100 MVI B,08
0102 MVI C,00
0104 LXI H,0119
0107 MOV A,M
0108 SUB C
0109 JC 010D Previous patch is present in X.COM
010C MOV C,A
010D INX H
010E DCR B
010F JNZ 0107
0112 MOV A,C
-XP
P=0100
-T10
Trace to see how patched version operates Data is moved from A to C
C0Z0M0E0I0 A=00 B=0000 D=0000 H=0000 S=0100 P=0100 MVI B,08
C0Z0M0E0I0 A=00 B=0800 D=0000 H=0000 S=0100 P=0102 MVI C,00
C0Z0M0E0I0 A=00 B=0800 D=0000 H=0000 S=0100 P=0104 LXI H,0119
C0Z0M0E0I0 A=00 B=0800 D=0000 H=0119 S=0100 P=0107 MOV A,M
C0Z0M0E0I0 A=02 B=0800 D=0000 H=0119 S=0100 P=0108 SUB C
C0Z0M0E0I1 A=02 B=0800 D=0000 H=0119 S=0100 P=0109 JC 010D
C0Z0M0E0I1 A=02 B=0800 D=0000 H=0119 S=0100 P=010C MOV C,A
C0Z0M0E0I1 A=02 B=0802 D=0000 H=0119 S=0100 P=010D INX H
C0Z0M0E0I1 A=02 B=0802 D=0000 H=011A S=0100 P=010E DCR B
C0Z0M0E0I1 A=02 B=0702 D=0000 H=011A S=0100 P=010F JNZ 0107
C0Z0M0E0I1 A=02 B=0702 D=0000 H=011A S=0100 P=0107 MOV A,M
C0Z0M0E0I1 A=00 B=0702 D=0000 H=011A S=0100 P=0108 SUB C
C1Z0M1E0I0 A=FE B=0702 D=0000 H=011A S=0100 P=0109 JC 010D
C1Z0M1E0I0 A=FE B=0702 D=0000 H=011A S=0100 P=010D INX H
C1Z0M1E0I0 A=FE B=0702 D=0000 H=011B S=0100 P=010E DCR B
C1Z0M0E1I1 A=FE B=0602 D=0000 H=011B S=0100 P=010F JNZ 0107*0107
-X Breakpoint after 16 steps
C1Z0M0E1I1 A=FE B=0602 D=0000 H=011B S=0100 P=0107 MOV A,M
-G,108 Run from current PC and breakpoint at 108H
*0108
-X
Next data item
C1Z0M0E1I1 A=04 B=0602 D=0000 H=011B S=0100 P=0108 SUB C
-T
Single step for a few cycles
C1Z0M0E1I1 A=04 B=0602 D=0000 H=011B S=0100 P=0108 SUB C*0109
-T
C0Z0M0E0I1 A=02 B=0602 D=0000 H=011B S=0100 P=0109 JC 010D*010C
-X
C0Z0M0E0I1 A=02 B=0602 D=0000 H=011B S=0100 P=010C MOV C,A
-G Run to completion
*0116
-X
C0Z1M0E1I1 A=03 B=0003 D=0000 H=0121 S=0100 P=0116 RST 07
-S121 Look at the value of "LARGE"
0121 03 Wrong value!
0122 00
0123 22
0124 21
0125 00
0126 02
0127 7E _\b. End of the S command
-L100
0100 MVI B,08
0102 MVI C,00
0104 LXI H,0119
0107 MOV A,M
0108 SUB C
0109 JC 010D
010C MOV C,A
010D INX H
010E DCR B
010F JNZ 0107
0112 MOV A,C
-L Review the code
0113 STA 0121
0116 RST 07
0117 NOP
0118 NOP
0119 STAX B
011A NOP
011B INR B
011C INX B
011D DCR B
011E MVI B,01
0120 DCR B
-XP
P=0116 100 Reset the PC
-T
Single step, and watch data values
C0Z1M0E1I1 A=03 B=0003 D=0000 H=0121 S=0100 P=0100 MVI B,08*0102
-T
C0Z1M0E1I1 A=03 B=0803 D=0000 H=0121 S=0100 P=0102 MVI C,00*0104
-T
Count set Largest set
C0Z1M0E1I1 A=03 B=0800 D=0000 H=0121 S=0100 P=0104 LXI H,0119*0107
-T
Base address of data set
C0Z1M0E1I1 A=03 B=0800 D=0000 H=0119 S=0100 P=0107 MOV A,M*0108
-T
First data item brought to A
C0Z1M0E1I1 A=02 B=0800 D=0000 H=0119 S=0100 P=0108 SUB C*0109
-T
C0Z0M0E0I1 A=02 B=0800 D=0000 H=0119 S=0100 P=0109 JC 010D*010C
-T
C0Z0M0E0I1 A=02 B=0800 D=0000 H=0119 S=0100 P=010C MOV C,A*010D
-T
First data item moved to C correctly
C0Z0M0E0I1 A=02 B=0802 D=0000 H=0119 S=0100 P=010D INX H*010E
-T
C0Z0M0E0I1 A=02 B=0802 D=0000 H=011A S=0100 P=010E DCR B*010F
-T
C0Z0M0E0I1 A=02 B=0702 D=0000 H=011A S=0100 P=010F JNZ 0107*0107
-T
C0Z0M0E0I1 A=02 B=0702 D=0000 H=011A S=0100 P=0107 MOV A,M*0108
-T
Second data item brought to A
C0Z0M0E0I1 A=00 B=0702 D=0000 H=011A S=0100 P=0108 SUB C*0109
-T
Subtract destroys data value that was loaded!
C1Z0M1E0I0 A=FE B=0702 D=0000 H=011A S=0100 P=0109 JC 010D*010D
-T
C1Z0M1E0I0 A=FE B=0702 D=0000 H=011A S=0100 P=010D INX H*010E
-L100
0100 MVI B,08
0102 MVI C,00
0104 LXI H,0119
0107 MOV A,M
0108 SUB C This should have been a CMP so that register A
0109 JC 010D would not be destroyed.
010C MOV C,A
010D INX H
010E DCR B
010F JNZ 0107
0112 MOV A,C
-A108
0108 CMP C Hot patch at 108H changes SUB to CMP
0109
-G0 Stop DDT for SAVE
A>\c
.sh
SAVE 1 SCAN.COM \c
.qs
Save memory image
A>\c
.sh
DDT SCAN.COM \c
.qs
Restart DDT
DDT VER 1.0
NEXT PC
0200 0100
-XP
P=0100
-L116
.mb 5
.fm 1
0116 RST 07
0117 NOP
0118 NOP Look at code to see if it was properly loaded
0119 STAX B (long typeout aborted with rubout)
011A NOP
-
-G,116 Run from 100H to completion
*0116
-XC Look at carry (accidental typo)
C1
-X Look at CPU state
.mb 6
.fm 2
C1Z1M0E1I1 A=06 B=0006 D=0000 H=0121 S=0100 P=0116 RST 07
-S121 Look at "large"--it appears to be correct.
0121 06
0122 00
0123 22
-G0 Stop DDT
A>\c
.sh
ED SCAN.ASM \c
.qs
Re-edit the source program, and make both changes
*NSUB
*0LT
CTRL-Z SUB C ;LARGER VALUE IN C?
*SSUB^\b|ZCMP^\b|Z0LT
CMP D ;LARGER VALUE IN C?
*
JNC NFOUND ;JUMP IF LARGER VALUE NOT FOUND
*SNC^\b|ZC^\b|Z0LT
JC NFOUND ;JUMP IF LARGER VALUE NOT FOUND
*E
Reassemble, selecting source from disk A
A>\c
.sh
ASM SCAN.AAZ \c
.qs
<--- Hex to disk A
Print to Z (selects no print file)
CP/M ASSEMBLER VER 1.0
0122
002H USE FACTOR
END OF ASSEMBLY
A>\c
.sh
DDT SCAN.HEX \c
.qs
Rerun debugger to check changes
DDT VER 1.0
NEXT PC
0121 0000
-L116
0116 JMP 0000 Check to ensure end is still at 116H
0119 STAX B
011A NOP
011B INR B
-(rubout)
-G100,116 Go from beginning with breakpoint at end
*0116 Breakpoint reached
-D121 Look at "LARGE"
Correct value computed
0121 06 00 22 21 00 02 7E EB 77 13 23 EB 0B 78 B1 .. '!... W .#..X.
0130 C2 27 01 C3 03 29 00 00 00 00 00 00 00 00 00 00 .'...)........
0140 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ..............
-(rubout) Aborts long typeout
G0 Stop DDT, debug session complete.
.ll 65
.sp 2
.ce
End of Section 4
.nx fivea


447
Source/Doc/CPM 22 Manual/front.tex

@ -1,447 +0,0 @@
.op
.sp 15
.ce 100
.sh
CP/M
.sp
.sh
Operating System
.sp
.sh
Manual
.cs 5
.sp 10
Copyright (c) 1982
.sp
Digital Research
P.O. Box 579
160 Central Avenue
Pacific Grove, CA 93950
(408) 649-3896
TWX 910 360 5001
.sp 4
All Rights Reserved
.ce 0
.bp
.po 17
.ll 50
.ce
COPYRIGHT
.sp
Copyright (c) 1976, 1977, 1978, 1979, 1982, 1983, and 1984 by
Digital Research Inc. All rights reserved. No part of this
publication may be reproduced, transmitted, transcribed, stored
in a retrieval system, or translated into any language or
computer language, in any form or by any means, electronic, mechanical,
magnetic, optical, chemical, manual or otherwise, without the prior
written permission of Digital Research Inc., Post Office Box 579,
Pacific Grove, California, 93950.
.sp
Thus, readers are granted permission to include the example
programs, either in whole or in part, in their own programs.
.sp 2
.ce
DISCLAIMER
.sp
Digital Research Inc. makes no representations or warranties with
respect to the contents hereof and specifically disclaims
any implied warranties of merchantability or fitness for
any particular purpose. Further, Digital Research Inc. reserves the
right to revise this publication and to make changes from
time to time in the content hereof without obligation of
Digital Research Inc. to notify any person of such revision or
changes.
.sp 2
.ce
TRADEMARKS
.sp
CP/M, CP/NET, and Digital Research and its logo are registered
trademarks of Digital Research. ASM, DESPOOL, DDT, LINK-80, MAC,
MP/M, PL/I-80 and SID are trademarks of Digital Research. IBM is
a registered trademark of International Business Machines. Intel
is a registered trademark of Intel Corporation. TI Silent 700 is
a trademark of Texas Instruments Incorporated. Zilog and Z80 are
registered trademarks of Zilog, Inc.
.mb 4
.fm 1
.sp 3
The \c
.ul
CP/M Operating System Manual \c
.qu
was prepared using the Digital Research TEX Text Formatter and printed
in the United States of America.
.sp 2
.ce 6
*********************************
* First Edition: 1976 *
* Second Edition: July 1982 *
* Third Edition: March 1983 *
* Fourth Edition: March 1984 *
*********************************
.po 10
.ll 65
.in 0
.bp
.cs 5
.mt 5
.mb 6
.pl 66
.ll 65
.po 10
.hm 2
.fm 2
.he
.ft iii
.bp
.ce
.sh
Table of Contents
.sp 3
.nf
.sh
1 CP/M Features and Facilities
.sp
1.1 Introduction . . . . . . . . . . . . . . . . . . . 1-1
.sp
1.2 Functional Description . . . . . . . . . . . . . . 1-3
.sp
1.2.1 General Command Structure . . . . . . . . . 1-3
1.2.2 File References . . . . . . . . . . . . . . 1-3
.sp
1.3 Switching Disks . . . . . . . . . . . . . . . . . . 1-5
1.4 Built-in Commands . . . . . . . . . . . . . . . . . 1-6
.sp
1.4.1 ERA Command . . . . . . . . . . . . . . . . 1-6
1.4.2 DIR Command . . . . . . . . . . . . . . . . 1-7
1.4.3 REN Command . . . . . . . . . . . . . . . . 1-8
1.4.4 SAVE Command . . . . . . . . . . . . . . . . 1-8
1.4.5 TYPE Command . . . . . . . . . . . . . . . . 1-9
1.4.6 USER Command . . . . . . . . . . . . . . . . 1-9
.sp
1.5 Line Editing and Output Control . . . . . . . . . . 1-10
.sp
1.6 Transient Commands . . . . . . . . . . . . . . . . 1-11
.sp
1.6.1 STAT Command . . . . . . . . . . . . . . . . 1-12
1.6.2 ASM Command . . . . . . . . . . . . . . . . 1-18
1.6.3 LOAD Command . . . . . . . . . . . . . . . . 1-19
1.6.4 PIP . . . . . . . . . . . . . . . . . . . . 1-20
1.6.5 ED Command . . . . . . . . . . . . . . . . . 1-29
1.6.6 SYSGEN Command . . . . . . . . . . . . . . . 1-31
1.6.7 SUBMIT Command . . . . . . . . . . . . . . . 1-33
1.6.8 DUMP Command . . . . . . . . . . . . . . . . 1-35
1.6.9 MOVCPM Command . . . . . . . . . . . . . . . 1-35
.sp
1.7 BDOS Error Messages . . . . . . . . . . . . . . . . 1-37
.sp
1.8 CP/M Operation on the Model 800 . . . . . . . . . . 1-38
.sp 2
.sh
2 The CP/M Editor
.sp
2.1 Introduction to ED . . . . . . . . . . . . . . . . 2-1
.sp
2.1.1 ED Operation . . . . . . . . . . . . . . . . 2-1
2.1.2 Text Transfer Functions . . . . . . . . . . 2-3
2.1.3 Memory Buffer Organization . . . . . . . . . 2-4
2.1.4 Line Numbers and ED Start-up . . . . . . . . 2-5
2.1.5 Memory Buffer Operation . . . . . . . . . . 2-6
2.1.6 Command Strings . . . . . . . . . . . . . . 2-7
2.1.7 Text Search and Alteration . . . . . . . . . 2-10
2.1.8 Source Libraries . . . . . . . . . . . . . . 2-13
2.1.9 Repetitive Command Execution . . . . . . . . 2-14
.bp
.ft iv
.ce
.sh
Table of Contents
.qs
.sp
.ce
.sh
(continued)
.qs
.sp 3
2.2 ED Error Conditions . . . . . . . . . . . . . . . . 2-14
.sp
2.3 Control Characters and Commands . . . . . . . . . . 2-16
.sp 2
.sh
3 CP/M Assembler
.qs
.sp
3.1 Introduction . . . . . . . . . . . . . . . . . . . 3-1
.sp
3.2 Program Format . . . . . . . . . . . . . . . . . . 3-3
.sp
3.3 Forming the Operand . . . . . . . . . . . . . . . . 3-4
.sp
3.3.1 Labels . . . . . . . . . . . . . . . . . . . 3-4
3.3.2 Numeric Constants . . . . . . . . . . . . . 3-5
3.3.3 Reserved Words . . . . . . . . . . . . . . . 3-5
3.3.4 String Constants . . . . . . . . . . . . . . 3-6
3.3.5 Arithmetic and Logical Operators . . . . . . 3-7
3.3.6 Precedence of Operators . . . . . . . . . . 3-8
.sp
3.4 Assembler Directives . . . . . . . . . . . . . . . 3-9
.sp
3.4.1 The ORG Directive . . . . . . . . . . . . . 3-10
3.4.2 The END Directive . . . . . . . . . . . . . 3-10
3.4.3 The EQU Directive . . . . . . . . . . . . . 3-11
3.4.4 The SET Directive . . . . . . . . . . . . . 3-11
3.4.5 The IF and ENDIF Directives . . . . . . . . 3-12
3.4.6 The DB Directive . . . . . . . . . . . . . . 3-13
3.4.7 The DW Directive . . . . . . . . . . . . . . 3-14
3.4.8 The DS Directive . . . . . . . . . . . . . . 3-14
.sp
3.5 Operation Codes . . . . . . . . . . . . . . . . . . 3-15
.sp
3.5.1 Jumps, Calls, and Returns . . . . . . . . . 3-15
3.5.2 Immediate Operand Instructions . . . . . . . 3-17
3.5.3 Increment and Decrement Instructions . . . . 3-17
3.5.4 Data Movement Instructions . . . . . . . . . 3-18
3.5.5 Arithmetic Logic Unit Operations . . . . . . 3-19
3.5.6 Control Instructions . . . . . . . . . . . . 3-21
.sp
3.6 Error Messages . . . . . . . . . . . . . . . . . . 3-21
.sp
3.7 A Sample Session . . . . . . . . . . . . . . . . . 3-23
.bp
.ft v
.ce
.sh
Table of Contents
.qs
.sp
.ce
.sh
(continued)
.qs
.sp 3
.sh
4 CP/M Dynamic Debugging Tool
.qs
.sp
4.1 Introduction . . . . . . . . . . . . . . . . . . . 4-1
.sp
4.2 DDT Commands . . . . . . . . . . . . . . . . . . . 4-3
.sp
4.2.1 The A (Assembly) Command . . . . . . . . . . 4-3
4.2.2 The D (Display) Command . . . . . . . . . . 4-4
4.2.3 The F (Fill) Command . . . . . . . . . . . . 4-5
4.2.4 The G (Go) Command . . . . . . . . . . . . . 4-5
4.2.5 The I (Input) Command . . . . . . . . . . . 4-6
4.2.6 The L (List) Command . . . . . . . . . . . . 4-6
4.2.7 The M (Move) Command . . . . . . . . . . . . 4-7
4.2.8 The R (Read) Command . . . . . . . . . . . . 4-7
4.2.9 The S (Set) Command . . . . . . . . . . . . 4-8
4.2.1- The T (Trace) Command . . . . . . . . . . . 4-8
4.2.11 The U (Untrace) Command . . . . . . . . . . 4-9
4.2.12 The X (Examine) Command . . . . . . . . . . 4-9
.sp
4.3 Implementation Notes . . . . . . . . . . . . . . . 4-10
.sp
4.4 A Sample Program . . . . . . . . . . . . . . . . . 4-11
.sp 2
.sh
5 CP/M 2 System Interface
.qs
.sp
5.1 Introduction . . . . . . . . . . . . . . . . . . . 5-1
.sp
5.2 Operating System Call Conventions . . . . . . . . . 5-3
.sp
5.3 A Sample File-to-File Copy Program . . . . . . . . 5-35
.sp
5.4 A Sample File Dump Utility . . . . . . . . . . . . 5-38
.sp
5.5 A Sample Random Access Program . . . . . . . . . . 5-42
.sp
5.6 System Function Summary . . . . . . . . . . . . . . 5-50
.sp 2
.sh
6 CP/M 2 Alteration
.qs
.sp
6.1 Introduction . . . . . . . . . . . . . . . . . . . 6-1
.sp
6.2 First-level System Regeneration . . . . . . . . . . 6-2
.sp
6.3 Second-level System Generation . . . . . . . . . . 6-5
.sp
6.4 Sample GETSYS and PUTSYS Programs . . . . . . . . . 6-9
.bp
.ft vi
.ce
.sh
Table of Contents
.qs
.sp
.ce
.sh
(continued)
.qs
.sp 3
6.5 Disk Organization . . . . . . . . . . . . . . . . . 6-11
.sp
6.6 The BIOS Entry Points . . . . . . . . . . . . . . . 6-13
.sp
6.7 A Sample BIOS . . . . . . . . . . . . . . . . . . . 6-21
.sp
6.8 A Sample Cold Start Loader . . . . . . . . . . . . 6-21
.sp
6.9 Reserved Locations in Page Zero . . . . . . . . . . 6-22
.sp
6.10 Disk Parameter Tables . . . . . . . . . . . . . . 6-23
.sp
6.11 The DISKDEF Macro Library . . . . . . . . . . . . 6-28
.sp
6.12 Sector Blocking and Deblocking . . . . . . . . . . 6-32
.bp
.ft vii
.ce
.sh
Appendixes
.qs
.sp 3
.sh
A \c
.qs
Basic Input/Output System (BIOS) . . . . . . . . . . . A-1
.sp 2
.sh
B \c
.qs
A Skeletal CBIOS . . . . . . . . . . . . . . . . . . . B-1
.sp 2
.sh
C \c
.qs
A Skeletal GETSYS/PUTSYS Program . . . . . . . . . . . C-1
.sp 2
.sh
D \c
.qs
The Model 800 Cold Start Loader for CP/M 2 . . . . . . D-1
.sp 2
.sh
E \c
.qs
A Skeletal Cold Start Loader . . . . . . . . . . . . . E-1
.sp 2
.sh
F \c
.qs
CP/M Disk Definition Library . . . . . . . . . . . . . F-1
.sp 2
.sh
G \c
.qs
Blocking and Deblocking Algorithms . . . . . . . . . . G-1
.sp 2
.sh
H \c
.qs
Glossary . . . . . . . . . . . . . . . . . . . . . . . H-1
.sp 2
.sh
I \c
.qs
CP/M Error Messages . . . . . . . . . . . . . . . . . . I-1
.bp
.ft viii
.ce
.sh
Tables, Figures, and Listings
.qs
.sp 3
.sh
Tables
.qs
.sp
1-1. Line-editing Control Characters . . . . . . . . 1-10
1-2. CP/M Transient Commands . . . . . . . . . . . . 1-11
1-3. Physical Devices . . . . . . . . . . . . . . . 1-14
1-4. PIP Parameters . . . . . . . . . . . . . . . . 1-24
.sp
2-1. ED Text Transfer Commands . . . . . . . . . . . 2-3
2-2. Editing Commands . . . . . . . . . . . . . . . 2-6
2-3. Line-editing Controls . . . . . . . . . . . . . 2-7
2-4. Error Message Symbols . . . . . . . . . . . . . 2-13
2-5. ED Control Characters . . . . . . . . . . . . . 2-14
2-6. ED Commands . . . . . . . . . . . . . . . . . . 2-15
.sp
3-1. Reserved Characters . . . . . . . . . . . . . . 3-6
3-2. Arithmetic and Logical Operators . . . . . . . 3-7
3-3. Assembler Directives . . . . . . . . . . . . . 3-9
3-4. Jumps, Calls, and Returns . . . . . . . . . . . 3-15
3-5. Immediate Operand Instructions . . . . . . . . 3-16
3-6. Increment and Decrement Instructions . . . . . 3-17
3-7. Data Movement Instructions . . . . . . . . . . 3-17
3-8. Arithmetic Logic Unit Operations . . . . . . . 3-18
3-9. Error Codes . . . . . . . . . . . . . . . . . . 3-20
3-10. Error Messages . . . . . . . . . . . . . . . . 3-21
.sp
4-1. Line-editing Controls . . . . . . . . . . . . . 4-2
4-2. DDT Commands . . . . . . . . . . . . . . . . . 4-2
4-3. CPU Registers . . . . . . . . . . . . . . . . . 4-9
.sp
5-1. CP/M Filetypes . . . . . . . . . . . . . . . . 5-6
5-2. File Control Block Fields . . . . . . . . . . . 5-7
5-3. Edit Control Characters . . . . . . . . . . . . 5-20
.sp
6-1. Standard Memory Size Values . . . . . . . . . . 6-2
6-2. Common Values for CP/M Systems . . . . . . . . 6-7
6-3. CP/M Disk Sector Allocation . . . . . . . . . . 6-11
6-4. IOBYTE Field Values . . . . . . . . . . . . . . 6-15
6-5. BIOS Entry Points . . . . . . . . . . . . . . . 6-16
6-6. Reserved Locations in Page Zero . . . . . . . . 6-21
6-7. Disk Parameter Headers . . . . . . . . . . . . 6-23
6-8. BSH and BLM Values . . . . . . . . . . . . . . 6-25
6-9. EXM Values . . . . . . . . . . . . . . . . . . 6-25
6-10. BLS Tabluation . . . . . . . . . . . . . . . . 6-26
.sp
I-1. CP/M Error Messages . . . . . . . . . . . . . . I-1
.sp 2
.sh
Figures
.qs
.sp
2-1. Overall ED Operation . . . . . . . . . . . . . 2-2
2-2. Memory Buffer Organization . . . . . . . . . . 2-2
.bp
.ft ix
.ce
.sh
Tables, Figures, and Listings
.qs
.sp
.ce
.sh
(continued)
.qs
.sp 3
.sh
Figures
.qs
.sp
2-3. Logical Organization of Memory Buffer . . . . . 2-4
.sp
5-1. CP/M Memory Organization . . . . . . . . . . . 5-1
5-2. File Control Block Format . . . . . . . . . . . 5-7
.sp
6-1. IOBYTE Fields . . . . . . . . . . . . . . . . . 6-15
6-2. Disk Parameter Header Format . . . . . . . . . 6-22
6-3. Disk Parameter Header Table . . . . . . . . . . 6-23
6-4. Disk Parameter Block Format . . . . . . . . . . 6-24
6-5. AL0 and AL1 . . . . . . . . . . . . . . . . . . 6-25
.sp 2
.sh
Listings
.qs
.sp
6-1. GETSYS Program . . . . . . . . . . . . . . . . 6-9
6-2. BIOS Entry Points . . . . . . . . . . . . . . . 6-13
.nx onea


468
Source/Doc/CPM 22 Manual/index.tex

@ -1,468 +0,0 @@
.bp 1
.op
.cs 5
.mt 5
.mb 6
.pl 66
.ll 65
.po 10
.hm 2
.fm 2
.he
.ft Index-%
.nf
.ce
.sh
Index
.qs
.sp 3
.sh
A
.qs
Absolute line number, 36
Access mode, 13
afn (ambiguous file
reference), 3, 4, 6
Allocation vector, 105
Ambiguous file reference
(afn), 3, 4, 6
ASM, 15, 47
Assembler, 15, 47
Assembler/disassembler module
(DDT), 77
Assembler errors, 62
Assembly language mnemonics
in DDT, 71, 74
Assembly language program, 49
Assembly language statement, 49
Automatic command
processing, 25
.sp
.sh
B
.qs
.sp
Base, 50
Basic Disk Operating System
(BDOS), 2, 89, 127
Basic I/O System (BIOS),
2, 89, 127
BDOS (Basic Disk Operating
System), 2, 89, 127
Binary constants, 50
BIOS (Basic I/O System),
2, 89, 127
BIOS disk definition, 137, 148
subroutines
Block move command, 74
bls parameter, 149
BOOT, 90, 136, 140
entry point
Break point, 71, 73
Built-in commands, 3
.sp
.sh
C
.qs
.sp
Case translation, 5, 6, 20,
37, 39, 44, 45, 51, 95
CCP (Console Command
Processor), 2, 69, 89, 127
CCP Stack, 92
Character pointer, 35
CKS parameter, 149
Close File function, 101
Code and data areas, 144
Cold start loader, 136,
140, 143
Combine files, 17
Command, 3
Command line, 90
Comment field, 49
Compute File Size
function, 108
Condition flags, 58, 77
Conditional assembly, 56
CONIN, 140
CONOUT, 141
CONSOLE, 138
Console Command Processor
(CCP), 2, 69, 89, 127
Console Input function, 95
Console Output function, 96
CONST, 140
Constant, 50
Control characters, 9,
Control functions, 9
CTRL-Z character, 93
Copy files, 17
CPU state, 71
cr (carriage return), 39
Create files, 23
Create system disk, 24
Creating COM files, 16
Currently logged disk,
3, 5, 10, 17, 25
.sp
.sh
D
.qs
.sp
Data allocation size, 147
Data block number, 147
DB statement, 57
DDT commands, 70, 133
DDT nucleus, 77
DDT prompt, 70
DDT sign-on message, 69
Decimal constant, 50
Default FCB, 73
Delete File function, 102
DESPOOL, 138
Device assignment, 11
DIR, 6
DIR attribute, 14
dir parameter, 149
Direct console I/O
function, 97
Direct Memory Address, 104
Directory, 6
Directory code, 100, 101,
102, 103
Disassembler, 71, 77
Disk attributes, 11
Disk drive name, 5
Disk I/O functions, 99-110
Disk parameter block, 146
Disk parameter header, 145
Disk parameter table, 145
Disk statistics, 10
Disk-to-disk copy, 18
DISKDEF macro, 149
Diskette format, 31
DISKS macro, 150, 186
Display file contents, 8
dks parameter, 149
DMA, 104
DMA address, 93
dn parameter, 149
DPBASE, 146
Drive characteristics, 14
Drive select code, 94
Drive specification, 5
DS statement, 57
DUMP, 27, 113
DW statement, 57
.sp
.sh
E
.qs
.sp
ED, 23, 33-45, 131
ED commands, 38, 44
ED errors, 43
Edit command line, 9
8080 CPU registers, 76
8080 registers, 51
end-of-file, 19, 93
END statement, 49, 54
EMDEF macro, 150
ENDIF statement, 56
EQU statement, 55
ERA, 6
Erase files, 6
Error messages, 29, 43,
62, 153
Expression, 49
Extents, 13
.sp
.sh
F
.qs
.sp
FBASE, 89
FCB, 93, 94
FCB format, 93, 94
FDOS (operations), 89, 91
File attributes, 14
File compatibility, 23
File control block (FCB),
93, 94
File expansion, 128
File extent, 93
File indicators, 14
File names, 3
File reference, 3
File statistics, 10, 13
Filetype, 93
Find command, 39
fsc parameter, 149
.sp
.sh
G
.qs
.sp
Get ADDR (Alloc) function,
105
Get ADDR (Disk Parms)
function, 106
Get Console Status, 99
Get I/O Byte function, 97
Get Read/Only Vector
function, 105
GETSYS, 128, 134
.sp
.sh
H
.qs
.sp
Hexadecimal, 49, 50
Hex files, 16, 19, 20, 47
HOME subroutine, 139, 141
.sp
.sh
I
.qs
.sp
Identifier, 49, 50
IF statement, 56
Initialized storage areas, 57
In-line assembly language, 71
Insert mode, 37
Insert String, 40
IOBYTE function, 138, 139
.sp
.sh
J
.qs
.sp
Jump vector, 137
Juxtaposition command,41
.sp
.sh
K
.qs
.sp
Key fields, 109
.sp
.sh
L
.qs
.sp
Label field, 49
Labels, 48, 49, 58
Library read command, 42
Line-editing control
characters, 38, 70, 98
Line-editing functions, 9
Line numbers, 36
LIST, 138, 141
List Output function, 96
LISTST, 142
LOAD, 16
Logged in, 3
Logical devices, 11, 18, 138
Logical extents, 93
Logical-physical assignments,
12, 139
Logical to physical device
mapping, 138
Logical to physical sector
translation, 143, 149
Isc parameter, 149
.sp
.sh
M
.qs
.sp
Machine executable code, 16
Macro command, 42
Make File function, 103
Memory buffer, 33, 34, 35, 37
Memory image, 71, 131, 132
Memory image file, 16
Memory size, 27, 128, 132
MOVCPM, 27, 131, 132
Multiple command
processing, 25
.sp
.sh
N
.qs
.sp
{o} parameter, 149
Octal constant, 50
ofs parameter, 150
On-line status, 100
Open File function, 100
Operand field, 49-51
Operation field, 49-58
Operators, 52, 53, 58
ORG directive, 54
.sp
.sh
P
.qs
.sp
Page zero, 144
Patching the CP/M system, 128
Peripheral devices, 138
Physical devices, 12, 18, 139
Physical file size, 109
Physical to logical device
assignment, 12, 139
PIP, 17
PIP devices, 19
PIP parameters, 20
Print String function, 98
PRN file, 47
Program counter, 71, 73, 76
Program tracing, 75
Prompt, 3
Pseudo-operation, 53
PUNCH, 138, 141
Punch Output function, 96
PUTSYS, 129, 135
.sp
.sh
R
.qs
.sp
Radix indicators, 50
Random access, 107, 108, 117
Random record number, 108
READ, 142
Read Console Buffer
function, 98
Read only, 14
Read/only status, 14
Read random error codes, 107
Read Random function, 107
READ routine, 139
Read Sequential function, 102
Read/write, 14
READER, 138, 141
Reader Input function, 96
REN, 7
Rename file function, 104
Reset Disk function, 99
Reset Drive function, 109
Reset state, 99
Return Current Disk
function, 104
Return Log-in Vector
function, 104
Return Version Number
function, 99
R/O, 14
R/O, attribute, 106
R/O bit, 105
R/W, 14
.sp
.sh
S
.qs
.sp
SAVE, 7
SAVE command, 70
Search for First function, 101
Search for Next function, 102
Search strings, 39
Sector allocation, 136
SECTRAN, 143
SELDSK, 139, 141, 146
Select Disk function, 100
Sequential access, 93
Set DMA address function, 104
Set File Attributes
function, 106
Set/GET User Code
function, 106
Set I/O Byte function, 97
Set Random Record
function, 109
SET statement, 55
SETDMA, 142
SETSEC, 142
SETTRK, 141
Simple character I/O, 138
Size in records, 13
skf parameter, 149, 150
Source files, 93
Stack pointer, 92
STAT, 10, 139, 151
Stop console output, 9
String substitutions, 40
SUBMIT, 25
SYS attribute, 14
SYSGEN, 24, 134
System attribute, 44, 106
System parameters, 140
System (re)initialization, 138
System Reset function, 95
.sp
.sh
T
.qs
.sp
Testing and debugging of
programs, 69
Text transfer commands, 35
TPA (Transient Program Area),
2, 89
Trace mode, 76
Transient commands, 3, 9
Transient Program Area
(TPA), 2, 89
Translate table, 150
Translation vectors, 146
TYPE, 8
.sp
.sh
U
.qs
.sp
ufn, 3, 6
Unambiguous file reference,
3, 6
Uninitialized memory, 57
Untrace mode, 76
USER, 8
USER numbers, 8, 15, 106
.sp
.sh
V
.qs
.sp
Verify line numbers command,
37, 45
Version independent
programming, 99
Virtual file size, 108
.sp
.sh
W
.qs
.sp
Warm start, 90, 140
WBOOT entry point, 140
WRITE, 142
Write Protect Disk
function, 105
Write random error codes, 108
Write Random function, 108
Write Random with Zero Fill
function, 110
Write routine, 142
Write Sequential function, 103
.sp
.sh
X
.qs
.sp
XSOB, 26
.fi


990
Source/Doc/CPM 22 Manual/onea.tex

@ -1,990 +0,0 @@
.bp 1
.op
.cs 5
.mt 5
.mb 6
.pl 66
.ll 65
.po 10
.hm 2
.fm 2
.he
.ft 1-%
.pc 1
.tc 1 CP/M Features and Facilities
.ce 2
.sh
Section 1
.sp
.sh
CP/M Features and Facilities
.qs
.sp 3
.he CP/M Operating System Manual 1.1 Introduction
.tc 1.1 Introduction
.sh
1.1 Introduction
.qs
.fi
.pp 5
CP/M \ is a monitor control program for microcomputer system development that
uses floppy disks or Winchester hard disks for backup storage. Using a
computer system based on the Intel \ 8080 microcomputer, CP/M provides an
environment for program construction, storage, and editing, along
with assembly and program check-out facilities. CP/M can be easily
altered to execute with any computer
configuration that uses a Zilog \ Z80 \ or an Intel 8080 Central Processing
Unit (CPU) and has at least 20K bytes of main memory with up to 16 disk
drives. A detailed discussion of the modifications required for any
particular hardware environment is given in Section 6. Although the
standard Digital Research version operates on a single-density
Intel Model 800, microcomputer development system several different
hardware manufacturers support their own input-output (I/O) drivers for CP/M.
.pp
The CP/M monitor provides rapid access to programs through a comprehensive
file management package. The file subsystem supports a named file structure,
allowing dynamic allocation of file space as well as sequential and random
file access. Using this file system, a large number of programs can be
stored in both source and machine-executable form.
.pp
CP/M 2 is a high-performance, single console operating system that uses
table-driven techniques to allow field reconfiguration to match a wide
variety of disk capacities. All fundamental file restrictions are removed,
maintaining upward compatibility from previous versions of release 1.
.pp
Features of CP/M 2 include field specification of one to sixteen logical
drives, each containing up to eight megabytes. Any particular file can
reach the full drive size with the capability of expanding to thirty-two
megabytes in future releases. The directory size can be field-configured to
contain any reasonable number of entries, and each file is optionally tagged
with Read-Only and system attributes. Users of CP/M 2 are physically
separated by user numbers, with facilities for file copy operations from one
user area to another. Powerful relative-record random access functions are
present in CP/M 2 that provide direct access to any of the 65536 records of
an eight-megabyte file.
.pp
CP/M also supports ED, a powerful context editor, ASM , an Intel-compatible
assembler, and DDT , debugger subsystems. Optional software includes a
powerful
Intel-compatible macro assembler, symbolic debugger, along with various
high-level languages. When coupled with CP/M's Console Command
Processor (CCP),
the resulting facilities equal or exceed similar large computer facilities.
.pp
CP/M is logically divided into several distinct parts:
.sp
.in 3
.nf
o BIOS (Basic I/O System), hardware-dependent
o BDOS (Basic Disk Operating System)
o CCP (Console Command Processor)
o TPA (Transient Program Area)
.fi
.in 0
.pp
The BIOS provides the primitive operations necessary to access the disk
drives and to interface standard peripherals: teletype, CRT, paper tape
reader/punch, and user-defined peripherals. You can tailor
peripherals for any particular hardware environment by patching this
portion of
CP/M. The BDOS provides disk management by controlling one or more disk
drives containing independent file directories. The BDOS implements disk
allocation strategies that provide fully dynamic file construction while
minimizing head movement across the disk during access. The BDOS has entry
points that include the following primitive operations, which the
program accesses:
.sp
.in 5
.ti -2
o SEARCH looks for a particular disk file by name.
.ti -2
o OPEN opens a file for further operations.
.ti -2
o CLOSE closes a file after processing.
.ti -2
o RENAME changes the name of a particular file.
.ti -2
o READ reads a record from a particular file.
.ti -2
o WRITE writes a record to a particular file.
.ti -2
o SELECT selects a particular disk drive for further operations.
.in 0
.pp
The CCP provides a symbolic interface between your console and the
remainder of the CP/M system. The CCP reads the console device and
processes commands, which include listing the file directory, printing the
contents of files, and controlling the operation of transient programs, such
as assemblers, editors, and debuggers. The standard commands that are
available in the CCP are listed in Section 1.2.1.
.pp
The last segment of CP/M is the area called the Transient Program
Area (TPA). The TPA holds programs that are loaded from the disk under
command of the CCP. During program editing, for example, the TPA holds
the CP/M text editor machine code and data areas. Similarly, programs
created under CP/M can be checked out by loading and executing these
programs in the TPA.
.pp
Any or all of the CP/M component subsystems can be overlaid by an
executing program. That is, once a user's program is loaded into the TPA,
the CCP, BDOS, and BIOS areas can be used as the program's data area.
A bootstrap loader is programmatically accessible whenever the BIOS portion
is not overlaid; thus, the user program need only branch to the bootstrap
loader at the end of execution and the complete CP/M monitor is reloaded
from disk.
.pp
The CP/M operating system is partitioned into distinct modules, including
the BIOS portion that defines the hardware environment in which CP/M is
executing. Thus, the standard system is easily modified to any nonstandard
environment by changing the peripheral drivers to handle the custom system.
.bp
.tc 1.2 Functional Description
.he CP/M Operating System Manual 1.2 Functional Description
.sh
1.2 Functional Description
.qs
.pp
You interact with CP/M primarily through the CCP, which reads and
interprets commands entered through the console. In general, the CCP
addresses one of several disks that are on-line. The standard system
addresses up to sixteen different disk drives. These disk drives are
labeled A through P. A disk is logged-in if the CCP is currently
addressing the disk. To clearly indicate which disk is the currently logged
disk, the CCP always prompts the operator with the disk name followed by the
symbol >, indicating that the CCP is ready for another command. Upon
initial start-up, the CP/M system is loaded from disk A, and the CCP
displays the following message:
.sp
.ti 8
CP/M VER x.x
.sp
where x.x is the CP/M version number. All CP/M systems are initially set
to operate in a 20K memory space, but can be easily reconfigured to fit any
memory size on the host system (see Section 1.6.9). Following system
sign-on, CP/M automatically logs in disk A, prompts you with the
symbol A>, indicating that CP/M is currently addressing disk A, and
waits for a command. The commands are implemented at two levels: built-in
commands and transient commands.
.sp 2
.tc 1.2.1 General Command Structure
.sh
1.2.1 General Command Structure
.qs
.pp
Built-in commands are a part of the CCP program, while transient
commands are loaded into the TPA from disk and executed. The
following are built-in commands:
.sp
.in 3
.nf
o ERA erases specified files.
o DIR lists filenames in the directory.
o REN renames the specified file.
o SAVE saves memory contents in a file.
o TYPE types the contents of a file on the logged disk.
.in 0
.fi
.sp
Most of the commands reference a particular file or group of files. The
form of a file reference is specified in Section 1.2.2.
.sp 2
.tc 1.2.2 File References
.sh
1.2.2 File References
.qs
.pp
A file reference identifies a particular file or group of files on a
particular disk attached to CP/M. These file references are
either unambiguous (ufn) or ambiguous (afn). An unambiguous file
reference uniquely identifies a single file, while an ambiguous file
reference is satisfied by a number of different files.
.mb 5
.fm 1
.pp
File references consist of two parts: the primary filename and the
filetype. Although the filetype is optional, it usually is
generic. For example, the filetype ASM is used to denote that the file is an
assembly language source file, while the primary filename distinguishes each
particular source file. The two names are separated by a period, as shown
in the following example:
.bp
.ti 8
filename.typ
.sp
.mb 6
.fm 2
In this example, filename is the primary filename of eight characters or
less, and typ
is the filetype of no more than three characters. As mentioned above, the
name
.sp
.ti 8
filename
.sp
is also allowed and is equivalent to a filetype consisting of
three blanks. The characters used in specifying an unambiguous
file reference cannot contain any of the following special
characters:
.sp
.ti 8
< > . , ; : = ? * [ ] _ % | ( ) / \\
.sp
while all alphanumerics and remaining special characters are allowed.
.pp
An ambiguous file reference is used for directory search and pattern
matching. The form of an ambiguous file reference is similar to an
unambiguous reference, except the symbol ? can be interspersed throughout
the primary and secondary names. In various commands throughout CP/M,
the ? symbol matches any character of a filename in the ? position.
Thus, the ambiguous reference
.sp
.ti 8
X?Z.C?M
.sp
matches the following unambiguous filenames
.sp
.ti 8
XYZ.COM
.sp
and
.sp
.ti 8
X3Z.CAM
.sp
The * wildcard character can also be used in an ambiguous file
reference. The * character replaces all or part of a filename or
filetype. Note that
.sp
.ti 8
*.*
.sp
equals the ambiguous file reference
.sp
.ti 8
????????.???
.sp
while
.sp
.ti 8
filename.*
.sp
and
.sp
.ti 8
*.typ
.sp
are abbreviations for
.sp
.ti 8
filename.???
.sp
and
.sp
.ti 8
????????.typ
.sp
respectively. As an example,
.sp
.ti 8
A>\c
.sh
DIR *.*
.qs
.sp
is interpreted by the CCP as a command to list the names of all disk files
in the directory. The following example searches only for a file
by the name X.Y:
.sp
.ti 8
A>\c
.sh
DIR X,Y
.qs
.sp
Similarly, the command
.sp
.ti 8
A>\c
.sh
DIR X?Y.C?M
.qs
.sp
causes a search for all unambiguous filenames on the disk that satisfy
this ambiguous reference.
.pp
The following file references are valid unambiguous file references:
.sp
.nf
.in 8
X
X.Y
XYZ
XYZ.COM
GAMMA
GAMMA.1
.fi
.in 0
.pp
As an added convenience, the programmer can generally specify the disk drive
name along with the filename. In this case, the drive name is given as a
letter A through P followed by a colon (:). The specified drive is
then logged-in before the file operation occurs. Thus, the following are
valid file references with disk name prefixes:
.sp
.nf
.in 8
A:X.Y
P:XYZ.COM
B:XYZ
B:X.A?M
C:GAMMA
C:*.ASM
.fi
.in 0
.sp
All alphabetic lower-case letters in file and drive names are translated to
upper-case when they are processed by the CCP.
.sp 2
.tc 1.3 Switching Disks
.he CP/M Operating System Manual 1.3 Switching Disks
.sh
1.3 Switching Disks
.qs
.mb 5
.fm 1
.pp
The operator can switch the currently logged disk by typing the disk drive
name, A through P, followed by a colon when the CCP is waiting for
console input. The following sequence of prompts and commands
can occur after the CP/M system is loaded from disk A:
.sp
.nf
.in 8
CP/M VER 2.2
A>\c
.sh
DIR \c
.qs
List all files on disk A.
A:SAMPLE ASM SAMPLE PRN
A>\c
.sh
B: \c
.qs
Switch to disk B.
B>\c
.sh
DIR *.ASM \c
.qs
List all ASM files on B.
B:DUMP ASM FILES ASM
b>\c
.sh
A: \c
.qs
Switch back to A.
.in 0
.fi
.mb 6
.fm 2
.sp 2
.tc 1.4 Built-in Commands
.he CP/M Operating System Manual 1.4 Built-in Commands
.sh
1.4 Built-in Commands
.qs
.pp
The file and device reference forms described can now be used to fully
specify the structure of the built-in commands. Assume the following
abbreviations in the description below:
.sp
.in 8
.nf
ufn unambiguous file reference
afn ambiguous file reference
.fi
.in 0
.sp
Recall that the CCP always translates lower-case characters to upper-case
characters internally. Thus, lower-case alphabetics are treated as if they
are upper-case in command names and file references.
.sp 2
.tc 1.4.1 ERA Command
.sh
1.4.1 ERA Command
.qs
.sp
.ul
Syntax:
.qu
.sp
.ti 8
ERA afn
.pp
The ERA (erase) command removes files from the currently logged-in
disk, for example, the disk name currently prompted by CP/M preceding the >.
The files that are erased are those that satisfy the ambiguous file
reference afn. The following examples illustrate the use of ERA:
.sp 2
.in 24
.ti -16
ERA X.Y The file named X.Y on the currently logged disk is removed
from the disk directory and the space is returned.
.sp
.ti -16
ERA X.* All files with primary name X are removed from the current
disk.
.sp
.ti -16
ERA *.ASM All files with secondary name ASM are removed from the
current disk.
.sp
.ti -16
ERA X?Y.C?M All files on the current disk that satisfy the ambiguous
reference X?Y.C?M are deleted.
.bp
.ti -16
ERA *.* Erase all files on the current disk. In this
case, the CCP prompts the console with the message
.sp
.nf
ALL FILES (Y/N)?
.fi
.sp
which requires a Y response before files are actually removed.
.sp
.ti -16
ERA b:*.PRN All files on drive B that satisfy the ambiguous
reference ????????.PRN are deleted, independently of the currently
logged disk.
.in 0
.sp 3
.tc 1.4.2 DIR Command
.sh
1.4.2 DIR Command
.qs
.sp
.ul
Syntax:
.qu
.sp
.ti 8
DIR afn
.pp
The DIR (directory) command causes the names of all files that satisfy the
ambiguous filename afn to be listed at the console device. As a special
case, the command
.sp
.ti 8
DIR
.sp
lists the files on the currently logged disk (the command DIR is
equivalent to the command DIR *.*). The following are valid DIR
commands:
.sp
.nf
.in 8
DIR X.Y
DIR X?Z.C?M
DIR ??.Y
.in 0
.fi
.pp
Similar to other CCP commands, the afn can be preceded by a drive name.
The following DIR commands cause the selected drive to be addressed before
the directory search takes place:
.sp
.in 8
.nf
DIR B:
DIR B:X.Y
DIR B:*.A?M
.fi
.in 0
.pp
If no files on the selected disk satisfy the directory request, the
message NO FILE appears at the console.
.bp
.tc 1.4.3 REN Command
.sh
1.4.3 REN Command
.qs
.sp
.ul
Syntax:
.qu
.sp
.ti 8
REN ufn1=ufn2
.pp
The REN (rename) command allows you to change the names of files on
disk. The file satisfying ufn2 is changed to ufn1. The currently logged
disk is assumed to contain the file to rename (ufn2). You can also
type a left-directed arrow instead of the equal sign if the console supports
this graphic character. The following are examples of the REN
command:
.sp 2
.in 31
.ti -23
REN X.Y=Q.R The file Q.R is changed to X.Y.
.ti -23
.sp
REN XYZ.COM=XYZ.XXX The file XYZ.XXX is changed to XYZ.COM.
.in 0
.fi
.sp
.pp
The operator precedes either ufn1 or ufn2 (or both) by an optional drive
address. If ufn1 is preceded by a drive name, then ufn2 is assumed to exist
on the same drive. Similarly, if ufn2 is preceded by a drive name, then
ufn1 is assumed to exist on the drive as well. The same drive must be
specified in both cases if both ufn1 and ufn2 are preceded by drive names.
The following REN commands illustrate this format:
.sp 2
.in 31
.ti -23
REN A:X.ASM=Y.ASM The file Y.ASM is changed to X.ASM on drive A.
.sp
.ti -23
REN B:ZAP.BAS=ZOT.BAS The file ZOT.BAS is changed to ZAP.BAS on drive B.
.sp
.ti -23
REN B:A.ASM=B:A.BAK The file A.BAK is renamed to A.ASM on drive B.
.in 0
.sp
.pp
If ufn1 is already present, the REN command responds with the
error FILE EXISTS and not perform the change. If ufn2 does not exist on
the specified disk, the message NO FILE is printed at the console.
.sp 2
.tc 1.4.4 SAVE Command
.sh
1.4.4 SAVE Command
.qs
.sp
.ul
Syntax:
.qu
.sp
.ti 8
SAVE n ufn
.pp
The SAVE command places n pages (256-byte blocks) onto disk from the TPA
and names this file ufn. In the CP/M distribution system, the TPA starts
at 100H (hexadecimal) which is the second page of memory. The SAVE command
must specify 2 pages of memory if the user's program occupies the area
from 100H through 2FFH. The machine code file can be subsequently loaded
and executed. The following are examples of the SAVE command:
.sp 2
.in 31
.ti -23
SAVE 3X.COM Copies 100H through 3FFH to X.COM.
.sp
.ti -23
SAVE 40 Q Copies 100H through 28FFH to Q. Note that 28 is the
page count in 28FFH, and that 28H = 2*16+8=40 decimal.
.sp
.ti -23
SAVE 4 X.Y Copies 100H through 4FFH to X.Y.
.in 0
.sp 2
The SAVE command can also specify a disk drive in the ufn portion of the
command, as shown in the following example:
.sp
.in 31
.ti -23
SAVE 10 B:ZOT.COM Copies 10 pages, 100H through 0AFFH, to the
file ZOT.COM on drive B.
.in 0
.sp 3
.tc 1.4.5 TYPE Command
.sh
1.4.5 TYPE Command
.qs
.sp
.ul
Syntax:
.qu
.sp
.ti 8
TYPE ufn
.pp
The TYPE command displays the content of the ASCII source file ufn on the
currently logged disk at the console device. The following are valid
TYPE commands:
.sp
.in 8
.nf
TYPE X.Y
TYPE X.PLM
TYPE XXX
.in 0
.fi
.pp
The TYPE command expands tabs, CTRL-I characters, assuming tab positions are
set at every eighth column. The ufn can also reference a drive name.
.sp
.in 24
.ti -16
TYPE B:X.PRN The file X.PRN from drive B is displayed.
.in 0
.sp 2
.tc 1.4.6 USER Command
.sh
1.4.6 USER Command
.qs
.sp
.ul
Syntax:
.qu
.sp
.ti 8
USER n
.pp
The USER command allows maintenance of separate files in the same
directory. In the syntax line, n is an integer value in the range 0 to
15. On cold start, the operator is automatically logged into user
area number 0, which is
compatible with standard CP/M 1 directories. You can issue the
USER command at any time to move to another logical area within the same
directory. Drives that are logged-in while addressing one user number are
automatically active when the operator moves to another. A user number is
simply a prefix that accesses particular directory entries on the active
disks.
.pp
The active user number is maintained until changed by a subsequent USER
command, or until a cold start when user 0 is again assumed.
.sp 2
.tc 1.5 Line Editing and Output Control
.he CP/M Operating System Manual 1.5 Line Editing and Output Control
.sh
1.5 Line Editing and Output Control
.pp
The CCP allows certain line-editing functions while typing command lines.
The CTRL-key sequences are obtained by pressing the control and letter keys
simultaneously. Further, CCP command lines are generally up to 255
characters in length; they are not acted upon until the carriage return key
is pressed.
.sp 2
.ce
.sh
Table 1-1. Line-editing Control Characters
.qs
.sp
.ll 60
.in 5
.nf
Character Meaning
.fi
.sp
.in 18
.ti -12
CTRL-C Reboots CP/M system when pressed at start of line.
.sp
.ti -12
CTRL-E Physical end of line; carriage is returned, but line is not sent
until the carriage return key is pressed.
.sp
.ti -12
CTRL-H Backspaces one character position.
.sp
.ti -12
CTRL-J Terminates current input (line feed).
.sp
.ti -12
CTRL-M Terminates current input (carriage return).
.sp
.ti -12
CTRL-P Copies all subsequent console output to the currently
assigned list device (see Section 1.6.1). Output is sent to the list device
and the console device until the next CTRL-P is pressed.
.sp
.ti -12
CTRL-R Retypes current command line; types a clean line following
character deletion with rubouts.
.sp
.ti -12
CTRL-S Stops the console output temporarily. Program execution and
output continue when you press any character at the console, for
example another CTRL-S. This feature stops output on high speed consoles,
such as CRTs, in order to view a segment of output before continuing.
.bp
.ll 65
.in 0
.ce
.sh
Table 1-1. (continued)
.qs
.sp
.ll 60
.in 5
.nf
Character Meaning
.fi
.sp
.in 18
.ti-12
CTRL-U Deletes the entire line typed at the console.
.sp
.ti -12
CTRL-X Same as CTRL-U.
.sp
.ti -12
CTRL-Z Ends input from the console (used in PIP and ED).
.sp
.ti -12
RUB/DEL Deletes and echoes the last character typed at the console.
.in 0
.ll 65
.sp 2
.tc 1.6 Transient Commands
.he CP/M Operating System Manual 1.6 Transient Commands
.sh
1.6 Transient Commands
.qs
.pp
Transient commands are loaded from the currently logged disk and executed in
the TPA. The transient commands for execution under the CCP are below.
Additional functions are easily defined by the user (see Section 1.6.3).
.sp 2
.ce
.sh
Table 1-2. CP/M Transient Commands
.qs
.sp
.ll 60
.in 5
.nf
Command Function
.fi
.sp
.in 16
.ti -11
STAT Lists the number of bytes of storage remaining on the currently
logged disk, provides statistical information about particular files, and
displays or alters device assignment.
.sp
.ti -11
ASM Loads the CP/M assembler and assembles the specified program from
disk.
.sp
.ti -11
LOAD Loads the file in Intel HEX machine code format and produces a
file in machine executable form which can be loaded into the TPA. This loaded
program becomes a new command under the CCP.
.sp
.ti -11
DDT Loads the CP/M debugger into TPA and starts execution.
.sp
.ti -11
PIP Loads the Peripheral Interchange Program for subsequent disk file
and peripheral transfer operations.
.sp
.ti-11
ED Loads and executes the CP/M text editor program.
.sp
.ti -11
SYSGEN Creates a new CP/M system disk.
.bp
.ll 65
.in 0
.ce
.sh
Table 1-2. (continued)
.qs
.sp
.ll 60
.in 5
.nf
Command Function
.fi
.sp
.in 16
.ti -11
SUBMIT Submits a file of commands for batch processing.
.sp
.ti -11
DUMP Dumps the contents of a file in hex.
.sp
.ti -11
MOVCPM Regenerates the CP/M system for a particular memory size.
.sp
.ll 65
.in 0
.pp
Transient commands are specified in the same manner as built-in commands, and
additional commands are easily defined by the user. For convenience, the
transient command can be preceded by a drive name which causes the transient
to be loaded from the specified drive into the TPA for execution. Thus, the
command
.sp
.ti 8
B:STAT
.sp
causes CP/M to temporarily log in drive B for the source of the STAT
transient, and then return to the original logged disk for subsequent
processing.
.sp 2
.tc 1.6.1 STAT Command
.sh
1.6.1 STAT Command
.qs
.sp
.ul
Syntax:
.qu
.sp
.in 8
.nf
STAT
STAT "command line"
.fi
.in 0
.pp
The STAT command provides general statistical information about file storage
and device assignment. Special forms of the command line allow the current
device assignment to be
examined and altered. The various command lines that can be specified are
shown with an explanation of each form to the right.
.sp 2
.in 24
.ti -16
STAT If you type an empty command line, the STAT transient
calculates the storage remaining on all active drives, and prints
one of the following messages:
.sp
.nf
d: R/W, SPACE: nnnK
.sp
d: R/O, SPACE: nnnK
.fi
.sp
for each active drive d:, where R/W indicates the drive can be read or
written, and R/O indicates the drive is Read-Only (a drive becomes R/O by
explicitly setting it to Read-Only, as shown below, or by inadvertently
changing disks without performing a warm start). The space remaining on
the disk in drive d: is given in kilobytes by nnn.
.sp
.ti -16
STAT d: If a drive name is given, then the drive is selected before
the storage is computed. Thus, the command STAT B: could be issued while
logged into drive A, resulting in the message
.sp
BYTES REMAINING ON B: nnnK
.sp
.ti -16
STAT afn The command line can also specify a set of files to be
scanned by STAT. The files that satisfy afn are listed in alphabetical
order, with storage requirements for each file under the heading:
.sp
.nf
RECS BYTES EXT D:FILENAME.TYP
rrrr bbbK ee d:filename.typ
.fi
.sp
where rrrr is the number of 128-byte records allocated to the file, bbb is
the number of kilobytes allocated to the file (bbb=rrrr*128/1024), ee is the
number of 16K extensions (ee=bbb/16), d is the drive name containing the
file (A...P), filename is the eight-character primary filename, and
typ is the three-character filetype. After listing the individual
files, the storage usage is summarized.
.sp
.ti -16
STAT d:afn The drive name can be given ahead of the afn. The specified
drive is first selected, and the form STAT afn is executed.
.sp
.ti -16
STAT d:=R/O This form sets the drive given by d to Read-Only, remaining
in effect until the next warm or cold start takes place. When a disk is
Read-Only, the message
.sp
BDOS ERR ON d: Read-Only
.sp
appears if there is an attempt to write to the Read-Only disk. CP/M
waits until a key is pressed before performing an automatic
warm start, at
which time the disk becomes R/W.
.in 0
.bp
.pp
The STAT command allows you to control the physical-to-logical device
assignment. See the IOBYTE function described in Sections 5 and 6. There
are four logical peripheral devices that are, at any particular instant, each
assigned one of several physical peripheral devices. The
following is a list of the four logical devices:
.sp 2
.in 5
.ti -2
o CON: is the system console device, used by CCP for communication with the
operator.
.sp
.ti -2
o RDR: is the paper tape reader device.
.sp
.ti -2
o PUN: is the paper tape punch device.
.sp
.ti -2
o LST: is the output list device.
.in 0
.sp
.pp
The actual devices attached to any particular computer system are driven by
subroutines in the BIOS portion of CP/M. Thus, the logical RDR: device, for
example, could actually be a high speed reader, teletype reader, or cassette
tape. To allow some flexibility in device naming and assignment, several
physical devices are defined in Table 1-3.
.sp 2
.ce
.sh
Table 1-3. Physical Devices
.ll 60
.in 5
.sp
.nf
Device Meaning
.fi
.sp
.in 14
.ti -8
TTY: Teletype device (slow speed console)
.sp
.ti -8
CRT: Cathode ray tube device (high speed console)
.sp
.ti -8
BAT: Batch processing (console is current RDR:, output goes to current
LST: device)
.sp
.ti -8
UC1: User-defined console
.sp
.ti -8
PTR: Paper tape reader (high speed reader)
.sp
.ti -8
UR1: User-defined reader #1
.sp
.ti -8
UR2: User-defined reader #2
.sp
.ti -8
PTP: Paper tape punch (high speed punch)
.sp
.ti -8
UP1: User-defined punch #1
.sp
.ti -8
UP2: User-defined punch #2
.sp
.ti -8
LPT: Line printer
.sp
.ti -8
UL1: User-defined list device #1
.in 0
.ll 65
.nx oneb


915
Source/Doc/CPM 22 Manual/oneb.tex

@ -1,915 +0,0 @@
.bp
.op
.cs 5
.mt 5
.mb 6
.pl 66
.ll 65
.po 10
.hm 2
.fm 2
.he CP/M Operating System Manual 1.6 Transient Commands
.ft 1-%
.pc 1
.pp 5
It is emphasized that the physical device names might not actually
correspond to devices that the names imply. That is, you can
implement the PTP: device as a cassette write operation. The exact
correspondence and driving subroutine is defined in the BIOS portion of
CP/M. In the standard distribution version of CP/M, these devices correspond
to their names on the Model 800 development system.
.pp
The command,
.sp
.ti 8
STAT VAL:
.sp
produces a summary of the available status commands, resulting in
the output:
.sp
.in 8
.nf
Temp R/O Disk d:$R/O
Set Indicator: filename.typ $R/O $R/W $SYS $DIR
Disk Status: DSK: d:DSK
Iobyte Assign:
.sp
.in 0
.fi
which gives an instant summary of the possible STAT commands and shows the
permissible logical-to-physical device assignments:
.sp
.in 8
.nf
CON: = TTY: CRT: BAT: UC1:
RDR: = TTY: PTR: UR1: UR2:
PUN: = TTY: PTP: UP1: UP2:
LST: = TTY: CRT: LPT: UL1:
.fi
.in 0
.sp
The logical device to the left takes any of the four physical assignments
shown to the right. The current logical-to-physical mapping is displayed by
typing the command:
.sp
.ti 8
STAT DEV:
.sp
This command produces a list of each logical device to the left and
the current
corresponding physical device to the right. For example, the list might
appear as follows:
.sp
.in 8
.nf
CON: = CRT:
RDR: = UR1:
PUN: = PTP:
LST: = TTY:
.fi
.in 0
.sp
The current logical-to-physical device assignment is changed by typing a STAT
command of the form:
.sp
.ti 8
STAT ld1 = pd1, ld2 = pd2, ... , ldn = pdn
.sp
where ld1 through ldn are logical device names and pd1 through pdn are
compatible physical device names. For example, ldi and pdi appear on the
same line
in the VAL: command shown above. The following example shows valid STAT
commands that change the
current logical-to-physical device assignments:
.sp
.in 8
.nf
STAT CON:=CRT:
STAT PUN:=TTY:, LST:=LPT:, RDR:=TTY:
.in 0
.fi
.pp
The command form,
.sp
.ti 8
STAT d:filename.typ $S
.sp
where d: is an optional drive name and filename.typ is an unambiguous or
ambiguous filename, produces the following output display format:
.sp 2
.in 8
.nf
Size Recs Bytes Ext Acc
.sp
48 48 6K 1 R/O A:ED.COM
55 55 12K 1 R/O (A:PIP.COM)
65536 128 16K 2 R/W A:X.DAT
.in 0
.fi
.sp 2
where the $S parameter causes the Size field to be displayed. Without the
$S, the Size field is skipped, but the remaining fields are displayed. The
Size field lists the virtual file size in records, while the Recs field
sums the number of virtual records in each extent. For files constructed
sequentially, the Size and Recs fields are identical. The Bytes field
lists the actual number of bytes allocated to the corresponding file. The
minimum allocation unit is determined at configuration time; thus, the number
of bytes corresponds to the record count plus the remaining unused space in
the last allocated block for sequential files. Random access files are given
data areas only when written, so the Bytes field contains the only accurate
allocation figure. In the case of random access, the Size field gives the
logical end-of-file record position and the Recs field counts the logical
records of each extent. Each of these extents, however, can contain
unallocated holes even though they are added into the record count.
.pp
The Ext field counts the number of physical extents allocated to the file.
The Ext count corresponds to the number of directory entries given to the
file. Depending on allocation size, there can be up to 128K
bytes (8 logical extents) directly addressed by a single directory entry. In a special case,
there are actually 256K bytes that can be directly addressed by a physical
extent.
.pp
The Acc field gives the R/O or R/W file indicator, which you can
change using the commands shown. The four command forms,
.sp
.nf
.in 8
STAT d:filename.typ $R/O
STAT d:filename.typ $R/W
STAT d:filename.typ $SYS
STAT d:filename.typ $DIR
.in 0
.fi
.sp
set or reset various permanent file indicators. The R/O indicator places the
file, or set of files, in a Read-Only status until changed by a subsequent
STAT command. The R/O status is recorded in the directory with the file so
that it remains R/O through intervening cold start operations. The R/W
indicator places the file in a permanent Read-Write status. The SYS
indicator attaches the system indicator to the file, while the DIR command
removes the system indicator. The filename.typ may be ambiguous or
unambiguous, but files whose attributes are changed are listed at the console
when the change occurs. The drive name denoted by d: is optional.
.pp
When a file is marked R/O, subsequent attempts to erase or write into the
file produce the following BDOS message at your screen:
.sp
.ti 8
BDOS Err on d: File R/O
.sp
lists the drive characteristics of the disk named by d: that is in the range
A:, B:,...,P:. The drive characteristics are listed in the
following format:
.sp
.nf
d: Drive Characteristics
65536: 128 Byte Record Capacity
8192: Kilobyte Drive Capacity
128: 32 Byte Directory Entries
0: Checked Directory Entries
1024: Records/Extent
128: Records/Block
58: Sectors/Track
2: Reserved Tracks
.fi
.sp
where d: is the selected drive, followed by the total record capacity
(65536 is an eight-megabyte drive), followed by the total capacity listed in
kilobytes. The directory size is listed next, followed by the checked
entries. The number of checked entries is usually identical to the directory
size for removable media, because this mechanism is used to detect changed
media during CP/M operation without an intervening warm start. For fixed
media, the number is usually zero, because the media are not changed without
at least a cold or warm start.
.pp
The number of records per extent determines
the addressing capacity of each directory entry (1024 times 128 bytes, or
128K in the previous example). The number of records per block shows the
basic allocation size (in the example, 128 records/block times 128 bytes per
record, or 16K bytes per block). The listing is then followed by the number
of physical sectors per track and the number of reserved tracks.
.pp
For logical
drives that share the same physical disk, the number of reserved tracks can
be quite large because this mechanism is used to skip lower-numbered disk
areas allocated to other logical disks. The command form
.sp
.ti 8
STAT DSK:
.sp
produces a drive characteristics table for all currently active drives. The
final STAT command form is
.sp
.ti 8
STAT USR:
.sp
which produces a list of the user numbers that have files on the currently
addressed disk. The display format is
.sp
.nf
.in 8
Active User: 0
Active Files: 0 1 3
.in 0
.fi
.sp
where the first line lists the currently addressed user number, as set by the
last CCP USER command, followed by a list of user numbers scanned from the
current directory. In this case, the active user number is 0 (default at cold
start) with three user numbers that have active files on the current disk.
The operator can subsequently examine the directories of the other user
numbers by logging in with USER 1 or USER 3 commands, followed by a DIR
command at the CCP level.
.sp 2
.tc 1.6.2 ASM Command
.sh
1.6.2 ASM Command
.qs
.sp
Syntax:
.sp
.ti 8
ASM ufn
.pp
The ASM command loads and executes the CP/M 8080 assembler. The ufn
specifies a source file containing assembly language statements, where the
filetype is assumed to be ASM and is not specified. The following ASM
commands are valid:
.sp
.nf
.in 8
ASM X
ASM GAMMA
.in 0
.fi
.sp
The two-pass assembler is automatically executed. Assembly errors that occur
during the second pass are printed at the console.
.pp
The assembler produces a file:
.sp
.ti 8
X.PRN
.sp
where X is the primary name specified in the ASM command. The PRN file
contains a listing of the source program with embedded tab characters if
present in the source program, along with the machine code generated for
each statement and diagnostic error messages, if any. The PRN file is listed
at the console using the TYPE command, or sent to a peripheral device
using PIP (see Section 1.6.4). Note that the PRN file
contains the original source program, augmented by miscellaneous assembly
information in the leftmost 16 columns; for example, program addresses and
hexadecimal
machine code. The PRN file serves as a backup for the original
source file. If the source file is accidentally removed or destroyed, the
PRN file can be edited by removing the leftmost 16 characters
of each line (see Section 2). This is done by issuing a single editor macro
command.
The resulting file is identical to the original source file and can be
renamed from PRN to ASM for subsequent editing and assembly. The file
.sp
.ti 8
X.HEX
.sp
is also produced, which contains 8080 machine language in Intel HEX format
suitable for subsequent loading and execution (see Section 1.6.3). For
complete details of CP/M's assembly language program, see Section 3.
.pp
The source file for assembly is taken from an alternate disk by prefixing the
assembly language filename by a disk drive name. The command
.sp
.ti 8
ASM B:ALPHA
.sp
loads the assembler from the currently logged drive and processes the source
program ALPHA.ASM on drive B. The HEX and PRN files are also placed on
drive B in this case.
.he CP/M Operating System Manual 1.6 Transient Commands
.sp 2
.tc 1.6.3 LOAD Command
.sh
1.6.3 LOAD Command
.qs
.sp
Syntax:
.sp
.ti 8
LOAD ufn
.pp 5
The LOAD command reads the file ufn, which is assumed to contain HEX format
machine code, and produces a memory image file that can subsequently be
executed. The filename ufn is assumed to be of the form:
.sp
.ti 8
X.HEX
.sp
and only the filename X need be specified in the command. The LOAD command
creates a file named
.sp
.ti 8
X.COM
.sp
that marks it as containing machine executable code. The file is actually
loaded into memory and executed when the user types the filename X
immediately after the prompting character > printed by the CCP.
.pp
Generally, the CCP reads the filename X following the prompting character and
looks for a built-in function name. If no function name is found, the CCP
searches the system disk directory for a file by the name
.sp
.ti 8
X.COM
.mb 5
.fm 1
.sp
If found, the machine code is loaded into the TPA, and the program executes.
Thus, the user need only LOAD a hex file once; it can be subsequently
executed any number of times by typing the primary name. This
way, you can invent new commands in the CCP. Initialized disks contain
the transient commands as COM files, which are optionally deleted. The
operation takes place on an alternate drive if the filename is prefixed
by a drive name. Thus,
.bp
.mb 6
.fm 2
.sp
.ti 8
LOAD B:BETA
.sp
brings the LOAD program into the TPA from the currently logged disk and
operates on drive B after execution begins.
.sp
.sh
Note: \c
.qs
the BETA.HEX file must contain valid Intel format
hexadecimal machine code records (as produced by the ASM program, for
example) that begin at 100H of the TPA. The addresses in the hex records
must be in ascending order; gaps in unfilled memory regions are filled with
zeroes by the LOAD command as the hex records are read. Thus, LOAD must be
used only for creating CP/M standard COM files that operate in the TPA.
Programs that occupy regions of memory other than the TPA are loaded under
DDT.
.sp 2
.tc 1.6.4 PIP
.sh
1.6.4 PIP
.qs
.sp
.ul
Syntax:
.qu
.sp
.in 8
.nf
PIP
PIP destination=source#1, source#2, ..., source #n
.fi
.in 0
.pp
PIP is the CP/M Peripheral Interchange Program that implements the basic
media conversion operations necessary to load, print, punch, copy, and
combine disk files. The PIP program is initiated by typing one of the
following forms:
.sp
.nf
.in 8
PIP
PIP command line
.fi
.in 0
.sp
In both cases PIP is loaded into the TPA and executed. In the
first form, PIP reads command lines directly from the console, prompted with
the * character, until an empty command line is typed (for example, a single
carriage return is issued by
the operator). Each successive command line causes some media conversion
to take place according to the rules shown below.
.pp
In the second form, the PIP
command is equivalent to the first, except that the single command line
given with the PIP command is automatically executed, and PIP terminates
immediately with no further prompting of the console for input command
lines. The form of each command line is
.sp
.ti 8
destination = source#1, source#2, ..., source#n
.sp
where destination is the file or peripheral device to receive the
data,
and source#1, ..., source#n is a series of one or more files or devices
that are copied from left to right to the destination.
.pp
When multiple files are given in the command line (for example,
n>1), the individual
files are assumed to contain ASCII characters, with an assumed CP/M
end-of-file character (CTRL-Z) at the end of each file (see the O parameter
to override this assumption). Lower-case ASCII alphabetics are internally
translated to upper-case to be consistent with CP/M file and device name
conventions. Finally, the total command line length cannot exceed 255
characters. CTRL-E can be used to force a physical carriage return for lines
that exceed the console width.
.pp
The destination and source elements are unambiguous references to CP/M source
files with or without a preceding disk drive name. That is, any file can be
referenced with a preceding drive name (A: through P:) that defines the
particular drive where the file can be obtained or stored. When the drive
name is not included, the currently logged disk is assumed. The
destination file can also appear as one or more of the source files, in
which case the source file is not altered until the entire concatenation is
complete. If it already exists, the destination file is removed if the
command line is properly formed. It is not removed if an error condition
arises. The following command lines, with explanations to the
right, are
valid as input to PIP:
.sp 2
.in 31
.ti -23
X=Y Copies to file X from file Y, where X and Y are
unambiguous filenames; Y remains unchanged.
.sp
.ti -23
X=Y,Z Concatenates files Y and z and copies to file X,
with Y and Z unchanged.
.sp
.ti -23
X.ASM=Y.ASM,Z.ASM Creates the file X.ASM from the concatenation of the
Y and Z.ASM files.
.sp
.ti -23
NEW.ZOT=B:OLD.ZAP Moves a copy of OLD.ZAPP from drive B to the currently
logged disk; names the file NEW.ZOT.
.sp
.ti -23
B:A.U=B:B.V,A:C.W,D.X Concatenates file B.V from drive B with C.W from drive
a and D.X from the logged disk; creates the file A.U on drive b.
.in 0
.sp
.pp
For convenience, PIP allows abbreviated commands for transferring files
between disk drives. The abbreviated PIP forms are
.sp
.in 8
.nf
PIP d:=afn
PIP d\d1\u=d\d2\u:afn
PIP ufn = d\d2\u:
PIP d\d1\u:ufn = d\d2\u:
.fi
.in 0
.sp
The first form copies all files from the currently logged disk that satisfy
the afn to the same files on drive d, where d = A...P. The second form is
equivalent to the first, where the source for the copy is drive
d\d2\u, where d\d2\u = A...P. The third form is equivalent to the command PIP
d\d1\u:ufn=d\d2\u:ufn which copies the file given by ufn from drive
d\d2\u to the file ufn on drive d\d1\u:. The fourth form is equivalent to
the third, where the source disk is explicitly given by d\d2\u:.
.pp
The source and destination disks must be different in all of these cases.
If an afn is specified, PIP lists each ufn that satisfies the afn as it
is being copied. If a file exists by the same name as the destination file,
it is removed after successful completion of the copy and replaced by the
copied file.
.pp
The following PIP commands give examples of valid disk-to-disk copy operations:
.sp 2
.in 24
.ti -16
B:=*.COM Copies all files that have the secondary name COM to
drive B from the current drive.
.sp
.ti -16
A:=B:ZAP.* Copies all files that have the primary name ZAP to
drive A from drive B.
.sp
.ti -16
ZAP.ASM=B: Same as ZAP.ASM=B:ZAP.ASM
.sp
.ti -16
B:ZOT.COM=A: Same as B:ZOT.COM=A:ZOT.COM
.sp
.ti -16
B:=GAMMA.BAS Same as B:GAMMA.BAS=GAMMA.BAS
.sp
.ti -16
B:=A:GAMMA.BAS Same as B:GAMMA.BAS=A:GAMMA.BAS
.in 0
.sp
.pp
PIP allows reference to physical and logical devices that are attached to the
CP/M system. The device names are the same as given under the STAT command,
along with a number of specially named devices. The following is
a list of logical devices given in the STAT command
.sp
.in 8
.nf
CON: (console)
RDR: (reader)
PUN: (punch)
LST: (list)
.fi
.in 0
.sp
while the physical devices are
.sp
.in 8
.nf
TTY: (console), reader, punch, or list)
CRT: (console, or list), UC1: (console)
PTR: (reader), UR1: (reader), UR2: (reader)
PTP: (punch), UP1: (punch), UP2: (punch)
LPT: (list), UL1: (list)
.fi
.in 0
.sp
The BAT: physical device is not included, because this assignment is used
only to indicate that the RDR: and LST: devices are used for console
input/output.
.pp
The RDR, LST, PUN, and CON devices are all defined within the BIOS portion of
CP/M, and are easily altered for any particular I/O system. The current
physical device mapping is defined by IOBYTE; see Section 6 for a discussion
of this function. The destination device must be capable of
receiving data, for example, data cannot be sent to the punch, and the
source devices must be
capable of generating data, for example, the LST: device cannot be read.
.pp
The following list describes additional device names that can be used in
PIP commands.
.sp 2
.in 5
.ti -2
o NUL: sends 40 nulls (ASCII 0s) to the device. This can be issued
at the end of punched output.
.sp
.ti -2
o EOF: sends a CP/M end-of-file (ASCII CTRL-Z) to the destination
device (sent automatically at the end of all ASCII data transfers through PIP).
.sp
.ti -2
o INP: is a special PIP input source that can be patched into the PIP
program. PIP gets the input data character-by-character, by CALLing location
103H, with data returned in location 109H (parity bit must be zero).
.sp
.ti -2
o OUT: is a special PIP output destination that can be patched into the
PIP program. PIP CALLs location 106H with data in register C for each
character to transmit. Note that locations 109H through
1FFH of the PIP memory image are not used and can be replaced by special
purpose drivers using DDT (see Section 4).
.sp
.ti -2
o PRN: is the same as LST:, except that tabs are expanded at every eighth
character position, lines are numbered, and page ejects are inserted every
60 lines with an initial eject (same as using PIP options [t8np]).
.in 0
.sp
.pp
File and device names can be interspersed in the PIP commands. In each case,
the specific device is read until end-of-file (CTRL-Z for ASCII files, and
end-of-data for non-ASCII disk files). Data from each device or file are
concatenated from left to right until the last data source has been read.
.pp
The destination device or file is written using the data from the source
files, and an end-of-file character, CTRL-Z, is appended to the result
for ASCII files. If the destination is a disk file, a temporary file is
created ($$$ secondary name) that is changed to the actual filename only
on successful completion of the copy. Files with the extension COM are
always assumed to be non-ASCII.
.pp
The copy operation can be aborted at any time by pressing any key on the
keyboard. PIP responds with the message ABORTED to
indicate that the operation has not been completed. If any operation is
aborted, or if an error occurs during processing, PIP removes any pending
commands that were set up while using the SUBMIT command.
.pp
PIP performs a special function if the destination is a disk file with type
HEX (an Intel hex-formatted machine code file), and the source is an
external peripheral device, such as a paper tape reader. In this case, the
PIP program checks to ensure that the source file contains a properly formed
hex file, with legal hexadecimal values and checksum records.
.pp
When an
invalid input record is found, PIP reports an error message at the console
and waits for corrective action. Usually, you can open the reader
and rerun a section of the tape (pull the tape back about 20 inches). When
the tape is ready for the reread, a single carriage return is typed at the
console, and PIP attempts another read. If the tape position cannot be
properly read, continue the read by typing a return following the
error message, and enter the record manually with the ED program after
the disk file is constructed.
.pp
PIP allows the end-of-file to
be entered from the console if the source file is an RDR: device. In
this case, the PIP program reads the device and monitors the keyboard. If
CTRL-Z is typed at the keyboard, the read operation is terminated normally.
.pp
The following are valid PIP commands:
.sp 2
.in 24
.ti 8
PIP LST: = X.PRN
.sp
Copies X.PRN to the LST device and
terminates the PIP program.
.sp
.ti 8
PIP
.sp
Starts PIP for a sequence of
commands. PIP prompts with *.
.sp
.ti 8
*CON:=X.ASM,Y.ASM,Z.ASM
.sp
Concatenates three ASM files and copies to
the CON device.
.sp
.ti 8
*X.HEX=CON:,Y.HEX,PTR:
.sp
Creates a HEX file by reading the CON
until a CTRL-Z is typed, followed by data from Y.HEX and PTR until
a CTRL-Z is encountered.
.sp
.ti 8
PIP PUN:=NUL:,X.ASM,EOF:,NUL:
.mb 4
.fm 1
.sp
Sends 40 nulls to the punch device; copies the X.ASM file to the punch,
followed by an end-of-file, CTRL-Z, and 40 more null characters.
.sp
.ti 8
(carriage return)
.sp
A single carriage return stops PIP.
.in 0
.bp
.pp
You can also specify one or more PIP parameters, enclosed in left and
right square brackets, separated by zero or more blanks. Each parameter
affects the copy operation, and the enclosed list of parameters must
immediately follow the affected file or device. Generally, each parameter
can be followed by an optional decimal integer value (the S and Q parameters
are exceptions). Table 1-4 describes valid PIP parameters.
.sp 2
.ce
.sh
Table 1-4. PIP Parameters
.ll 60
.in 5
.nf
.sp
Parameter Meaning
.fi
.mb 6
.fm 2
.sp
.in 17
.ti -10
B Blocks mode transfer. Data are buffered by PIP until an ASCII x-off
character, CTRL-S, is received from the source device. This allows transfer
of data to a disk file from a continuous reading device, such as a cassette
reader. Upon receipt of the x-off, PIP clears the disk buffers and returns
for more input data. The amount of data that can be buffered depends on the
memory size of the host system. PIP issues an error message if the
buffers overflow.
.sp
.ti -10
Dn Deletes characters that extend past column n in the transfer of data
to the destination from the character source. This parameter is generally
used to truncate long lines that are sent to a narrow printer or
console device.
.sp
.ti -10
E Echoes all transfer operations to the console as they are being
performed.
.sp
.ti -10
F Filters form-feeds from the file. All embedded form-feeds are
removed. The P parameter can be used simultaneously to insert new form-feeds.
.sp
.ti -10
Gn Gets file from user number n (n in the range 0-15).
.sp
.ti -10
H Transfers HEX data. All data are checked for proper Intel hex file
format. Nonessential characters between hex records are removed during the
copy operation. The console is prompted for corrective action in case
errors occur.
.sp
.ti -10
I Ignores :00 records in the transfer of Intel hex format
file. The I parameter automatically sets the H parameter.
.bp
.ll 65
.in 0
.ce
.sh
Table 1-4. (continued)
.ll 60
.in 5
.nf
.sp
Parameter Meaning
.fi
.sp
.in 17
.ti -10
L Translates upper-case alphabetics to lower-case.
.sp
.ti -10
N Adds line numbers to each line transferred to the destination,
starting at one and incrementing by 1. Leading zeroes are suppressed, and
the number is followed by a colon. If N2 is specified, leading zeroes are
included and a tab is inserted following the number. The tab is expanded if
T is set.
.sp
.ti -10
O Transfers non-ASCII object files. The normal CP/M end-of-file is
ignored.
.sp
.ti -10
Pn Includes page ejects at every n lines with an initial page eject.
If n = 1 or is excluded altogether, page ejects occur every 60 lines. If
the F parameter is used, form-feed suppression takes place before the new
page ejects are inserted.
.sp
.ti -10
Qs^Z Quits copying from the source device or file when the
string s, terminated by CTRL-Z, is encountered.
.sp
.ti -10
R Reads system files.
.sp
.ti -10
Ss^Z Start copying from the source device when the string
s, terminated by CTRL-Z, is encountered. The S and Q parameters can be used
to abstract a particular section of a file, such as a subroutine. The
start and quit strings are always included in the copy operation.
.sp
If you specify a command line after the PIP command keyword, the CCP
translates strings
following the S and Q parameters to upper-case. If you do not
specify a command line, PIP does not perform the automatic upper-case
translation.
.sp
.ti -10
Tn Expands tabs, CTRL-I characters, to every nth column during the
transfer of characters to the destination from the source.
.sp
.ti -10
U Translates lower-case alphabetics to upper-case during the copy
operation.
.bp
.ll 65
.in 0
.ce
.sh
Table 1-4. (continued)
.ll 60
.in 5
.nf
.sp
Parameter Meaning
.fi
.sp
.in 17
.ti -10
V Verifies that data have been copied correctly by rereading after the
write operation (the destination must be a disk file).
.sp
.ti -10
W Writes over R/O files without console interrogation.
.sp
.ti -10
Z Zeros the parity bit on input for each ASCII character.
.in 0
.ll 65
.sp
.pp
The following examples show valid PIP commands that specify parameters in
the file transfer.
.sp 2
.in 24
.ti 8
PIP X.ASM=B:[v]
.sp
Copies X.ASM from drive B to the current drive and verifies that the data were
properly copied.
.sp 2
.ti 8
PIP LPT:=X.ASM[nt8u]
.sp
Copies X.ASM to the LPT: device; numbers each line, expands tabs to every
eighth column, and translates lower-case alphabetics to upper-case.
.sp 2
.ti 8
PIP PUN:=X.HEX[i],Y.ZOT[h]
.sp
First copies X.HEX to the PUN: device
and ignores the trailing :00 record in X.HEX; continues the transfer of data
by reading Y.ZOT, which contains HEX records, including any :00 records
it contains.
.sp 2
.ti 8
PIP X.LIB=Y.ASM[sSUBRI:^z qJMP L3^z]
.sp
Copies from the file Y.ASM into the
file X.LIB. The command starts the copy when the string SUBR1: has been
found, and quits copying after the string JMP L3 is encountered.
.bp
.ti 8
PIP PRN:=X.ASM[p50]
.sp
Sends X.ASM to the LST: device with
line numbers, expands tabs to every eighth column, and ejects
pages at every
50th line. The assumed parameter list for a PRN file is nt8p60; p50
overrides the default value.
.in 0
.sp
.pp
Under normal operation, PIP does not overwrite a file that is set to a
permanent R/O status. If an attempt is made to overwrite an R/O file, the
following prompt appears:
.sp
.ti 8
DESTINATION FILE IS R/O, DELETE (Y/N)?
.sp
If you type Y, the file is overwritten. Otherwise, the following response
appears:
.sp
.ti 8
** NOT DELETED **
.sp
The file transfer is skipped, and PIP continues with the next
operation in sequence. To avoid the prompt and response in the case of R/O
file overwrite, the command line can include the W parameter, as
shown in this example:
.sp
.ti 8
PIP A:=B:*.COM[W]
.sp
The W parameter copies all nonsystem files to the A drive from the B drive and
overwrites any R/O files in the process. If the operation involves several
concatenated files, the W parameter need only be included with the last file
in the list, as in this example:
.sp
.ti 8
PIP A.DAT=B.DAT,F:NEW.DAT,G:OLD.DAT[W]
.pp
Files with the system attribute can be included in PIP transfers if the R
parameter is included; otherwise, system files are not
recognized. For example, the command line:
.sp
.ti 8
PIP ED.COM=B:ED.COM[R]
.sp
reads the ED.COM file from the B drive, even if it has been
marked as an R/O and system file. The system file attributes are copied, if
present.
.pp
Downward compatibility with previous versions of CP/M is only maintained if
the file does not exceed one megabyte, no file attributes are set, and the
file is created by user 0. If compatibility is required with
nonstandard, for example, double-density versions of 1.4, it
might be
necessary to select 1.4
compatibility mode when constructing the internal disk parameter block. See
Section 6 and refer to Section 6.10, which describes BIOS differences.
.bp
.sh
Note: \c
.qs
to copy files into another user area, PIP.COM must be located in that user
area. Use the following procedure to make a copy of PIP.COM in another
user area.
.sp 2
.in 8
.nf
USER 0 Log in user 0.
DDT PIP.COM (note PIP size s) Load PIP to memory.
GO Return to CCP.
USER 3 Log in user 3.
SAVEs PIP.COM
.fi
.in 0
.sp 2
In this procedure, s is the integral number of memory pages, 256-byte
segments, occupied
by PIP. The number s can be determined when PIP.COM is loaded under DDT,
by referring to the value under the NEXT display. If, for example, the next
available address is 1D00, then PIP.COM requires 1C hexadecimal
pages, or
1 times 16 + 12 = 28 pages, and the value of s is 28 in the subsequent
save. Once PIP is copied in this manner, it can be copied to another disk
belonging to the same user number through normal PIP transfers.
.nx onec


683
Source/Doc/CPM 22 Manual/onec.tex

@ -1,683 +0,0 @@
.op
.cs 5
.mt 5
.mb 6
.pl 66
.ll 65
.po 10
.hm 2
.fm 2
.he CP/M Operating System Manual 1.6 Transient Commands
.ft 1-%
.pc 1
.sp 2
.tc 1.6.5 ED Command
.sh
1.6.5 ED Command
.qs
.sp
.ul
Syntax:
.qu
.sp 0
.sp
.ti 8
ED ufn
.pp 5
The ED program is the CP/M system context editor that allows creation and
alteration of ASCII files in the CP/M environment. Complete details of
operation are given in Section 2. ED allows the operator to create and
operate upon source files that are organized as a sequence of ASCII
characters, separated by end-of-line characters (a carriage
return/line-feed
sequence). There is no practical restriction on line length (no single
line can exceed the size of the working memory) that is defined by the
number of characters typed between carriage returns.
.pp
The ED program has
a number of commands for character string searching, replacement, and
insertion that are useful for creating and correcting programs or text
files under CP/M. Although the CP/M has a limited memory work
space area (approximately 5000 characters in a 20K CP/M system), the file
size that
can be edited is not limited, since data are easily paged through this
work area.
.pp
If it does not exist, ED creates the specified source file and opens the
file for access. If the source file does exist, the
programmer appends data for editing (see the A command). The appended data
can then be
displayed, altered, and written from the work area back to the
disk (see the W command). Particular points in the program can be
automatically paged and
located by context, allowing easy access to particular
portions of a large file (see the N command).
.pp
If you type the following command line:
.sp
.ti 8
ED X.ASM
.sp
the ED program creates an intermediate work file with the name
.sp
.ti 8
X.$$$
.sp
to hold the edited data during the ED run. Upon completion of ED, the
X.ASM file (original file) is renamed to X.BAK, and the edited work file is
renamed to X.ASM. Thus, the X.BAK file contains the original unedited
file, and the X.ASM file contains the newly edited file. The operator can
always return to the previous version of a file by removing the most recent
version and renaming the previous version. If the current X.ASM file has
been improperly edited, the following sequence of commands reclaim the
back-up file.
.sp 2
.nf
.in 8
DIR X.* Checks to see that BAK file is
available.
ERA X.ASM Erases most recent version.
REN X.ASM=X.BAK Renames the BAK file to ASM.
.fi
.in 0
.sp 2
You can abort the edit at any point (reboot, power failure, CTRL-C,
or CTRL-Q command) without destroying the original file. In this case, the
BAK file is not created and the original file is always intact.
.pp
The ED program allows the user to edit the source on one disk and create the
back-up file on another disk. This form of the ED command is
.sp
.ti 8
ED ufn d:
.sp
where ufn is the name of the file to edit on the currently logged disk and d
is the name of an alternate drive. The ED program reads and processes the
source file and writes the new file to drive d using the name ufn. After
processing, the original file becomes the back-up file. If the operator is
addressing disk A, the following command is valid.
.sp
.ti 8
ED X.ASM b:
.sp
This edits the file X.ASM on drive A, creating the new file X.$$$ on
drive B. After a successful edit, A:X.ASM is renamed to A:X.BAK, and
B:X.$$$ is renamed to B:X.ASM. For convenience, the currently logged disk
becomes drive B at the end of the edit. Note that if a file
named B:X.ASM exists before the editing begins, the following
message appears on the screen:
.bp
.sp
.ti 8
FILE EXISTS
.sp
This message is a precaution against accidentally destroying
a source file. You should first erase the existing file and then restart
the edit operation.
.pp
Similar to other transient commands, editing can take place on a drive
different from the currently logged disk by preceding the source filename
by a drive name. The following are examples of valid edit
requests:
.sp 2
.in 25
.ti -17
ED A:X.ASM Edits the file X.ASM on drive A, with new file and back-up
on drive A.
.sp
.ti -17
ED B:X.ASM A: Edits the file X.ASM on drive B to the temporary file X.$$$
on drive A. After editing, this command changes X.ASM on drive B to X.BAK
and changes X.$$$ on drive A to X.ASM.
.in 0
.ll 65
.sp 2
.tc 1.6.6 SYSGEN Command
.sh
1.6.6 SYSGEN Command
.qs
.sp
Syntax:
.sp
.ti 8
SYSGEN
.pp
The SYSGEN transient command allows generation of an initialized disk
containing the CP/M operating system. The SYSGEN program prompts the
console for commands by interacting as shown.
.sp 2
.in 24
.ti 8
SYSGEN <cr>
.sp
Initiates the SYSGEN program.
.sp 2
.ti 8
SYSGEN VERSION x.x
.sp
SYSGEN sign-on message.
.sp 2
.in 8
.nf
SOURCE DRIVE NAME
(OR RETURN TO SKIP)
.in 24
.sp
.fi
Respond with the drive name (one of the letters A, B, C, or D) of the
disk containing a CP/M system, usually A. If a copy of CP/M already exists
in memory due to a MOVCPM command, press only a carriage return. Typing a
drive name d causes the response:
.sp 2
.ti 8
SOURCE ON d THEN TYPE RETURN
.sp
Place a disk containing the CP/M operating
system on drive d (d is one of A, B, C, or D). Answer by pressing a carriage
return when ready.
.sp 2
.ti 8
FUNCTION COMPLETE
.sp
System is copied to memory. SYSGEN then prompts with the following:
.sp 2
.nf
.in 8
DESTINATION DRIVE NAME
(OR RETURN TO REBOOT)
.fi
.sp
.in 24
If a disk is being initialized, place the new disk into a drive
and answer with the drive name. Otherwise, press a carriage return
and the system reboots from drive A. Typing drive name d causes
SYSGEN to prompt with the following message:
.sp 2
.nf
.in 8
DESTINATION ON d
THEN TYPE RETURN
.fi
.in 24
.sp
Place new disk into drive d; press return when ready.
.sp 2
.ti 8
FUNCTION COMPLETE
.sp
New disk is initialized in drive d.
.in 0
.sp 2
The DESTINATION prompt is repeated until a single carriage return is
pressed at the console, so that more than one disk can be initialized.
.pp
Upon completion of a successful system generation, the new disk contains
the operating system, and only the built-in commands are available. An
IBM-compatible disk appears to CP/M as a disk with an
empty directory; therefore, the operator must copy the appropriate COM files
from an existing CP/M disk to the newly constructed disk using the
PIP transient.
.pp
You can copy all files from an existing disk by typing the following
PIP command:
.sp
.ti 8
PIP B: = A:*.*[v]
.bp
This command copies all files from disk drive A to disk drive B and verifies
that
each file has been copied correctly. The name of each file is displayed at
the console as the copy operation proceeds.
.pp
Note that a SYSGEN does not destroy the files that already
exist on a disk; it only constructs a new operating system. If a
disk is being used only on drives B through P and will never be the
source of a bootstrap operation on drive A, the SYSGEN need not take place.
.sp 2
.tc 1.6.7 SUBMIT Command
.sh
1.6.7 SUBMIT Command
.sp
.ul
Syntax:
.qu
.sp
.ti 8
SUBMIT ufn parm#1 ... parm#n
.pp
The SUBMIT command allows CP/M commands to be batched for automatic
processing. The ufn given in the SUBMIT command must be the filename of a
file that exists on the currently logged disk, with an assumed file type of
SUB. The SUB file contains CP/M prototype commands with possible parameter
substitution. The actual parameters parm#1 ... parm#n are substituted into
the prototype commands, and, if no errors occur, the file of substituted
commands are processed sequentially by CP/M.
.pp
The prototype command file is created using the ED program, with
interspersed $ parameters of the form:
.sp
.ti 8
$1 $2 $3 ...$n
.sp
corresponding to the number of actual parameters that will be included when
the file is submitted for execution. When the SUBMIT transient is executed,
the actual parameters parm#1 ... parm#n are paired with the formal parameters
$1 ... $n in the prototype commands. If the numbers of formal and actual
parameters do not correspond, the SUBMIT function is aborted with an error
message at the console. The SUBMIT function creates a file of substituted
commands with the name
.mt 5
.hm 2
.sp
.ti 8
$$$.SUB
.sp
on the logged disk. When the system reboots, at the termination of the
SUBMIT, this command file is read by the CCP as a source of input rather
than the console. If the SUBMIT function is performed on any disk other
than drive A, the commands are not processed until the disk is inserted into
drive A and the system reboots. You can abort command processing at
any time by pressing the rubout key when the command is read and echoed. In
this case, the $$$.SUB file is removed and the subsequent commands come
from the console. Command processing is also aborted if the CCP detects an
error in any of the commands. Programs that execute under CP/M can abort
processing of command files when error conditions occur by erasing any
existing $$$.SUB file.
.pp
To introduce dollar signs into a SUBMIT file, you can type a $$
which reduces to a single $ within the command file. A caret,
^, precedes an alphabetic character s, which produces a single CTRL-X
character within the file.
.pp
The last command in a SUB file can initiate another SUB file, allowing
chained batch commands:
.pp
Suppose the file ASMBL.SUB exists on disk and contains the prototype commands
.sp
.in 8
.nf
ASM $1
DIR $1.*
ERA *.BAK
PIP $2:=$1.PRN
ERA $1.PRN
.fi
.in 0
.sp
then, you issue the following command:
.sp
.ti 8
SUBMIT ASMBL X PRN
.sp
The SUBMIT program reads the ASMBL.SUB file,
substituting X: for all occurrences of $1 and PRN for all occurrences of
$2. This results in a $$$.SUB file containing the commands:
.sp
.in 8
.nf
ASM X
DIR X.*
ERA *.BAK
PIP PRN:=X.PRN
ERA X.PRN
.fi
.in 0
.sp
which are executed in sequence by the CCP.
.pp
The SUBMIT function can access a SUB file on an alternate drive by preceding
the filename by a drive name. Submitted files are only acted upon when
they appear on drive A. Thus, it is possible to create a submitted file
on drive B that is executed at a later time when inserted in drive A.
.pp
An additional utility program called XSUB extends the power of the SUBMIT
facility to include line input to programs as well as the CCP. The XSUB
command is included as the first line of the SUBMIT
file. When it is executed, XSUB self-relocates directly below the CCP. All
subsequent SUBMIT command lines are processed by XSUB so that programs that
read buffered console input, BDOS Function 10, receive their input directly
from the SUBMIT file. For example, the file SAVER.SUB can contain the
following SUBMIT lines:
.sp
.in 8
.nf
XSUB
DDT
|$1.COM
R
GO
SAVE 1 $2.COM
.fi
.in 0
.sp
a subsequent SUBMIT command, such as
.sp
.ti 8
A>\c
.sh
SUBMIT SAVER PIP Y
.qs
.sp
substitutes X for $1 and Y for $2 in the command stream. The XSUB
program loads, followed by DDT, which is sent to the command lines PIP.COM,
R, and G0, thus returning to the CCP. The final command SAVE 1 Y.COM is
processed by the CCP.
.pp
The XSUB program remains in memory and prints the message
.sp
.ti 8
(xsub active)
.sp
on each warm start operation to indicate its presence. Subsequent SUBMIT
command streams do not require the XSUB, unless an intervening cold start
occurs. Note that XSUB must be loaded after the optional
CP/M DESPOOL utility, if both are to run simultaneously.
.sp 2
.tc 1.6.8 DUMP Command
.sh
1.6.8 DUMP Command
.sp
.ul
Syntax:
.qu
.sp
.ti 8
DUMP ufn
.pp
The DUMP program types the contents of the disk file (ufn) at the console in
hexadecimal form. The file contents are listed sixteen bytes at a time,
with the absolute byte address listed to the left of each line in
hexadecimal. Long typeouts can be aborted by pressing the rubout key during
printout. The source listing of the DUMP program is given in Section 5 as
an example of a program written for the CP/M environment.
.sp 2
.tc 1.6.9 MOVCPM Command
.sh
1.6.9 MOVCPM Command
.sp
.ul
Syntax:
.qu
.sp
.ti 8
MOVCPM
.pp
The MOVCPM program allows you to reconfigure the CP/M system for any
particular memory size. Two optional parameters can be used to indicate the
desired size of the new system and the disposition of the new system at
program termination. If the first parameter is omitted or an * is given,
the MOVCPM program reconfigures the system to its maximum size, based
upon the kilobytes of contiguous RAM in the host system (starting at 0000H).
If the second parameter is omitted, the system is executed, but not
permanently recorded; if * is given, the system is left in memory, ready
for a SYSGEN operation. The MOVCPM program relocates a memory image of CP/M
and places this image in memory in preparation for a system generation
operation. The following is a list of MOVCPM command forms:
.sp 2
.in 23
.ti -15
MOVCPM Relocates and executes CP/M for management of the current
memory
configuration (memory is examined for contiguous RAM, starting at 100H).
On completion of the relocation, the new system is executed but not
permanently recorded on the disk. The system that is constructed
contains a BIOS for the Intel microcomputer development system 800.
.sp
.ti -15
MOVCPM n Creates a relocated CP/M system for management of an n kilobyte
system (n must be in the range of 20 to 64), and executes the system as
described.
.sp
.ti -15
MOVCPM * * Constructs a relocated memory image for the current memory
configuration, but leaves the memory image in memory in preparation for a
SYSGEN operation.
.sp
.ti -15
MOVCPM n * Constructs a relocated memory image for an n kilobyte memory
system, and leaves the memory image in preparation for a SYSGEN operation.
.in 0
.sp
.pp
For example, the command,
.sp
.ti 8
MOVCPM * *
.sp
constructs a new version of the CP/M system and leaves it in
memory, ready for a SYSGEN operation. The message
.sp
.in 8
.nf
READY FOR 'SYSGEN' OR
'SAVE 34 CPMxx.COM'
.fi
.in 0
.sp
appears at the console upon completion, where xx is the current memory
size in kilobytes. You can then type the following sequence:
.sp 2
.in 35
.ti -27
SYSGEN This starts the system generation.
.sp
.nf
.ti -27
SOURCE DRIVE NAME Respond with a carriage return
.sp 0
.fi
.ti -27
(OR RETURN TO SKIP) to skip the CP/M read operation, because the
system is already in memory as a result of the previous MOVCPM operation.
.sp
.nf
.ti -27
DESTINATION DRIVE NAME Respond with B to write new
.sp 0
.fi
.ti -27
(OR RETURN TO REBOOT) system to the disk in drive B. SYSGEN
prompts with the following message:
.sp
.mb 5
.fm 1
.nf
.ti -27
DESTINATION ON B, Place the new disk on drive B
.sp 0
.fi
.ti -27
THEN TYPE RETURN and press the RETURN key when ready.
.in 0
.bp
.mb 6
.fm 2
.pp
If you respond with A rather than B above, the system is
written to drive A rather than B. SYSGEN continues to print this
prompt:
.sp
.ti 8
DESTINATION DRIVE NAME (OR RETURN TO REBOOT)
.sp
until you respond with a single carriage return, which stops the
SYSGEN program with a system reboot.
.pp
You can then go through the reboot process with the old or new
disk. Instead of performing the SYSGEN operation, you can
type a command of the form:
.sp
.ti 8
SAVE 34 CPMxx.COM
.sp
at the completion of the MOVCPM function, where xx is the value indicated
in the SYSGEN message. The CP/M memory image on the currently logged disk is
in a form that can be patched. This is necessary when operating in a
nonstandard environment where the BIOS must be altered for a particular
peripheral device configuration, as described in Section 6.
.pp
The following are valid MOVCPM commands:
.sp 2
.in 23
.ti -15
MOVCPM 48 Constructs a 48K version of CP/M and starts execution.
.sp
.mb 5
.fm 1
.ti -15
MOVCPM 48 * Constructs a 48K version of CP/M in preparation for permanent
recording; the response is
.sp
.nf
READY FOR 'SYSGEN' OR
'SAVE 34 CPM48.COM'
.fi
.sp
.ti -15
MOVCPM * * Constructs a maximum memory version of CP/M and
starts execution.
.in 0
.pp
The newly created system is serialized with the number attached to the
original disk and is subject to the conditions of the Digital Research
Software Licensing Agreement.
.sp 2
.he CP/M Operating System Manual 1.7 BDOS Error Messages
.tc 1.7 BDOS Error Messages
.sh
1.7 BDOS Error Messages
.qs
.mb 6
.fm 2
.pp
There are three error situations that the Basic Disk Operating System
intercepts during file processing. When one of these conditions is detected,
the BDOS prints the message:
.sp
.ti 8
BDOS ERR ON d: error
.bp
where d is the drive name and error is one of the three error messages:
.sp
.in 8
.nf
BAD SECTOR
SELECT
READ ONLY
.fi
.in 0
.pp
The BAD SECTOR message indicates that the disk controller electronics has
detected an error condition in reading or writing the disk. This
condition is generally caused by a malfunctioning disk controller or an
extremely worn disk. If you find that CP/M reports this
error more than once a month, the state of the controller electronics and the
condition of the media should be checked.
.pp
You can also encounter this condition in reading files generated
by a controller produced by a different manufacturer. Even
though controllers claim to be IBM..-compatible, one
often finds small differences in recording formats. The Model 800 controller,
for example, requires two bytes of one's following the data CRC byte, which
is not required in the IBM format. As a result, disks generated by the
Intel microcomputer development system can be read by almost all
other IBM-compatible system, while disk files generated on other
manufacturers' equipment produce the BAD SECTOR message when read
by the microcomputer development system. To recover from this
condition, press a CTRL-C to reboot (the safest course), or a
return, which ignores the bad sector in the file operation.
.sp
.sh
Note: \c
.qs
pressing a return might destroy disk integrity if the
operation is a directory write. Be sure you have adequate
back-ups in this case.
.pp
The SELECT error occurs when there is an attempt to address a drive beyond
the range supported by the BIOS. In this case, the value of d in the error
message gives the selected drive. The system reboots following any input
from the console.
.pp
The READ ONLY message occurs when there is an attempt to write to a
disk or file that has been designated as Read-Only in a STAT command or
has been set to Read-Only by the BDOS. Reboot CP/M by
using the warm start procedure, CTRL-C, or by performing a cold start
whenever the disks are changed. If a changed disk is to be read but
not written, BDOS allows the disk to be changed without the warm or
cold start, but internally marks the drive as Read-Only. The status of the
drive is subsequently changed to Read-Write if a warm or cold start occurs.
On issuing this message, CP/M waits for input from the console. An automatic
warm start takes place following any input.
.sp 2
.he CP/M Operating System Manual 1.8 Operation of CP/M on the Model 800
.tc 1.8 CP/M Operation on the Model 800
.sh
1.8 CP/M Operation on the Model 800
.pp
This section gives operating procedures for using CP/M on the
Intel Model 800 microcomputer development system microcomputer development
system. Basic knowledge of the microcomputer development system
hardware and software systems is assumed.
.pp
CP/M is initiated in essentially the same manner as the Intel ISIS operating
system. The disk drives are labeled 0 through 3 on the
microcomputer development system, corresponding
to CP/M drives A through D, respectively. The CP/M system disk is
inserted into drive 0, and the BOOT and RESET switches are pressed in
sequence. The interrupt 2 light should go on at this point. The space bar
is then pressed on the system console, and the light should go
out. If it does not, the user should check connections and baud rates. The
BOOT
switch is turned off, and the CP/M sign-on message should appear at the
selected console device, followed by the A> system prompt. You
can then issue the various resident and transient commands.
.pp
The CP/M system can be restarted (warm start) at any time by pushing the
INT 0 switch on the front panel. The built-in Intel ROM monitor can be
initiated by pushing the INT 7 switch, which generates an RST 7, except when
operating under DDT, in which case the DDT program gets control instead.
.pp
Diskettes can be removed from the drives at any time, and the system can be
shut down during operation without affecting data integrity. Do
not remove a disk and replace it with another without rebooting the
system (cold or warm start) unless the inserted disk is Read-Only.
.pp
As a result of hardware hang-ups or malfunctions, CP/M might
print the following message:
.sp
.ti 8
BDOS ERR ON d: BAD SECTOR
.sp
where d is the drive that has a permanent error. This error can occur when
drive doors are opened and closed randomly, followed by disk operations, or
can be caused by a disk, drive, or controller failure. You can
optionally elect to ignore the error by pressing a single return at the
console. The error might produce a bad data record, requiring
reinitialization
of up to 128 bytes of data. You can reboot the CP/M system and try
the operation again.
.pp
Termination of a CP/M session requires no special action, except that it is
necessary to remove the disks before turning the power off to avoid
random transients that often make their way to the drive electronics.
.pp
You should use IBM-compatible disks rather than disks
that have previously been used with any ISIS version. In particular, the
ISIS FORMAT operation produces nonstandard sector numbering throughout the
disk. This nonstandard numbering seriously degrades the performance of
CP/M, and causes CP/M to operate noticeably slower than the distribution
version. If it becomes necessary to reformat a disk, which
should not be the case for standard disks, a program can be
written under CP/M that causes the Model 800 controller to
reformat with sequential sector numbering (1-26) on each track.
.pp
Generally, IBM-compatible 8-inch disks do not need to be formatted.
However, 5 1/4-inch disks need to be formatted.
.sp 2
.ce
End of Section 1
.nx two


2
Source/Doc/CPM 22 Manual/part1.tex

@ -1,2 +0,0 @@
.nx front


2
Source/Doc/CPM 22 Manual/part2.tex

@ -1,2 +0,0 @@
.nx appa.tex


2
Source/Doc/CPM 22 Manual/part3.tex

@ -1,2 +0,0 @@
.nx apph.tex


807
Source/Doc/CPM 22 Manual/sixa.tex

@ -1,807 +0,0 @@
.bp 1
.op
.cs 5
.mt 5
.mb 6
.pl 66
.ll 65
.po 10
.hm 2
.fm 2
.he
.ft 6-%
.pc 1
.tc 6 CP/M 2 Alteration
.ce
.sh
Section 6
.qs
.sp
.ce
.sh
CP/M 2 Alteration
.qs
.sp 3
.tc 6.1 Introduction
.he CP/M Operating System Manual 6.1 Introduction
.sh
6.1 Introduction
.qs
.pp
The standard CP/M system assumes operation on an Intel Model
800 microcomputer development system , but is designed so you can alter a
specific set of subroutines that define the hardware operating
environment.
.pp
Although standard CP/M 2 is configured for single-density floppy
disks, field-alteration features allow adaptation to a wide
variety of disk subsystems from single-drive minidisks to
high-capacity, hard disk systems. To simplify the following
adaptation process, it is assumed that CP/M 2 is first
configured for single-density floppy disks where minimal editing
and debugging tools are available. If an earlier version of CP/M
is available, the customizing process is eased considerably. In
this latter case, you might want to review the system
generation process and skip to later sections that discuss system
alteration for nonstandard disk systems.
.pp
To achieve device independence, CP/M is separated into three
distinct modules:
.sp
.in 5
.ti -2
o BIOS is the Basic I/O System, which is environment dependent.
.sp
.ti -2
o BDOS is the Basic Disk Operating System, which is not dependent upon the
hardware configuration.
.sp
.ti -2
o CCP is the Console Command Processor, which uses the BDOS.
.fi
.in 0
.pp
Of these modules, only the BIOS is dependent upon the particular
hardware. You can patch the distribution version
of CP/M to provide a new BIOS that provides a customized
interface between the remaining CP/M modules and the
hardware system. This document provides a step-by-step
procedure for patching a new BIOS into CP/M.
.mb 4
.fm 1
.pp
All disk-dependent portions of CP/M 2 are placed into a BIOS, a
resident disk parameter block, which is either hand coded or
produced automatically using the disk definition macro library
provided with CP/M 2. The end user need only specify the maximum
number of active disks, the starting and ending sector numbers,
the data allocation size, the maximum extent of the logical disk,
directory size information, and reserved track values.
The macros use this information to generate
the appropriate tables and table references for use during CP/M 2
operation. Deblocking information is provided, which aids in
assembly or disassembly of sector sizes that are multiples of the
fundamental 128-byte data unit, and the system alteration manual
includes general purpose subroutines that use the deblocking
information to take advantage of larger sector sizes. Use of
these subroutines, together with the table-drive data access
algorithms, makes CP/M 2 a universal data management system.
.pp
File expansion is achieved by providing up to 512 logical file
extents, where each logical extent contains 16K bytes of data.
CP/M 2 is structured, however, so that as much as 128K bytes of
data are addressed by a single physical extent, corresponding to a
single directory entry, maintaining compatibility with previous
versions while taking advantage of directory space.
.pp
If CP/M is being tailored to a computer system for the first
time, the new BIOS requires some simple software development and
testing. The standard BIOS is listed in Appendix A and can be
used as a model for the customized package. A skeletal version
of the BIOS given in Appendix B can serve as the basis for a
modified BIOS.
.mb 6
.fm 2
.pp
In addition to the BIOS, you must write a simple memory
loader, called GETSYS, which brings the operating system into
memory. To patch the new BIOS into CP/M, you must write the
reverse of GETSYS, called PUTSYS, which places an altered version
of CP/M back onto the disk. PUTSYS can be derived from GETSYS by
changing the disk read commands into disk write commands. Sample
skeletal GETSYS and PUTSYS programs are described in Section 6.4
and listed in Appendix C.
.pp
To make the CP/M system load automatically, you must also
supply a cold start loader, similar to the one provided with
CP/M, listed in Appendixes A and D. A skeletal form of a cold
start loader is given in Appendix E, which serves as a model for
the loader.
.mb 4
.fm 1
.sp 2
.tc 6.2 First-level System Regeneration
.he CP/M Operating System Manual 6.2 First-level Regeneration
.sh
6.2 First-level System Regeneration
.qs
.pp
The procedure to patch the CP/M system is given below. Address
references in each step are shown with H denoting the
hexadecimal radix, and are given for a 20K CP/M system. For
larger CP/M systems, a bias is added to each address that is
shown with a +b following it, where b is equal to the memory
size-20K. Values for b in various standard memory sizes are listed in
Table 6-1.
.sp 2
.sh
Table 6-1. Standard Memory Size Values
.nf
Memory Size Value
.fi
.sp
.in 13
24K: b = 24K - 20K = 4K = 1000H
.sp
32K: b = 32K - 20K = 12K = 3000H
.sp
40K: b = 40K - 20K = 20K = 5000H
.sp
48K: b = 48K - 20K = 28K = 7000H
.sp
56K: b = 56K - 20K = 36K = 9000H
.sp
62K: b = 62K - 20K = 42K = A800H
.sp
64K: b = 64K - 20K = 44K = B000H
.fi
.in 0
.pp
Note that the standard distribution version of CP/M is set for
operation within a 20K CP/M system. Therefore, you must first bring up
the 20K CP/M system, then configure it for actual
memory size (see Section 6.3).
.pp
Follow these steps to patch your CP/M system:
.sp 2
.in 8
.ti -3
1) Read Section 6.4 and write a GETSYS program that reads the
first two tracks of a disk into memory. The program from the
disk must be loaded starting at location 3380H. GETSYS is coded
to start at location 100H (base of the TPA) as shown in Appendix
C.
.mb 6
.fm 2
.sp
.ti -3
2) Test the GETSYS program by reading a blank disk into memory,
and check to see that the data has been read properly and that
the disk has not been altered in any way by the GETSYS program.
.sp
.ti -3
3) Run the GETSYS program using an initialized CP/M disk to see
if GETSYS loads CP/M starting at 3380H (the operating system
actually starts 128 bytes later at 3400H).
.sp
.ti -3
4) Read Section 6.4 and write the PUTSYS program. This writes
memory starting at 3380H back onto the first two tracks of the
disk. The PUTSYS program should be located at 200H, as shown in
Appendix C.
.sp
.ti -3
5) Test the PUTSYS program using a blank, uninitialized disk by
writing a portion of memory to the first two tracks; clear memory
and read it back using GETSYS. Test PUTSYS completely, because
this program will be used to alter CP/M on disk.
.sp
.ti -3
6) Study Sections 6.5, 6.6, and 6.7 along with the distribution
version of the BIOS given in Appendix A and write a simple
version that performs a similar function for the customized
environment. Use the program given in Appendix B as a model.
Call this new BIOS by name CBIOS (customized BIOS). Implement
only the primitive disk operations on a single drive and simple
console input/output functions in this phase.
.sp
.ti -3
7) Test CBIOS completely to ensure that it properly performs
console character I/O and disk reads and writes. Be careful to
ensure that no disk write operations occur during read operations
and check that the proper track and sectors are addressed on all
reads and writes. Failure to make these checks might cause
destruction of the initialized CP/M system after it is patched.
.mb 4
.fm 1
.sp
.ti -3
8) Referring to Table 6-3 in Section 6.5, note that the BIOS is
placed between locations 4A00H and 4FFFH. Read the CP/M system
using GETSYS and replace the BIOS segment by the CBIOS developed
in step 6 and tested in step 7. This replacement is done in
memory.
.sp
.ti -3
9) Use PUTSYS to place the patched memory image of CP/M onto the
first two tracks of a blank disk for testing.
.sp
.ti -4
10) Use GETSYS to bring the copied memory image from the test
disk back into memory at 3380H and check to ensure that it has
loaded back properly (clear memory, if possible, before the
load). Upon successful load, branch to the cold start code at
location 4A00H. The cold start routine initializes page
zero, then jumps to the CCP at location 3400H, which calls the
BDOS, which calls the CBIOS. The CCP asks the CBIOS to read
sixteen sectors on track 2, and CP/M types A>, the system
prompt.
.mb 6
.fm 2
.sp
If difficulties are encountered, use whatever debug facilities
are available to trace and breakpoint the CBIOS.
.sp
.ti -4
11) Upon completion of step 10, CP/M has prompted the console for
a command input. To test the disk write operation, type
.sp
SAVE 1 X.COM
.sp
All commands must be followed by a carriage return. CP/M
responds with another prompt after several disk accesses:
.sp
A>
.sp
If it does not, debug the disk write functions and retry.
.sp
.ti -4
12) Test the directory command by typing
.sp
DIR
.sp
CP/M responds with
.sp
A:X COM
.sp
.ti -4
13) Test the erase command by typing
.sp
ERA X.COM
.sp
CP/M responds with the A prompt. This is now an operational
system that only requires a bootstrap loader to function
completely.
.sp
.ti -4
14) Write a bootstrap loader that is similar to GETSYS and place
it on track 0, sector 1, using PUTSYS (again using the test disk,
not the distribution disk). See Sections 6.5 and 6.8 for more
information on the bootstrap operation.
.sp
.ti -4
15) Retest the new test disk with the bootstrap loader installed
by executing steps 11, 12, and 13. Upon completion of these
tests, type a CTRL-C. The system executes a warm start, which
reboots the system, and types the A prompt.
.sp
.ti -4
16) At this point, there is probably a good version of the
customized CP/M system on the test disk. Use GETSYS to load CP/M
from the test disk. Remove the test disk, place the distribution
disk, or a legal copy, into the drive, and use PUTSYS to
replace the distribution version with the customized version.
Do not make this replacement if you are unsure of the patch
because this step destroys the system that was obtained from
Digital Research.
.sp
.ti -4
17) Load the modified CP/M system and test it by typing
.sp
DIR
.sp
CP/M responds with a list of files that are provided on the
initialized disk. The file DDT.COM is the memory image for the
debugger. Note that from now on, you must always reboot the
CP/M system (CTRL-C is sufficient) when the disk is removed and
replaced by another disk, unless the new disk is to be Read-Only.
.sp
.ti -4
18) Load and test the debugger by typing
.sp
DDT
.sp
See Chapter 4 for operating procedures.
.sp
.ti -4
19) Before making further CBIOS modifications, practice using the
editor (see Chapter 2), and assembler (see Chapter 3). Recode
and test the GETSYS, PUTSYS, and CBIOS programs using ED, ASM,
and DDT. Code and test a COPY program that does a sector-to-sector
copy from one disk to another to obtain back-up copies of
the original disk. Read the CP/M Licensing Agreement specifying
legal responsibilities when copying the CP/M system. Place the
following copyright notice:
.sp
.nf
Copyright (c), 1983
Digital Research
.fi
.sp
on each copy that is made with the COPY program.
.sp
.ti -4
20) Modify the CBIOS to include the extra functions for punches,
readers, and sign-on messages, and add the facilities for
additional disk drives, if desired. These changes can be made
with the GETSYS and PUTSYS programs or by referring to the
regeneration process in Section 6.3.
.fi
.in 0
.sp
.pp
You should now have a good copy of the customized CP/M
system. Although the CBIOS portion of CP/M belongs to the user,
the modified version cannot be legally copied.
.pp
It should be noted that the system remains file-compatible with
all other CP/M systems (assuming media compatibility) which
allows transfer of nonproprietary software between CP/M users.
.tc 6.3 Second-level System Generation
.bp
.he CP/M Operating System Manual 6.3 Second-level System Generation
.sh
6.3 Second-level System Generation
.qs
.pp
Once the system is running, the next step is to configure CP/M
for the desired memory size. Usually, a memory image is first
produced with the MOVCPM program (system relocator) and then
placed into a named disk file. The disk file can then be loaded,
examined, patched, and replaced using the debugger and the
system generation program (refer to Chapter 1).
.pp
The CBIOS and BOOT are modified using ED and assembled using ASM,
producing files called CBIOS.HEX and BOOT.HEX, which contain the
code for CBIOS and BOOT in Intel hex format.
.pp
To get the memory image of CP/M into the TPA configured for the
desired memory size, type the command:
.sp
.ti 8
MOVCPM xx*
.sp
where xx is the memory size in decimal K bytes, for example, 32
for 32K. The response is as follows:
.sp
.nf
.in 8
CONSTRUCTING xxK CP/M VERS 2.0
.sp
READY FOR "SYSGEN" OR
.sp
"SAVE 34 CPMxx.COM"
.fi
.in 0
.pp
An image of CP/M in the TPA is configured for the requested
memory size. The memory image is at location 0900H through
227FH, that is, the BOOT is at 0900H, the CCP is at 980H, the
BDOS starts at 1180H, and the BIOS is at 1F80H. Note that the
memory image has the standard Model 800 BIOS and BOOT on it. It is now
necessary to save the memory image in a file so that you can
patch the CBIOS and CBOOT into it:
.sp
.ti 8
SAVE 34 CPMxx.COM
.pp
The memory image created by the MOVCPM program is offset by a
negative bias so that it loads into the free area of the TPA, and
thus does not interfere with the operation of CP/M in higher
memory. This memory image can be subsequently loaded under DDT
and examined or changed in preparation for a new generation of
the system. DDT is loaded with the memory image by typing:
.sp
.ti 8
DDT CPMxx.COM Loads DDT, then reads the CP/M image.
.sp
DDT should respond with the following:
.sp
.nf
.in 8
NEXT PC
2300 0100
- The DDT prompt
.fi
.in 0
.sp
You can then give the display and disassembly commands to examine
portions of the memory image between 900H and 227FH.
Note, however, that to find any particular address
within the memory image, you must apply the negative bias to the
CP/M address to find the actual address. Track 00, sector 01, is
loaded to location 900H (the user should find the cold start
loader at 900H to 97FH); track 00, sector 02, is loaded into 980H
(this is the base of the CCP); and so on through the entire CP/M
system load. In a 20K system, for example, the CCP resides at
the CP/M address 3400H, but is placed into memory at 980H by the
SYSGEN program. Thus, the negative bias, denoted by n, satisfies
.sp
.ti 8
3400H + n = 980H, or n =980H - 3400H
.sp
Assuming two's complement arithmetic, n = D580H, which can be
checked by
.sp
.ti 8
.nf
3400H + D580H = 10980H = 0980H (ignoring high-order
overflow).
.fi
.pp
Note that for larger systems, n satisfies
.sp
.nf
.in 8
(3400H+b) + n = 980H, or
n = 980H - (3400H + b), or
n = D580H - b
.fi
.in 0
.sp
The value of n for common CP/M systems is given below.
.sp 2
.sh
Table 6-2. Common Values for CP/M Systems
.sp
.nf
Memory Size BIAS b Negative Offset n
.sp
.in 13
20K 0000H D580H - 0000H = D580H
24K 1000H D580H - 1000H = C580H
32K 3000H D580H - 3000H = A580H
40K 5000H D580H - 5000H = 8580H
48K 7000H D580H - 7000H = 6580H
56K 9000H D580H - 9000H = 4580H
62K A800H D580H - A800H = 2D80H
64K B000H D580H - B000H = 2580H
.fi
.in 0
.sp
.pp
If you want to locate the address x within the memory image
loaded under DDT in a 20K system, first type
.sp
.ti 8
Hx,n Hexadecimal sum and difference
.sp
and DDT responds with the value of x+n (sum) and x-n
(difference). The first number printed by DDT is the actual memory
address in the image where the data or code is located. For example,
the following DDT command:
.sp
.ti 8
H3400,D580
.sp
produces 980H as the sum, which is where the CCP
is located in the memory image under DDT.
.pp
Type the L command to disassemble portions of the
BIOS located at (4A00H+b)-n, which, when one uses the H command,
produces an actual address of 1F80H. The disassembly command
would thus be as follows:
.sp
.ti 8
L1F80
.sp
It is now necessary to patch in the CBOOT and CBIOS routines. The BOOT
resides at location 0900H in the memory image. If the actual
load address is n, then to calculate the bias (m),
type the command:
.sp
.ti 8
H900,n Subtract load address from target address.
.pp
The second number typed by DDT in response to the command is the
desired bias (m). For example, if the BOOT executes at 0080H,
the command
.sp
.ti 8
H900,80
.sp
produces
.sp
.ti 8
0980 0880 Sum and difference in hex.
.sp
Therefore, the bias m would be 0880H. To read-in the BOOT, give the command:
.sp
.ti 8
ICBOOT.HEX Input file CBOOT.HEX
.sp
Then
.sp
.ti 8
Rm Read CBOOT with a bias of m (=900H-n).
.sp
Examine the CBOOT with
.sp
.ti 8
L900
.sp
You are now ready to replace the CBIOS by examining the area at
1F80H, where the original version of the CBIOS resides, and then
typing
.sp
.ti 8
ICBIOS.HEX Ready the hex file for loading.
.pp
Assume that the CBIOS is being integrated into a 20K
CP/M system and thus originates at location 4A00H. To locate the
CBIOS properly in the memory image under DDT, you must apply the
negative bias n for a 20K system when loading the hex file. This
is accomplished by typing
.sp
.ti 8
RD580 Read the file with bias D580H.
.sp
Upon completion of the read, reexamine the area
where the CBIOS has been loaded (use an L1F80 command) to ensure
that it is properly loaded. When you are satisfied that the change has
been made, return from DDT using a CTRL-C or, G0 command.
.pp
SYSGEN is used to replace the patched memory image back onto a
disk (you use a test disk until sure of the
patch) as shown in the following interaction:
.sp 2
.nf
.in 8
SYSGEN Start the SYSGEN program.
.sp
SYSGEN VERSION 2.0 Sign-on message from SYSGEN.
.sp
SOURCE DRIVE NAME Respond with a carriage return
(OR RETURN TO SKIP) to skip the CP/M read operation
because the system is already
in memory.
.sp
DESTINATION DRIVE NAME Respond with B to write the new
(OR RETURN TO REBOOT) system to the disk in drive B.
.sp
DESTINATION ON B, Place a scratch disk in drive
THEN TYPE RETURN B, then press RETURN.
.sp
FUNCTION COMPLETE
DESTINATION DRIVE NAME
(OR RETURN TO REBOOT)
.fi
.in 0
.sp
.pp
Place the scratch disk in drive A, then
perform a cold start to bring up the newly-configured CP/M
system.
.pp
The new CP/M system is then tested and the Digital Research
copyright notice is placed on the disk, as specified in the
Licensing Agreement:
.sp
.nf
.in 8
Copyright (c), 1979
Digital Research
.fi
.in 0
.sp 2
.tc 6.4 Sample GETSYS and PUTSYS Programs
.he CP/M Operating System Manual 6.4 Sample GETSYS and PUTSYS
.sh
6.4 Sample GETSYS and PUTSYS Programs
.qs
.pp
The following program provides a framework for the GETSYS and
PUTSYS programs referenced in Sections 6.1 and 6.2. To read and
write the specific sectors, you must insert the READSEC and WRITESEC
subroutines.
.bp
.nf
; GETSYS PROGRAM -- READ TRACKS 0 AND 1 TO MEMORY AT 3380H
; REGISTER USE
.sp
; A (SCRATCH REGISTER)
.sp
; B TRACK COUNT (0, 1)
.sp
; C SECTOR COUNT (1,2,...,26)
.sp
; DE (SCRATCH REGISTER PAIR)
.sp
; HL LOAD ADDRESS
.sp
; SP SET TO STACK ADDRESS
.sp
;
START: LXI SP,3380H ;SET STACK POINTER TO SCRATCH
;AREA
LXI H,3380H ;SET BASE LOAD ADDRESS
MVI B,0 ;START WITH TRACK 0
RDTRK: ;READ NEXT TRACK (INITIALLY 0)
MVI C,1 ;READ STARTING WITH SECTOR 1
.sp
RDSEC: ;READ NEXT SECTOR
CALL READSEC ;USER-SUPPLIED SUBROUTINE
LXI D,128 ;MOVE LOAD ADDRESS TO NEXT 1/2
;PAGE
DAD D ;HL = HL + 128
INR C ;SECTOR = SECTOR + 1
MOV A,C ;CHECK FOR END OF TRACK
CPI 27
JC RDSEC ;CARRY GENERATED IF SECTOR <27
.sp
;
; ARRIVE HERE AT END OF TRACK, MOVE TO NEXT TRACK
INR B
MOV A,B ;TEST FOR LAST TRACK
CPI 2
JC RDTRK ;CARRY GENERATED IF TRACK <2
.sp
;
; USER-SUPPLIED SUBROUTINE TO READ THE DISK
READSEC:
; ENTER WITH TRACK NUMBER IN REGISTER B,
SECTOR NUMBER IN REGISTER C, AND
.sp
; ADDRESS TO FILL IN HL
.sp
;
PUSH B ;SAVE B AND C REGISTERS
PUSH H ;SAVE HL REGISTERS
.sp 2
.sh
Listing 6-1. GETSYS Program
.bp
.................................................
perform disk read at this point, branch to
label START if an error occurs
.................................................
POP H ;RECOVER HL
POP B ;RECOVER B AND C REGISTERS
RET ;BACK TO MAIN PROGRAM
.sp
END START
.fi
.in 0
.sp 2
.sh
Listing 6-1. (continued)
.sp 2
.pp
This program is assembled and listed in Appendix B for reference
purposes, with an assumed origin of 100H. The hexadecimal
operation codes that are listed on the left might be useful if the
program has to be entered through the panel switches.
.pp
The PUTSYS program can be constructed from GETSYS by changing
only a few operations in the GETSYS program given above, as shown
in Appendix C. The register pair HL becomes the dump address,
next address to write, and operations on these registers do not
change within the program. The READSEC subroutine is replaced by
a WRITESEC subroutine, which performs the opposite function; data
from address HL is written to the track given by register B
and sector given by register C. It is often useful to combine
GETSYS and PUTSYS into a single program during the test and
development phase, as shown in Appendix C.
.sp 2
.tc 6.5 Disk Organization
.he CP/M Operating System Manual 6.5 Disk Organization
.sh
6.5 Disk Organization
.qs
.pp
The sector allocation for the standard distribution version of
CP/M is given here for reference purposes. The first sector contains
an optional software boot section (see the table on the following
page. Disk controllers are often set up to bring track 0,
sector 1, into memory at a specific location, often location
0000H. The program in this sector, called BOOT, has the
responsibility of bringing the remaining sectors into memory
starting at location 3400H+b. If the controller does not
have a built-in sector load, the program in track 0, sector 1 can
be ignored. In this case, load the program from track 0, sector
2, to location 3400H+b.
.pp
As an example, the Intel Model 800
hardware cold start loader brings track 0, sector 1, into
absolute address 3000H. Upon loading this sector, control
transfers to location 3000H, where the bootstrap operation
commences by loading the remainder of track 0 and all of track 1
into memory, starting at 3400H+b. Note that this bootstrap
loader is of little use in a non-microcomputer development system
environment, although it is useful to examine it because some of
the boot actions will have to be duplicated in the user's cold
start loader.
.bp
.sh
Table 6-3. CP/M Disk Sector Allocation
.sp
.nf
Track # Sector Page# Memory Address CP/M Module name
.sp
00 01 (boot address) Cold Start Loader
00 02 00 3400H+b CCP
' 03 ' 3480H+b '
' 04 01 3500H+b '
' 05 ' 3580H+b '
' 06 02 3600H+b '
' 07 ' 3680H+b '
' 08 03 3700H+b '
' 09 ' 3780H+b '
' 10 04 3800H+b '
' 11 ' 3880H+b '
' 12 05 3900H+b '
' 13 ' 3980H+b '
' 14 06 3A00H+b '
' 15 ' 3A80H+b '
' 16 07 3B00H+b '
00 17 ' 3B80H+b CCP
00 18 08 3C00H+b BDOS
' 19 ' 3C80H+b '
' 20 09 3D00H+b '
' 21 ' 3D80H+b '
' 22 10 3E00H+b '
' 23 ' 3E80H+b '
' 24 11 3F00H+b '
' 25 ' 3F80H+b '
' 26 12 4000H+b '
01 01 ' 4080H+b '
' 02 13 4100H+b '
' 03 ' 4180H+B '
' 04 14 4200H+b '
' 05 ' 4280H+b '
' 06 15 4300H+b '
' 07 ' 4380H+b '
' 08 16 4400H+b '
' 09 ' 4480H+b '
' 10 17 4500H+b '
' 11 ' 4580H+b '
' 12 18 4600H+b '
' 13 ' 4680H+b '
' 14 19 4700H+b '
' 15 ' 4780H+b '
' 16 20 4800H+b '
' 17 ' 4880H+b '
' 18 21 4900H+b '
.mb 4
.fm 1
01 19 ' 4900H+b BDOS
07 20 22 4A00H+b BIOS
' 21 ' 4A80H+b '
' 22 23 4B00H+b '
' 23 ' 4B80H+b '
' 24 24 4C00H+b '
01 25 ' 4C80H+b BIOS
01 26 25 4D00H+b BIOS
02-76 01-26 (directory and data)
.fi
.nx sixb


1311
Source/Doc/CPM 22 Manual/sixb.tex

File diff suppressed because it is too large

447
Source/Doc/CPM 22 Manual/test.tex

@ -1,447 +0,0 @@
.op
.sp 15
.ce 100
.bo 5
CP/M
.sp
.sh
Operating System
.sp
.sh
Manual
.cs 5
.sp 10
Copyright (c) 1982
.sp
Digital Research
P.O. Box 579
160 Central Avenue
Pacific Grove, CA 93950
(408) 649-3896
TWX 910 360 5001
.sp 4
All Rights Reserved
.ce 0
.bp
.po 17
.ll 50
.ce
COPYRIGHT
.sp
Copyright (c) 1976, 1977, 1978, 1979, 1982, 1983, and 1984 by
Digital Research Inc. All rights reserved. No part of this
publication may be reproduced, transmitted, transcribed, stored
in a retrieval system, or translated into any language or
computer language, in any form or by any means, electronic, mechanical,
magnetic, optical, chemical, manual or otherwise, without the prior
written permission of Digital Research Inc., Post Office Box 579,
Pacific Grove, California, 93950.
.sp
Thus, readers are granted permission to include the example
programs, either in whole or in part, in their own programs.
.sp 2
.ce
DISCLAIMER
.sp
Digital Research Inc. makes no representations or warranties with
respect to the contents hereof and specifically disclaims
any implied warranties of merchantability or fitness for
any particular purpose. Further, Digital Research Inc. reserves the
right to revise this publication and to make changes from
time to time in the content hereof without obligation of
Digital Research Inc. to notify any person of such revision or
changes.
.sp 2
.ce
TRADEMARKS
.sp
CP/M, CP/NET, and Digital Research and its logo are registered
trademarks of Digital Research. ASM, DESPOOL, DDT, LINK-80, MAC,
MP/M, PL/I-80 and SID are trademarks of Digital Research. IBM is
a registered trademark of International Business Machines. Intel
is a registered trademark of Intel Corporation. TI Silent 700 is
a trademark of Texas Instruments Incorporated. Zilog and Z80 are
registered trademarks of Zilog, Inc.
.mb 4
.fm 1
.sp 3
The \c
.ul
CP/M Operating System Manual \c
.qu
was prepared using the Digital Research TEX Text Formatter and printed
in the United States of America.
.sp 2
.ce 6
*********************************
* First Edition: 1976 *
* Second Edition: July 1982 *
* Third Edition: March 1983 *
* Fourth Edition: March 1984 *
*********************************
.po 10
.ll 65
.in 0
.bp
.cs 5
.mt 5
.mb 6
.pl 66
.ll 65
.po 10
.hm 2
.fm 2
.he
.ft iii
.bp
.ce
.sh
Table of Contents
.sp 3
.nf
.sh
1 CP/M Features and Facilities
.sp
1.1 Introduction . . . . . . . . . . . . . . . . . . . 1-1
.sp
1.2 Functional Description . . . . . . . . . . . . . . 1-3
.sp
1.2.1 General Command Structure . . . . . . . . . 1-3
1.2.2 File References . . . . . . . . . . . . . . 1-3
.sp
1.3 Switching Disks . . . . . . . . . . . . . . . . . . 1-5
1.4 Built-in Commands . . . . . . . . . . . . . . . . . 1-6
.sp
1.4.1 ERA Command . . . . . . . . . . . . . . . . 1-6
1.4.2 DIR Command . . . . . . . . . . . . . . . . 1-7
1.4.3 REN Command . . . . . . . . . . . . . . . . 1-8
1.4.4 SAVE Command . . . . . . . . . . . . . . . . 1-8
1.4.5 TYPE Command . . . . . . . . . . . . . . . . 1-9
1.4.6 USER Command . . . . . . . . . . . . . . . . 1-9
.sp
1.5 Line Editing and Output Control . . . . . . . . . . 1-10
.sp
1.6 Transient Commands . . . . . . . . . . . . . . . . 1-11
.sp
1.6.1 STAT Command . . . . . . . . . . . . . . . . 1-12
1.6.2 ASM Command . . . . . . . . . . . . . . . . 1-18
1.6.3 LOAD Command . . . . . . . . . . . . . . . . 1-19
1.6.4 PIP . . . . . . . . . . . . . . . . . . . . 1-20
1.6.5 ED Command . . . . . . . . . . . . . . . . . 1-29
1.6.6 SYSGEN Command . . . . . . . . . . . . . . . 1-31
1.6.7 SUBMIT Command . . . . . . . . . . . . . . . 1-33
1.6.8 DUMP Command . . . . . . . . . . . . . . . . 1-35
1.6.9 MOVCPM Command . . . . . . . . . . . . . . . 1-35
.sp
1.7 BDOS Error Messages . . . . . . . . . . . . . . . . 1-37
.sp
1.8 CP/M Operation on the Model 800 . . . . . . . . . . 1-38
.sp 2
.sh
2 The CP/M Editor
.sp
2.1 Introduction to ED . . . . . . . . . . . . . . . . 2-1
.sp
2.1.1 ED Operation . . . . . . . . . . . . . . . . 2-1
2.1.2 Text Transfer Functions . . . . . . . . . . 2-3
2.1.3 Memory Buffer Organization . . . . . . . . . 2-4
2.1.4 Line Numbers and ED Start-up . . . . . . . . 2-5
2.1.5 Memory Buffer Operation . . . . . . . . . . 2-6
2.1.6 Command Strings . . . . . . . . . . . . . . 2-7
2.1.7 Text Search and Alteration . . . . . . . . . 2-10
2.1.8 Source Libraries . . . . . . . . . . . . . . 2-13
2.1.9 Repetitive Command Execution . . . . . . . . 2-14
.bp
.ft iv
.ce
.sh
Table of Contents
.qs
.sp
.ce
.sh
(continued)
.qs
.sp 3
2.2 ED Error Conditions . . . . . . . . . . . . . . . . 2-14
.sp
2.3 Control Characters and Commands . . . . . . . . . . 2-16
.sp 2
.sh
3 CP/M Assembler
.qs
.sp
3.1 Introduction . . . . . . . . . . . . . . . . . . . 3-1
.sp
3.2 Program Format . . . . . . . . . . . . . . . . . . 3-3
.sp
3.3 Forming the Operand . . . . . . . . . . . . . . . . 3-4
.sp
3.3.1 Labels . . . . . . . . . . . . . . . . . . . 3-4
3.3.2 Numeric Constants . . . . . . . . . . . . . 3-5
3.3.3 Reserved Words . . . . . . . . . . . . . . . 3-5
3.3.4 String Constants . . . . . . . . . . . . . . 3-6
3.3.5 Arithmetic and Logical Operators . . . . . . 3-7
3.3.6 Precedence of Operators . . . . . . . . . . 3-8
.sp
3.4 Assembler Directives . . . . . . . . . . . . . . . 3-9
.sp
3.4.1 The ORG Directive . . . . . . . . . . . . . 3-10
3.4.2 The END Directive . . . . . . . . . . . . . 3-10
3.4.3 The EQU Directive . . . . . . . . . . . . . 3-11
3.4.4 The SET Directive . . . . . . . . . . . . . 3-11
3.4.5 The IF and ENDIF Directives . . . . . . . . 3-12
3.4.6 The DB Directive . . . . . . . . . . . . . . 3-13
3.4.7 The DW Directive . . . . . . . . . . . . . . 3-14
3.4.8 The DS Directive . . . . . . . . . . . . . . 3-14
.sp
3.5 Operation Codes . . . . . . . . . . . . . . . . . . 3-15
.sp
3.5.1 Jumps, Calls, and Returns . . . . . . . . . 3-15
3.5.2 Immediate Operand Instructions . . . . . . . 3-17
3.5.3 Increment and Decrement Instructions . . . . 3-17
3.5.4 Data Movement Instructions . . . . . . . . . 3-18
3.5.5 Arithmetic Logic Unit Operations . . . . . . 3-19
3.5.6 Control Instructions . . . . . . . . . . . . 3-21
.sp
3.6 Error Messages . . . . . . . . . . . . . . . . . . 3-21
.sp
3.7 A Sample Session . . . . . . . . . . . . . . . . . 3-23
.bp
.ft v
.ce
.sh
Table of Contents
.qs
.sp
.ce
.sh
(continued)
.qs
.sp 3
.sh
4 CP/M Dynamic Debugging Tool
.qs
.sp
4.1 Introduction . . . . . . . . . . . . . . . . . . . 4-1
.sp
4.2 DDT Commands . . . . . . . . . . . . . . . . . . . 4-3
.sp
4.2.1 The A (Assembly) Command . . . . . . . . . . 4-3
4.2.2 The D (Display) Command . . . . . . . . . . 4-4
4.2.3 The F (Fill) Command . . . . . . . . . . . . 4-5
4.2.4 The G (Go) Command . . . . . . . . . . . . . 4-5
4.2.5 The I (Input) Command . . . . . . . . . . . 4-6
4.2.6 The L (List) Command . . . . . . . . . . . . 4-6
4.2.7 The M (Move) Command . . . . . . . . . . . . 4-7
4.2.8 The R (Read) Command . . . . . . . . . . . . 4-7
4.2.9 The S (Set) Command . . . . . . . . . . . . 4-8
4.2.1- The T (Trace) Command . . . . . . . . . . . 4-8
4.2.11 The U (Untrace) Command . . . . . . . . . . 4-9
4.2.12 The X (Examine) Command . . . . . . . . . . 4-9
.sp
4.3 Implementation Notes . . . . . . . . . . . . . . . 4-10
.sp
4.4 A Sample Program . . . . . . . . . . . . . . . . . 4-11
.sp 2
.sh
5 CP/M 2 System Interface
.qs
.sp
5.1 Introduction . . . . . . . . . . . . . . . . . . . 5-1
.sp
5.2 Operating System Call Conventions . . . . . . . . . 5-3
.sp
5.3 A Sample File-to-File Copy Program . . . . . . . . 5-35
.sp
5.4 A Sample File Dump Utility . . . . . . . . . . . . 5-38
.sp
5.5 A Sample Random Access Program . . . . . . . . . . 5-42
.sp
5.6 System Function Summary . . . . . . . . . . . . . . 5-50
.sp 2
.sh
6 CP/M 2 Alteration
.qs
.sp
6.1 Introduction . . . . . . . . . . . . . . . . . . . 6-1
.sp
6.2 First-level System Regeneration . . . . . . . . . . 6-2
.sp
6.3 Second-level System Generation . . . . . . . . . . 6-5
.sp
6.4 Sample GETSYS and PUTSYS Programs . . . . . . . . . 6-9
.bp
.ft vi
.ce
.sh
Table of Contents
.qs
.sp
.ce
.sh
(continued)
.qs
.sp 3
6.5 Disk Organization . . . . . . . . . . . . . . . . . 6-11
.sp
6.6 The BIOS Entry Points . . . . . . . . . . . . . . . 6-13
.sp
6.7 A Sample BIOS . . . . . . . . . . . . . . . . . . . 6-21
.sp
6.8 A Sample Cold Start Loader . . . . . . . . . . . . 6-21
.sp
6.9 Reserved Locations in Page Zero . . . . . . . . . . 6-22
.sp
6.10 Disk Parameter Tables . . . . . . . . . . . . . . 6-23
.sp
6.11 The DISKDEF Macro Library . . . . . . . . . . . . 6-28
.sp
6.12 Sector Blocking and Deblocking . . . . . . . . . . 6-32
.bp
.ft vii
.ce
.sh
Appendixes
.qs
.sp 3
.sh
A \c
.qs
Basic Input/Output System (BIOS) . . . . . . . . . . . A-1
.sp 2
.sh
B \c
.qs
A Skeletal CBIOS . . . . . . . . . . . . . . . . . . . B-1
.sp 2
.sh
C \c
.qs
A Skeletal GETSYS/PUTSYS Program . . . . . . . . . . . C-1
.sp 2
.sh
D \c
.qs
The Model 800 Cold Start Loader for CP/M 2 . . . . . . D-1
.sp 2
.sh
E \c
.qs
A Skeletal Cold Start Loader . . . . . . . . . . . . . E-1
.sp 2
.sh
F \c
.qs
CP/M Disk Definition Library . . . . . . . . . . . . . F-1
.sp 2
.sh
G \c
.qs
Blocking and Deblocking Algorithms . . . . . . . . . . G-1
.sp 2
.sh
H \c
.qs
Glossary . . . . . . . . . . . . . . . . . . . . . . . H-1
.sp 2
.sh
I \c
.qs
CP/M Error Messages . . . . . . . . . . . . . . . . . . I-1
.bp
.ft viii
.ce
.sh
Tables, Figures, and Listings
.qs
.sp 3
.sh
Tables
.qs
.sp
1-1. Line-editing Control Characters . . . . . . . . 1-10
1-2. CP/M Transient Commands . . . . . . . . . . . . 1-11
1-3. Physical Devices . . . . . . . . . . . . . . . 1-14
1-4. PIP Parameters . . . . . . . . . . . . . . . . 1-24
.sp
2-1. ED Text Transfer Commands . . . . . . . . . . . 2-3
2-2. Editing Commands . . . . . . . . . . . . . . . 2-6
2-3. Line-editing Controls . . . . . . . . . . . . . 2-7
2-4. Error Message Symbols . . . . . . . . . . . . . 2-13
2-5. ED Control Characters . . . . . . . . . . . . . 2-14
2-6. ED Commands . . . . . . . . . . . . . . . . . . 2-15
.sp
3-1. Reserved Characters . . . . . . . . . . . . . . 3-6
3-2. Arithmetic and Logical Operators . . . . . . . 3-7
3-3. Assembler Directives . . . . . . . . . . . . . 3-9
3-4. Jumps, Calls, and Returns . . . . . . . . . . . 3-15
3-5. Immediate Operand Instructions . . . . . . . . 3-16
3-6. Increment and Decrement Instructions . . . . . 3-17
3-7. Data Movement Instructions . . . . . . . . . . 3-17
3-8. Arithmetic Logic Unit Operations . . . . . . . 3-18
3-9. Error Codes . . . . . . . . . . . . . . . . . . 3-20
3-10. Error Messages . . . . . . . . . . . . . . . . 3-21
.sp
4-1. Line-editing Controls . . . . . . . . . . . . . 4-2
4-2. DDT Commands . . . . . . . . . . . . . . . . . 4-2
4-3. CPU Registers . . . . . . . . . . . . . . . . . 4-9
.sp
5-1. CP/M Filetypes . . . . . . . . . . . . . . . . 5-6
5-2. File Control Block Fields . . . . . . . . . . . 5-7
5-3. Edit Control Characters . . . . . . . . . . . . 5-20
.sp
6-1. Standard Memory Size Values . . . . . . . . . . 6-2
6-2. Common Values for CP/M Systems . . . . . . . . 6-7
6-3. CP/M Disk Sector Allocation . . . . . . . . . . 6-11
6-4. IOBYTE Field Values . . . . . . . . . . . . . . 6-15
6-5. BIOS Entry Points . . . . . . . . . . . . . . . 6-16
6-6. Reserved Locations in Page Zero . . . . . . . . 6-21
6-7. Disk Parameter Headers . . . . . . . . . . . . 6-23
6-8. BSH and BLM Values . . . . . . . . . . . . . . 6-25
6-9. EXM Values . . . . . . . . . . . . . . . . . . 6-25
6-10. BLS Tabluation . . . . . . . . . . . . . . . . 6-26
.sp
I-1. CP/M Error Messages . . . . . . . . . . . . . . I-1
.sp 2
.sh
Figures
.qs
.sp
2-1. Overall ED Operation . . . . . . . . . . . . . 2-2
2-2. Memory Buffer Organization . . . . . . . . . . 2-2
.bp
.ft ix
.ce
.sh
Tables, Figures, and Listings
.qs
.sp
.ce
.sh
(continued)
.qs
.sp 3
.sh
Figures
.qs
.sp
2-3. Logical Organization of Memory Buffer . . . . . 2-4
.sp
5-1. CP/M Memory Organization . . . . . . . . . . . 5-1
5-2. File Control Block Format . . . . . . . . . . . 5-7
.sp
6-1. IOBYTE Fields . . . . . . . . . . . . . . . . . 6-15
6-2. Disk Parameter Header Format . . . . . . . . . 6-22
6-3. Disk Parameter Header Table . . . . . . . . . . 6-23
6-4. Disk Parameter Block Format . . . . . . . . . . 6-24
6-5. AL0 and AL1 . . . . . . . . . . . . . . . . . . 6-25
.sp 2
.sh
Listings
.qs
.sp
6-1. GETSYS Program . . . . . . . . . . . . . . . . 6-9
6-2. BIOS Entry Points . . . . . . . . . . . . . . . 6-13
.nx onea


938
Source/Doc/CPM 22 Manual/threea.tex

@ -1,938 +0,0 @@
.bp 1
.op
.cs 5
.mt 5
.mb 6
.pl 66
.ll 65
.po 10
.hm 2
.fm 2
.he
.ft 3-%
.pc 1
.tc 3 CP/M Assembler
.ce 2
.sh
Section 3
.sp
.sh
CP/M Assembler
.qs
.sp 3
.tc 3.1 Introduction
.he CP/M Operating System Manual 3.1 Introduction
.sh
3.1 Introduction
.qs
.pp 5
The CP/M assembler reads assembly-language source files from the
disk and produces 8080 machine language in Intel hex format.
To start the CP/M assembler, type a command in one of the
following forms:
.sp
.nf
.in 8
ASM filename
ASM filename.parms
.fi
.in 0
.sp
In both cases, the assembler assumes there is a file on the
disk with the name:
.sp
.ti 8
filename.ASM
.sp
which contains an 8080 assembly-language source file. The first
and second forms shown above differ only in that the second form
allows parameters to be passed to the assembler to control source
file access and hex and print file destinations.
.pp
In either case, the CP/M assembler loads and prints the message:
.sp
.ti 8
CP/M ASSEMBLER VER n.n
.sp
where n.n is the current version number. In the case of the
first command, the assembler reads the source file with assumed
filetype ASM and creates two output files
.sp
.in 8
.nf
filename.HEX
filename.PRN
.fi
.in 0
.pp
The HEX file contains the machine code corresponding to the
original program in Intel hex format, and the PRN file contains
an annotated listing showing generated machine code, error flags,
and source lines. If errors occur during translation, they are
listed in the PRN file and at the console.
.pp
The form ASM filename parms is used to redirect input and
output files from their defaults. In this case, the parms
portion of the command is a three-letter group that specifies the
origin of the source file, the destination of the hex file, and
the destination of the print file. The form is
.bp
.ti 8
filename.p1p2p3
.sp
where p1, p2, and p3 are single letters. P1 can be
.sp
.ti 8
A,B, ...,P
.sp
which designates the disk name that contains the source file. P2
can be
.sp
.ti 8
A,B, ...,P
.sp
which designates the disk name that will receive the hex file; or, P2
can be
.sp
.ti 8
Z
.sp
which skips the generation of the hex file.
.pp
P3 can be
.sp
.ti 8
A,B, ...,P
.sp
which designates the disk name that will receive the
print file. P3 can also be specified as
.sp
.ti 8
X
.sp
which places the listing at the console; or
.sp
.ti 8
Z
.sp
which skips generation of the print file. Thus, the command
.sp
.ti 8
ASM X.AAA
.sp
indicates that the source, X.HEX, and print, X.PRN, files
are also to be created on disk A. This form of the command is
implied if the assembler is run from disk A. Given that you are
currently addressing disk A, the above command is the same as
.sp
.ti 8
ASM X
.sp
The command
.sp
.ti 8
ASM X.ABX
.sp
indicates that the source file is to be taken from disk A, the
hex file is to be placed on disk B, and the listing file is to be
sent to the console. The command
.sp
.ti 8
ASM X.BZZ
.sp
takes the source file from disk B and skips the generation of the
hex and print files. This command is useful for fast execution of
the assembler to check program syntax.
.bp
.pp
The source program format is compatible with the Intel 8080
assembler. Macros are not implemented in ASM; see the optional
MAC macro assembler. There are certain extensions in the CP/M
assembler that make it somewhat easier to use. These extensions
are described below.
.sp 2
.tc 3.2 Program Format
.he CP/M Operating System Manual 3.2 Program Format
.sh
3.2 Program Format
.qs
.pp
An assembly-language program acceptable as input to the assembler
consists of a sequence of statements of the form
.sp
.ti 8
line# label operation operand ;comment
.sp
where any or all of the fields may be present in a particular
instance. Each assembly-language statement is terminated with a
carriage return and line-feed (the line-feed is inserted
automatically by the ED program), or with the character !, which
is treated as an end-of-line by the assembler. Thus, multiple
assembly-language statements can be written on the same physical
line if separated by exclamation point symbols.
.pp
The line# is an optional decimal integer value representing the
source program line number, and ASM ignores this field if
present.
.pp
The label field takes either of the following forms:
.sp
.in 8
.nf
identifier
identifier:
.fi
.in 0
.sp
The label field is optional, except where noted in particular statement
types. The identifier is a sequence of alphanumeric characters
where the first character is alphabetic. Identifiers can be
freely used by the programmer to label elements such as program
steps and assembler directives, but cannot exceed 16 characters
in length. All characters are significant in an identifier,
except for the embedded dollar symbol $, which can be used to
improve readability of the name. Further, all lower-case
alphabetics are treated as upper-case. The
following are all valid instances of labels:
.sp 2
.nf
.in 8
x xy long$name
x: yxl: longer$named$data:
X1Y2 X1x2 x234$5678$9012$3456:
.fi
.in 0
.sp
.pp
The operation field contains either an assembler directive or
pseudo operation, or an 8080 machine operation code. The pseudo
operations and machine operation codes are described in Section
3.3.
.pp
Generally, the operand field of the statement contains an
expression formed out of constants and labels, along with
arithmetic and logical operations on these elements. Again, the
complete details of properly formed expressions are given in
Section 3.3.
.pp
The comment field contains arbitrary characters following the
semicolon
symbol until the next real or logical end-of-line. These
characters are read, listed, and otherwise ignored by the
assembler. The CP/M assembler also treats statements that begin
with an * in column one as comment statements that are listed
and ignored in the assembly process.
.pp
The assembly-language program is formulated as a sequence of
statements of the above form, terminated by an optional END
statement. All statements following the END are ignored by the
assembler.
.sp 2
.tc 3.3 Forming the Operand
.he CP/M Operating System Manual 3.3 Forming the Operand
.sh
3.3 Forming the Operand
.qs
.pp
To describe the operation codes and pseudo operations completely,
it is necessary first to present the form of the operand field,
since it is used in nearly all statements. Expressions in the
operand field consist of simple operands, labels, constants, and
reserved words, combined in properly formed subexpressions by
arithmetic and logical operators. The expression computation is
carried out by the assembler as the assembly proceeds. Each
expression must produce a 16-bit value during the assembly.
Further, the number of significant digits in the result must not
exceed the intended use. If an expression is to be used
in a byte move immediate instruction, the most significant 8 bits
of the expression must be zero. The restriction on the
expression significance is given with the individual
instructions.
.sp 2
.tc 3.3.1 Labels
.sh
3.3.1 Labels
.qs
.pp
As discussed above, a label is an identifier that occurs on a
particular statement. In general, the label is given a value
determined by the type of statement that it precedes. If the
label occurs on a statement that generates machine code or
reserves memory space (for example, a MOV instruction or a
DS pseudo operation), the label is given the value of the program address
that it labels. If the label precedes an EQU or SET, the label
is given the value that results from evaluating the operand
field. Except for the SET statement, an identifier can label
only one statement.
.pp
When a label appears in the operand field, its value is
substituted by the assembler. This value can then be combined
with other operands and operators to form the operand field for a
particular instruction.
.bp
.tc 3.3.2 Numeric Constants
.sh
3.3.2 Numeric Constants
.qs
.pp
A numeric constant is a 16-bit value in one of several bases.
The base, called the radix of the constant, is denoted by a
trailing radix indicator. The following are radix indicators:
.sp
.in 3
.nf
o B is a binary constant (base 2).
o O is a octal constant (base 8).
o Q is a octal constant (base 8).
o D is a decimal constant (base 10).
o H is a hexadecimal constant (base 16).
.fi
.in 0
.pp
Q is an alternate radix indicator for octal numbers because the
letter O is easily confused with the digit 0. Any numeric
constant that does not terminate with a radix indicator is
a decimal constant.
.pp
A constant is composed as a sequence of digits, followed by
an optional radix indicator, where the digits are in the
appropriate range for the radix. Binary constants must
be composed of 0 and 1 digits, octal constants can contain digits
in the range 0-7, while decimal constants contain decimal digits.
Hexadecimal constants contain decimal digits as well as
hexadecimal digits A(10D), B(11D), C(12D), D(13D), E(14D), and
F(15D). Note that the leading digit of a
hexadecimal constant must be a decimal digit to avoid confusing a
hexadecimal constant with an identifier. A leading 0 will always
suffice. A constant composed in this manner must evaluate to a
binary number that can be contained within a 16-bit counter,
otherwise it is truncated on the right by the assembler.
.pp
Similar
to identifiers, embedded $ signs are allowed within constants to
improve their readability. Finally, the radix indicator is
translated to upper-case if a lower-case letter is encountered.
The following are all valid instances of numeric constants:
.sp 2
.nf
.in 8
1234 1234D 1100B 1111$0000$1111$0000B
.sp
1234H OFFEH 3377O 33$77$22Q
.sp
3377o Ofe3h 1234d Offffh
.fi
.in 0
.sp 2
.tc 3.3.3 Reserved Words
.sh
3.3.3 Reserved Words
.qs
.pp
There are several reserved character sequences that have
predefined meanings in the operand field of a statement. The
names of 8080 registers are given below. When they are
encountered, they produce the values shown to the right.
.bp
.nf
.sh
Table 3-1. Reserved Characters
.sp
Character Value
A 7
B 0
C 1
D 2
E 3
H 4
L 5
M 6
SP 6
PSW 6
.fi
.in 0
.sp
.pp
Again, lower-case names have the same values as their upper-case
equivalents. Machine instructions can also be used in the
operand field; they evaluate to their internal codes. In the case
of instructions that require operands, where the specific operand
becomes a part of the binary bit pattern of the instruction,
for example, MOV A,B, the value of the instruction, in this case MOV,
is the bit pattern of the instruction with zeros in the optional
fields, for example, MOV produces 40H.
.pp
When the symbol $ occurs in the operand field, not embedded
within identifiers and numeric constants, its value becomes the
address of the next instruction to generate, not including the
instruction contained within the current logical line.
.sp 2
.tc 3.3.4 String Constants
.sh
3.3.4 String Constants
.qs
.pp
String constants represent sequences of ASCII characters and are
represented by enclosing the characters within apostrophe symbols.
All strings must be fully contained within the current
physical line (thus allowing exclamation point symbols within
strings) and must
not exceed 64 characters in length. The apostrophe character
itself can be included within a string by representing it as a
double apostrophe (the two keystrokes ''), which becomes a single
apostrophe when read by the assembler. In most cases, the string
length is restricted to either one or two characters (the DB
pseudo operation is an exception), in which case the string
becomes an 8- or 16-bit value, respectively. Two-character
strings become a 16-bit constant, with the second character as
the low-order byte, and the first character as the high-order
byte.
.pp
The value of a character is its corresponding ASCII code. There
is no case translation within strings; both upper- and
lower-case characters can be represented. You should note
that only graphic printing ASCII characters are
allowed within strings.
.bp
.nf
Valid strings: How assembler reads strings:
'A' 'AB' 'ab' 'c' A AB ab c
'' 'a''' '''' '''' a' ' '
'Walla Walla Wash.' Walla Walla Wash.
'She said ''Hello'' to me.' She said ''Hello'' to me
'I said ''Hello'' to her.' I said ''Hello'' to her
.fi
.sp 2
.tc 3.3.5 Arithmetic and Logical Operators
.sh
3.3.5 Arithmetic and Logical Operators
.qs
.pp
The operands described in Section 3.3 can be combined in normal algebraic
notation using any combination of properly formed operands,
operators, and parenthesized expressions. The operators
recognized in the operand field are described in Table 3-2.
.sp 2
.ce
.sh
Table 3-2. Arithmetic and Logical Operators
.ll 60
.in 5
.sp
.nf
Operators Meaning
.sp
.fi
.in 19
.ti -13
a + b unsigned arithmetic sum of a and b
.sp
.ti -13
a - b unsigned arithmetic difference between a and b
.sp
.ti -13
+ b unary plus (produces b)
.sp
.ti -13
- b unary minus (identical to 0 - b)
.sp
.ti -13
a * b unsigned magnitude multiplication of a and b
.sp
.ti -13
a / b unsigned magnitude division of a by b
.sp
.ti -13
a MOD b remainder after a / b.
.sp
.ti -13
NOT b logical inverse of b (all 0s become 1s, 1s become
0s), where b is considered a 16-bit value
.sp
.ti -13
a AND b bit-by-bit logical and of a and b
.sp
.ti -13
a OR b bit-by-bit logical or of a and b
.sp
.ti -13
a XOR b bit-by-bit logical exclusive or of a and b
.sp
.ti -13
a SHL b the value that results from shifting a to the left
by an amount b, with zero fill
.sp
.ti -13
a SHR b the value that results from shifting a to the
right by an amount b, with zero fill
.in 0
.ll 65
.sp
.pp
In each case, a and b represent simple operands (labels, numeric
constants, reserved words, and one- or two-character strings) or
fully enclosed parenthesized subexpressions, like those shown in
the following examples:
.sp 2
.nf
.in 8
10+20 10h+37Q LI/3 (L2+4) SHR 3
('a' and 5fh) + '0' ('B'+B) OR (PSW+M)
(1+(2+c)) shr (A-(B+1))
.fi
.in 0
.sp
.pp
Note that all computations are performed at assembly time as 16-bit
unsigned operations. Thus, -1 is computed as 0-1, which
results in the value 0ffffh (that is, all 1s). The resulting
expression must fit the operation code in which it is used. For
example, if the expression is used in an ADI (add immediate)
instruction, the high-order 8 bits of the expression must be
zero. As a result, the operation ADI-1 produces an error message
(-1 becomes 0ffffh, which cannot be represented as an 8-bit
value), while ADI(-1) AND 0FFH is accepted by the assembler
because the AND operation zeros the high-order bits of the
expression.
.sp 2
.tc 3.3.6 Precedence of Operators
.sh
3.3.6 Precedence of Operators
.qs
.pp
As a convenience to the programmer, ASM assumes that operators
have a relative precedence of application that allows the
programmer to write expressions without nested levels of
parentheses. The resulting expression has assumed parentheses
that are defined by the relative precedence. The order of
application of operators in unparenthesized expressions is listed
below. Operators listed first have highest precedence (they are
applied first in an unparenthesized expression), while operators
listed last have lowest precedence. Operators listed on the same
line have equal precedence, and are applied from left to right as
they are encountered in an expression.
.sp 2
.in 8
.mb 5
.fm 1
.nf
* / MOD SHL SHR
- +
NOT
AND
OR XOR
.fi
.in 0
.sp
.pp
Thus, the expressions shown to the left below are interpreted by
the assembler as the fully parenthesized expressions shown to the
right.
.bp
.nf
.in 5
a*b+c (a*b)+c
a+b*c a+(b*c)
a MOD b*c SHL d ((a MOD b)*c) SHL d
a OR b AND NOT c+d SHL e a OR (b AND (NOT (c+(d SHL e))))
.fi
.in 0
.sp
.pp
Balanced, parenthesized subexpressions can always be used to
override the assumed parentheses; thus, the last expression above
could be rewritten to force application of operators in a
different order, as shown:
.sp
.ti 8
(a OR b) AND (NOT c)+ d SHL e
.sp
This results in these assumed parentheses:
.sp
.ti 8
(a OR b) AND ((NOT c) + (d SHL e))
.pp
An unparenthesized expression is well-formed only if the
expression that results from inserting the assumed parentheses is
well-formed.
.sp 2
.tc 3.4 Assembler Directives
.he CP/M Operating System Guide 3.4 Assembler Directives
.sh
3.4 Assembler Directives
.qs
.pp
Assembler directives are used to set labels to specific values
during the assembly, perform conditional assembly, define storage
areas, and specify starting addresses in the program. Each
assembler directive is denoted by a pseudo operation that appears
in the operation field of the line. The acceptable pseudo operations
are shown in Table 3-3.
.sp 2
.nf
.sh
Table 3-3. Assembler Directives
.sp
Directive Meaning
.fi
.sp
ORG set the program or data origin
.sp
END end program, optional start address
.sp
EQU numeric equate
.sp
SET numeric set
.sp
IF begin conditional assembly
.sp
ENDIF end of conditional assembly
.sp
DB define data bytes
.sp
DW define data words
.sp
DS define data storage area
.in 0
.bp
.tc 3.4.1 The ORG Directive
.sh
3.4.1 The ORG Directive
.qs
.pp
The ORG statement takes the form:
.sp
.ti 8
label ORG expression
.sp
where label is an optional program identifier and expression is
a 16-bit expression, consisting of operands that are defined
before the ORG statement. The assembler begins machine code
generation at the location specified in the expression. There
can be any number of ORG statements within a particular program,
and there are no checks to ensure that the programmer is not
defining overlapping memory areas. Note that
most programs written for the CP/M system begin with an ORG
statement of the form:
.sp
.ti 8
ORG 100H
.sp
which causes machine code generation to begin at the base of the
CP/M transient program area. If a label is specified in the ORG
statement, the label is given the value of the expression. This
label can then be used in the operand field of other statements
to represent this expression.
.sp 2
.tc 3.4.2 The END Directive
.sh
3.4.2 The END Directive
.qs
.pp
The END statement is optional in an assembly-language program,
but if it is present it must be the last statement. All
subsequent statements are ignored in the assembly. The END
statement takes the following two forms:
.sp
.in 8
.nf
label END
label END expression
.fi
.in 0
.sp
where the label is again optional. If the first form is used,
the assembly process stops, and the default starting address of
the program is taken as 0000. Otherwise, the expression is
evaluated, and becomes the program starting address. This
starting address is included in the last record of the Intel-formatted
machine code hex file that results from the
assembly. Thus, most CP/M assembly-language programs end with
the statement:
.sp
.ti 8
END 100H
.sp
resulting in the default starting address of 100H (beginning of
the transient program area).
.bp
.tc 3.4.3 The EQU Directive
.sh
3.4.3 The EQU Directive
.qs
.pp
The EQU (equate) statement is used to set up synonyms for
particular numeric values. The EQU statement takes the form:
.sp
.ti 8
.nf
label EQU expression
.fi
.sp
where the label must be present and must not label any other
statement. The assembler evaluates the expression and assigns
this value to the identifier given in the label field. The
identifier is usually a name that describes the value in a more
human-oriented manner. Further, this name is used throughout the
program to place parameters on certain functions. Suppose data
received from a teletype appears on a particular input port, and
data is sent to the teletype through the next output port in
sequence. For example, you can use this series of equate statements
to define these ports for a particular hardware environment:
.sp 2
.in 8
.nf
TTYBASE EQU 10H ;BASE PORT NUMBER FOR TTY
TTYIN EQU TTYBASE ;TTY DATA IN
TTYOUT EQU TTYBASE+1 ;TTY DATA OUT
.fi
.in 0
.sp
.pp
At a later point in the program, the statements that access the
teletype can appear as follows:
.sp 2
.in 7
.nf
IN TTYIN ;READ TTY DATA TO REG-A
...
OUT TTYOUT ;WRITE DATA TO TTY FROM REG-A
.fi
.in 0
.sp 2
making the program more readable than if the absolute I/O ports
are used. Further, if the hardware environment is redefined
to start the teletype communications ports at 7FH instead of 10H,
the first statement need only be changed to
.sp
.ti 8
.nf
TTYBASE EQU 7FH ;BASE PORT NUMBER FOR TTY
.fi
.sp
and the program can be reassembled without changing any other
statements.
.sp 2
.tc 3.4.4 The SET Directive
.sh
3.4.4 The SET Directive
.qs
.pp
The SET statement is similar to the EQU, taking the form:
.sp
.ti 8
label SET expression
.sp
except that the label can occur on other SET statements within
the program. The expression is evaluated and becomes the current
value associated with the label. Thus, the EQU statement defines
a label with a single value, while the SET statement defines a
value that is valid from the current SET statement to the point
where the label occurs on the next SET statement. The use of the
SET is similar to the EQU statement, but is used most often in
controlling conditional assembly.
.sp 2
.tc 3.4.5 The IF and ENDIF Directives
.sh
3.4.5 The IF and ENDIF Directives
.qs
.pp
The IF and ENDIF statements define a range of assembly-language
statements that are to be included or excluded during the
assembly process. These statements take on the form:
.sp 2
.in 8
.nf
IF expression
statement#1
statement#2
...
statement#n
ENDIF
.fi
.in 0
.sp
.pp
When encountering the IF statement, the assembler evaluates the
expression following the IF. All operands in the expression must
be defined ahead of the IF statement. If the expression
evaluates to a nonzero value, then statement#1 through
statement#n are assembled. If the expression evaluates to zero,
the statements are listed but not assembled. Conditional
assembly is often used to write a single generic program that
includes a number of possible run-time environments, with only a
few specific portions of the program selected for any particular
assembly. The following program segments, for example, might be
part of a program that communicates with either a teletype or a
CRT console (but not both) by selecting a particular value for
TTY before the assembly begins.
.bp
.nf
.in 8
TRUE EQU OFFFFH ;DEFINE VALUE OF TRUE
FALSE EQU NOT TRUE ;DEFINE VALUE OF FALSE
;
TTY EQU TRUE ;TRUE IF TTY, FALSE IF CRT
;
TTYBASE EQU 10H ;BASE OF TTY I/O PORTS
CRTBASE EQU 20H ;BASE OF CRT I/O PORTS
IF TTY ;ASSEMBLE RELATIVE TO
;TTYBASE
CONIN EQU TTYBASE ;CONSOLE INPUT
CONOUT EQU TTYBASE+1 ;CONSOLE OUTPUT
ENDIF
; IF NOT TTY ;ASSEMBLE RELATIVE TO
;CRTBASE
CONIN EQU CRTBASE ;CONSOLE INPUT
CONOUT EQU CRTBASE+1 ;CONSOLE OUTPUT
ENDIF
...
IN CONIN ;READ CONSOLE DATA
...
OUT CONTOUT ;WRITE CONSOLE DATA
.fi
.in 0
.sp 2
In this case, the program assembles for an environment where
a teletype is connected, based at port 10H. The statement
defining TTY can be changed to
.sp
.nf
.ti 8
TTY EQU FALSE
.fi
.sp
and, in this case, the program assembles for a CRT based at
port 20H.
.sp 2
.tc 3.4.6 The DB Directive
.sh
3.4.6 The DB Directive
.qs
.pp
The DB directive allows the programmer to define initialized
storage areas in single-precision byte format. The DB statement
takes the form:
.sp
.nf
.ti 8
label DB e#1, e#2, ..., e#n
.fi
.sp
where e#1 through e#n are either expressions that evaluate to 8-bit
values (the high-order bit must be zero) or are ASCII strings
of length no greater than 64 characters. There is no practical
restriction on the number of expressions included on a single
source line. The expressions are evaluated and placed
sequentially into the machine code file following the last
program address generated by the assembler. String characters
are similarly placed into memory starting with the first
character and ending with the last character. Strings of length
greater than two characters cannot be used as operands in more
complicated expressions.
.bp
.sh
Note: \c
.qs
ASCII
characters are always placed in memory with the parity bit reset
(0). Also, there is no translation from lower- to upper-case
within strings. The optional label can be used to reference the
data area throughout the remainder of the program. The following
are examples of valid DB statements:
.sp 2
.nf
.in 8
data: DB 0,1,2,3,4,5
DB data and 0ffh,5,377Q,1+2+3+4
sign-on: DB 'please type your name',cr,lf,0
DB 'AB' SHR 8, 'C', 'DE' AND 7FH
.fi
.in 0
.sp 3
.tc 3.4.7 The DW Directive
.sh
3.4.7 The DW Directive
.qs
.pp
The DW statement is similar to the DB statement except double-precision
two-byte words of storage are initialized. The DW statement
takes the form:
.sp
.nf
.ti 8
label DW e#1, e#2, ..., e#n
.fi
.sp
where e#1 through e#n are expressions that evaluate to 16-bit
results. Note that ASCII strings of one or two
characters are allowed, but strings longer than two characters
are disallowed. In all cases, the data storage is consistent
with the 8080 processor; the least significant byte of the
expression is stored first in memory, followed by the most
significant byte. The following are examples of DW statements:
.sp 2
.in 8
.nf
doub: DW 0ffefh,doub+4,signon-$,255+255
DW 'a', 5, 'ab', 'CD', 6 shl 8 or llb.
.fi
.in 0
.sp 3
.tc 3.4.8 The DS Directive
.sh
3.4.8 The DS Directive
.qs
.pp
The DS statement is used to reserve an area of uninitialized
memory, and takes the form:
.sp
.ti 8
.nf
label DS expression
.fi
.sp
where the label is optional. The assembler begins subsequent
code generation after the area reserved by the DS. Thus, the DS
statement given above has exactly the same effect as the following
statement:
.sp
.nf
.in 7
label: EQU $ ;LABEL VALUE IS CURRENT CODE LOCATION
ORG $+expression ;MOVE PAST RESERVED AREA
.fi
.in 0
.nx threeb


Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save