diff --git a/Binary/ReadMe.txt b/Binary/ReadMe.txt new file mode 100644 index 00000000..784fe687 --- /dev/null +++ b/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 (_.rom) +------------------------------------- + +The files with a ".rom" extension are binary images ready to program +into an appropriate PROM. These files are named with the format +_.rom. refers to the primary platform such as Zeta, +N8, Mark IV, etc. 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 (_.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 (_.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. diff --git a/Binary/RomList.txt b/Binary/RomList.txt index 0d127476..ea8247fe 100644 --- a/Binary/RomList.txt +++ b/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. diff --git a/Doc/Build.txt b/Doc/Build.txt deleted file mode 100644 index 42023602..00000000 --- a/Doc/Build.txt +++ /dev/null @@ -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: - - .rom - binary ROM image to burn to EEPROM - .com - executable version of the system image that can be - copied via xmodem to a running system to test - the build. - .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> \ No newline at end of file diff --git a/Doc/CPM 22 Manual.pdf b/Doc/CPM 22 Manual.pdf deleted file mode 100644 index b694e34b..00000000 Binary files a/Doc/CPM 22 Manual.pdf and /dev/null differ diff --git a/Doc/CPM Manual.pdf b/Doc/CPM Manual.pdf new file mode 100644 index 00000000..48348eab Binary files /dev/null and b/Doc/CPM Manual.pdf differ diff --git a/Doc/Contrib/ZSystem.txt b/Doc/Contrib/ZSystem.txt index 9ccf3d0e..9e9f4b2d 100644 --- a/Doc/Contrib/ZSystem.txt +++ b/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. diff --git a/Doc/FDisk Manual.pdf b/Doc/FDisk Manual.pdf new file mode 100644 index 00000000..88383679 Binary files /dev/null and b/Doc/FDisk Manual.pdf differ diff --git a/Doc/ReadMe.txt b/Doc/ReadMe.txt new file mode 100644 index 00000000..3172dd2c --- /dev/null +++ b/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. \ No newline at end of file diff --git a/Doc/RomWBW System Guide.pdf b/Doc/RomWBW System Guide.pdf index ec8cb448..c24da628 100644 Binary files a/Doc/RomWBW System Guide.pdf and b/Doc/RomWBW System Guide.pdf differ diff --git a/Doc/RomWBW User Guide.pdf b/Doc/RomWBW User Guide.pdf index 5bd5b7b3..092cff10 100644 Binary files a/Doc/RomWBW User Guide.pdf and b/Doc/RomWBW User Guide.pdf differ diff --git a/Doc/ZCPR Manual.pdf b/Doc/ZCPR Manual.pdf index 6ab73d88..a094629b 100644 Binary files a/Doc/ZCPR Manual.pdf and b/Doc/ZCPR Manual.pdf differ diff --git a/GPL-3.0.txt b/GPL-3.0.txt new file mode 100644 index 00000000..818433ec --- /dev/null +++ b/GPL-3.0.txt @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + 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. + + + Copyright (C) + + 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 . + +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: + + Copyright (C) + 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 +. + + 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 +. diff --git a/ReadMe.txt b/ReadMe.txt index 27a50270..7d3c4e22 100644 --- a/ReadMe.txt +++ b/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. - +The UNA BIOS is a product of John Coffman. -Creating Bootable Media ------------------------ +License +------- - +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: - +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 . + +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/". - +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. \ No newline at end of file + - Formatting Media + - Making a Disk Bootable + - Assigning disks/slices to drives + - Managing the Console diff --git a/Source/BPBIOS/@WBW BPBIOS Errata.rtf b/Source/BPBIOS/@WBW BPBIOS Errata.rtf index 7722d9b5..8c109aba 100644 Binary files a/Source/BPBIOS/@WBW BPBIOS Errata.rtf and b/Source/BPBIOS/@WBW BPBIOS Errata.rtf differ diff --git a/Source/BPBIOS/Build.cmd b/Source/BPBIOS/Build.cmd index f6d2999f..db50c0d7 100644 --- a/Source/BPBIOS/Build.cmd +++ b/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 bpsys.img +zx bpbuild -bpsys.tmp bpsys.img +zx bpbuild -bpsys.tmp -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: -* 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. -  - C -l.25 \VerbatimInput{part1.txt} - -? -! Emergency stop. -  - 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! diff --git a/Source/Doc/CPM 22 Manual - Testing/Main.ltx b/Source/Doc/CPM 22 Manual - Testing/Main.ltx deleted file mode 100644 index 3e2a81ef..00000000 --- a/Source/Doc/CPM 22 Manual - Testing/Main.ltx +++ /dev/null @@ -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} \ No newline at end of file diff --git a/Source/Doc/CPM 22 Manual - Testing/Main.pdf b/Source/Doc/CPM 22 Manual - Testing/Main.pdf deleted file mode 100644 index 59214bd4..00000000 Binary files a/Source/Doc/CPM 22 Manual - Testing/Main.pdf and /dev/null differ diff --git a/Source/Doc/CPM 22 Manual - Testing/Strip.ps1 b/Source/Doc/CPM 22 Manual - Testing/Strip.ps1 deleted file mode 100644 index 9e92c2bc..00000000 --- a/Source/Doc/CPM 22 Manual - Testing/Strip.ps1 +++ /dev/null @@ -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 diff --git a/Source/Doc/CPM 22 Manual - Testing/appa.tex b/Source/Doc/CPM 22 Manual - Testing/appa.tex deleted file mode 100644 index e6542646..00000000 --- a/Source/Doc/CPM 22 Manual - Testing/appa.tex +++ /dev/null @@ -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 - - \ No newline at end of file diff --git a/Source/Doc/CPM 22 Manual - Testing/appb.tex b/Source/Doc/CPM 22 Manual - Testing/appb.tex deleted file mode 100644 index f8105690..00000000 --- a/Source/Doc/CPM 22 Manual - Testing/appb.tex +++ /dev/null @@ -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 - \ No newline at end of file diff --git a/Source/Doc/CPM 22 Manual - Testing/appc.tex b/Source/Doc/CPM 22 Manual - Testing/appc.tex deleted file mode 100644 index b45311ad..00000000 --- a/Source/Doc/CPM 22 Manual - Testing/appc.tex +++ /dev/null @@ -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 ;= + 128 -0211 0c inr 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 , - ;sector in - ;dmaaddr in - -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 - \ No newline at end of file diff --git a/Source/Doc/CPM 22 Manual - Testing/appd.tex b/Source/Doc/CPM 22 Manual - Testing/appd.tex deleted file mode 100644 index 30424b39..00000000 --- a/Source/Doc/CPM 22 Manual - Testing/appd.tex +++ /dev/null @@ -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 - \ No newline at end of file diff --git a/Source/Doc/CPM 22 Manual - Testing/appe.tex b/Source/Doc/CPM 22 Manual - Testing/appe.tex deleted file mode 100644 index 36a53fbc..00000000 --- a/Source/Doc/CPM 22 Manual - Testing/appe.tex +++ /dev/null @@ -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 - ;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 as scratch - ;register - ; to hold the load address increment - -006f 318000 lxi sp,128 ;128 bytes per - ;sector -0072 39 dad sp ; = + - 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 - \ No newline at end of file diff --git a/Source/Doc/CPM 22 Manual - Testing/appf.tex b/Source/Doc/CPM 22 Manual - Testing/appf.tex deleted file mode 100644 index f34da4f2..00000000 --- a/Source/Doc/CPM 22 Manual - Testing/appf.tex +++ /dev/null @@ -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, -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 - - \ No newline at end of file diff --git a/Source/Doc/CPM 22 Manual - Testing/appg.tex b/Source/Doc/CPM 22 Manual - Testing/appg.tex deleted file mode 100644 index 6848b31f..00000000 --- a/Source/Doc/CPM 22 Manual - Testing/appg.tex +++ /dev/null @@ -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 - \ No newline at end of file diff --git a/Source/Doc/CPM 22 Manual - Testing/apph.tex b/Source/Doc/CPM 22 Manual - Testing/apph.tex deleted file mode 100644 index 90d673d2..00000000 --- a/Source/Doc/CPM 22 Manual - Testing/apph.tex +++ /dev/null @@ -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 - \ No newline at end of file diff --git a/Source/Doc/CPM 22 Manual - Testing/apph2.tex b/Source/Doc/CPM 22 Manual - Testing/apph2.tex deleted file mode 100644 index 89387031..00000000 --- a/Source/Doc/CPM 22 Manual - Testing/apph2.tex +++ /dev/null @@ -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 = -.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 - \ No newline at end of file diff --git a/Source/Doc/CPM 22 Manual - Testing/appi.tex b/Source/Doc/CPM 22 Manual - Testing/appi.tex deleted file mode 100644 index 705ec65f..00000000 --- a/Source/Doc/CPM 22 Manual - Testing/appi.tex +++ /dev/null @@ -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, 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 - \ No newline at end of file diff --git a/Source/Doc/CPM 22 Manual - Testing/cpm22tex.zip b/Source/Doc/CPM 22 Manual - Testing/cpm22tex.zip deleted file mode 100644 index 6248e534..00000000 Binary files a/Source/Doc/CPM 22 Manual - Testing/cpm22tex.zip and /dev/null differ diff --git a/Source/Doc/CPM 22 Manual - Testing/fivea.tex b/Source/Doc/CPM 22 Manual - Testing/fivea.tex deleted file mode 100644 index 177e63d3..00000000 --- a/Source/Doc/CPM 22 Manual - Testing/fivea.tex +++ /dev/null @@ -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 - 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 - - - - \ No newline at end of file diff --git a/Source/Doc/CPM 22 Manual - Testing/fiveb.tex b/Source/Doc/CPM 22 Manual - Testing/fiveb.tex deleted file mode 100644 index ad1ec089..00000000 --- a/Source/Doc/CPM 22 Manual - Testing/fiveb.tex +++ /dev/null @@ -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 - \ No newline at end of file diff --git a/Source/Doc/CPM 22 Manual - Testing/fivec.tex b/Source/Doc/CPM 22 Manual - Testing/fivec.tex deleted file mode 100644 index e0cfc002..00000000 --- a/Source/Doc/CPM 22 Manual - Testing/fivec.tex +++ /dev/null @@ -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 - \ No newline at end of file diff --git a/Source/Doc/CPM 22 Manual - Testing/fived.tex b/Source/Doc/CPM 22 Manual - Testing/fived.tex deleted file mode 100644 index 49bf9f2b..00000000 --- a/Source/Doc/CPM 22 Manual - Testing/fived.tex +++ /dev/null @@ -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 - \ No newline at end of file diff --git a/Source/Doc/CPM 22 Manual - Testing/foura.tex b/Source/Doc/CPM 22 Manual - Testing/foura.tex deleted file mode 100644 index 9f90f979..00000000 --- a/Source/Doc/CPM 22 Manual - Testing/foura.tex +++ /dev/null @@ -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 - - - - \ No newline at end of file diff --git a/Source/Doc/CPM 22 Manual - Testing/fourb.tex b/Source/Doc/CPM 22 Manual - Testing/fourb.tex deleted file mode 100644 index 84f1ac1f..00000000 --- a/Source/Doc/CPM 22 Manual - Testing/fourb.tex +++ /dev/null @@ -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 - \ No newline at end of file diff --git a/Source/Doc/CPM 22 Manual - Testing/front.tex b/Source/Doc/CPM 22 Manual - Testing/front.tex deleted file mode 100644 index d65aa953..00000000 --- a/Source/Doc/CPM 22 Manual - Testing/front.tex +++ /dev/null @@ -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 - \ No newline at end of file diff --git a/Source/Doc/CPM 22 Manual - Testing/index.tex b/Source/Doc/CPM 22 Manual - Testing/index.tex deleted file mode 100644 index e7f353ec..00000000 --- a/Source/Doc/CPM 22 Manual - Testing/index.tex +++ /dev/null @@ -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 - - - \ No newline at end of file diff --git a/Source/Doc/CPM 22 Manual - Testing/onea.tex b/Source/Doc/CPM 22 Manual - Testing/onea.tex deleted file mode 100644 index 46279240..00000000 --- a/Source/Doc/CPM 22 Manual - Testing/onea.tex +++ /dev/null @@ -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 - - - \ No newline at end of file diff --git a/Source/Doc/CPM 22 Manual - Testing/oneb.tex b/Source/Doc/CPM 22 Manual - Testing/oneb.tex deleted file mode 100644 index 67ae6beb..00000000 --- a/Source/Doc/CPM 22 Manual - Testing/oneb.tex +++ /dev/null @@ -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 - \ No newline at end of file diff --git a/Source/Doc/CPM 22 Manual - Testing/onec.tex b/Source/Doc/CPM 22 Manual - Testing/onec.tex deleted file mode 100644 index 6ab06cf0..00000000 --- a/Source/Doc/CPM 22 Manual - Testing/onec.tex +++ /dev/null @@ -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 -.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 - \ No newline at end of file diff --git a/Source/Doc/CPM 22 Manual - Testing/part1.ix b/Source/Doc/CPM 22 Manual - Testing/part1.ix deleted file mode 100644 index 7277eb87..00000000 Binary files a/Source/Doc/CPM 22 Manual - Testing/part1.ix and /dev/null differ diff --git a/Source/Doc/CPM 22 Manual - Testing/part1.prn b/Source/Doc/CPM 22 Manual - Testing/part1.prn deleted file mode 100644 index cf2c5c9b..00000000 --- a/Source/Doc/CPM 22 Manual - Testing/part1.prn +++ /dev/null @@ -1,13267 +0,0 @@ -XS 9 N0 - - - - - - - - - - - - - - - - - - - - -=WCP/M - -=&SWOperating System - -=&SWManual - - - - - - - - - - -=&SCopyright (c) 1982 - -=Digital Research -=P.O. Box 579 -=160 Central Avenue -=Pacific Grove, CA 93950 -=(408) 649-3896 -=TWX 910 360 5001 - - - - -=All Rights Reserved - - - - - - - - - - - - - - - - - - 9 C0 - - - - - -=COPYRIGHT - -MCopyright (c) 1976, 1977, 1978, 1979, 1982, 1983, -XMand 1984 by Digital Research Inc. All rights -XMreserved. No part of this publication may be -XMreproduced, transmitted, transcribed, stored in a -XMretrieval system, or translated into any language or -XMcomputer language, in any form or by any means, -XMelectronic, mechanical, magnetic, optical, chemical, -XMmanual or otherwise, without the prior written -XMpermission of Digital Research Inc., Post Office Box -X579, Pacific Grove, California, 93950. - -MThus, readers are granted permission to include the -XMexample programs, either in whole or in part, in -Xtheir own programs. - - -=DISCLAIMER - -MDigital Research Inc. makes no representations or -XMwarranties with respect to the contents hereof and -XMspecifically disclaims any implied warranties of -XMmerchantability or fitness for any particular -XMpurpose. Further, Digital Research Inc. reserves -XMthe right to revise this publication and to make -XMchanges from time to time in the content hereof -XMwithout obligation of Digital Research Inc. to -Xnotify any person of such revision or changes. - - -=TRADEMARKS - -MCP/M, CP/NET, and Digital Research and its logo are -XMregistered trademarks of Digital Research. ASM, -XMDESPOOL, DDT, LINK-80, MAC, MP/M, PL/I-80 and SID -XMare trademarks of Digital Research. IBM is a -XMregistered trademark of International Business -XMMachines. Intel is a registered trademark of Intel -XMCorporation. TI Silent 700 is a trademark of Texas -XMInstruments Incorporated. Zilog and Z80 are -Xregistered trademarks of Zilog, Inc. - - - -MThe ECP/M Operating System ManualR was prepared using -XMthe Digital Research TEX Text Formatter and printed -Xin the United States of America. - - -=********************************* -=* First Edition: 1976 * -=* Second Edition: July 1982 * -=* Third Edition: March 1983 * -=* Fourth Edition: March 1984 * -=********************************* - - - - - 9 K0 - - - - -=WTable of Contents - - - -&SW1 CP/M Features and Facilities - -&S 1.1 Introduction . . . . . . . . . . . . . . . . . . . 1-1 - - 1.2 Functional Description . . . . . . . . . . . . . . 1-3 - - 1.2.1 General Command Structure . . . . . . . . . 1-3 - 1.2.2 File References . . . . . . . . . . . . . . 1-3 - - 1.3 Switching Disks . . . . . . . . . . . . . . . . . . 1-5 - 1.4 Built-in Commands . . . . . . . . . . . . . . . . . 1-6 - - 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 - - 1.5 Line Editing and Output Control . . . . . . . . . . 1-10 - - 1.6 Transient Commands . . . . . . . . . . . . . . . . 1-11 - - 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 - - 1.7 BDOS Error Messages . . . . . . . . . . . . . . . . 1-37 - - 1.8 CP/M Operation on the Model 800 . . . . . . . . . . 1-38 - - -W2 The CP/M Editor - -&S 2.1 Introduction to ED . . . . . . . . . . . . . . . . 2-1 - - 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 - - - iii - - - - - - - - -=WTable of Contents - -=&SW(continued) - - - -&S 2.2 ED Error Conditions . . . . . . . . . . . . . . . . 2-14 - - 2.3 Control Characters and Commands . . . . . . . . . . 2-16 - - -W3 CP/M Assembler - -&S 3.1 Introduction . . . . . . . . . . . . . . . . . . . 3-1 - - 3.2 Program Format . . . . . . . . . . . . . . . . . . 3-3 - - 3.3 Forming the Operand . . . . . . . . . . . . . . . . 3-4 - - 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 - - 3.4 Assembler Directives . . . . . . . . . . . . . . . 3-9 - - 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 - - 3.5 Operation Codes . . . . . . . . . . . . . . . . . . 3-15 - - 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 - - 3.6 Error Messages . . . . . . . . . . . . . . . . . . 3-21 - - 3.7 A Sample Session . . . . . . . . . . . . . . . . . 3-23 - - - - - - - - - iv - - - - - - - - -=WTable of Contents - -=&SW(continued) - - - -&SW4 CP/M Dynamic Debugging Tool - -&S 4.1 Introduction . . . . . . . . . . . . . . . . . . . 4-1 - - 4.2 DDT Commands . . . . . . . . . . . . . . . . . . . 4-3 - - 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 - - 4.3 Implementation Notes . . . . . . . . . . . . . . . 4-10 - - 4.4 A Sample Program . . . . . . . . . . . . . . . . . 4-11 - - -W5 CP/M 2 System Interface - -&S 5.1 Introduction . . . . . . . . . . . . . . . . . . . 5-1 - - 5.2 Operating System Call Conventions . . . . . . . . . 5-3 - - 5.3 A Sample File-to-File Copy Program . . . . . . . . 5-35 - - 5.4 A Sample File Dump Utility . . . . . . . . . . . . 5-38 - - 5.5 A Sample Random Access Program . . . . . . . . . . 5-42 - - 5.6 System Function Summary . . . . . . . . . . . . . . 5-50 - - -W6 CP/M 2 Alteration - -&S 6.1 Introduction . . . . . . . . . . . . . . . . . . . 6-1 - - 6.2 First-level System Regeneration . . . . . . . . . . 6-2 - - 6.3 Second-level System Generation . . . . . . . . . . 6-5 - - 6.4 Sample GETSYS and PUTSYS Programs . . . . . . . . . 6-9 - - - - v - - - - - - - - -=WTable of Contents - -=&SW(continued) - - - -&S 6.5 Disk Organization . . . . . . . . . . . . . . . . . 6-11 - - 6.6 The BIOS Entry Points . . . . . . . . . . . . . . . 6-13 - - 6.7 A Sample BIOS . . . . . . . . . . . . . . . . . . . 6-21 - - 6.8 A Sample Cold Start Loader . . . . . . . . . . . . 6-21 - - 6.9 Reserved Locations in Page Zero . . . . . . . . . . 6-22 - - 6.10 Disk Parameter Tables . . . . . . . . . . . . . . 6-23 - - 6.11 The DISKDEF Macro Library . . . . . . . . . . . . 6-28 - - 6.12 Sector Blocking and Deblocking . . . . . . . . . . 6-32 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - vi - - - - - - - - -=WAppendixes - - - -&SWA &SBasic Input/Output System (BIOS) . . . . . . . . . . . A-1 - - -WB &SA Skeletal CBIOS . . . . . . . . . . . . . . . . . . . B-1 - - -WC &SA Skeletal GETSYS/PUTSYS Program . . . . . . . . . . . C-1 - - -WD &SThe Model 800 Cold Start Loader for CP/M 2 . . . . . . D-1 - - -WE &SA Skeletal Cold Start Loader . . . . . . . . . . . . . E-1 - - -WF &SCP/M Disk Definition Library . . . . . . . . . . . . . F-1 - - -WG &SBlocking and Deblocking Algorithms . . . . . . . . . . G-1 - - -WH &SGlossary . . . . . . . . . . . . . . . . . . . . . . . H-1 - - -WI &SCP/M Error Messages . . . . . . . . . . . . . . . . . . I-1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - vii - - - - - - - - -=WTables, Figures, and Listings - - - -&SWTables - -&S 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 - - 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 - - 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 - - 4-1. Line-editing Controls . . . . . . . . . . . . . 4-2 - 4-2. DDT Commands . . . . . . . . . . . . . . . . . 4-2 - 4-3. CPU Registers . . . . . . . . . . . . . . . . . 4-9 - - 5-1. CP/M Filetypes . . . . . . . . . . . . . . . . 5-6 - 5-2. File Control Block Fields . . . . . . . . . . . 5-7 - 5-3. Edit Control Characters . . . . . . . . . . . . 5-20 - - 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 - - I-1. CP/M Error Messages . . . . . . . . . . . . . . I-1 - - -WFigures - -&S 2-1. Overall ED Operation . . . . . . . . . . . . . 2-2 - 2-2. Memory Buffer Organization . . . . . . . . . . 2-2 - - - viii - - - - - - - - -=WTables, Figures, and Listings - -=&SW(continued) - - - -&SWFigures - -&S 2-3. Logical Organization of Memory Buffer . . . . . 2-4 - - 5-1. CP/M Memory Organization . . . . . . . . . . . 5-1 - 5-2. File Control Block Format . . . . . . . . . . . 5-7 - - 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 - - -WListings - -&S 6-1. GETSYS Program . . . . . . . . . . . . . . . . 6-9 - 6-2. BIOS Entry Points . . . . . . . . . . . . . . . 6-13 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ix - - - - - - - - -=WSection 1 - -=&SWCP/M Features and Facilities - - - -&SW1.1 Introduction - - M&SCP/M is a monitor control program for microcomputer system -XMdevelopment that uses floppy disks or Winchester hard disks for -XMbackup storage. Using a computer system based on the Intel 8080 -XMmicrocomputer, CP/M provides an environment for program -XMconstruction, storage, and editing, along with assembly and program -XMcheck-out facilities. CP/M can be easily altered to execute with -XMany computer configuration that uses a Zilog Z80 or an Intel 8080 -XMCentral Processing Unit (CPU) and has at least 20K bytes of main -XMmemory with up to 16 disk drives. A detailed discussion of the -XMmodifications required for any particular hardware environment is -XMgiven in Section 6. Although the standard Digital Research version -XMoperates on a single-density Intel Model 800, microcomputer -XMdevelopment system several different hardware manufacturers support -Xtheir own input-output (I/O) drivers for CP/M. - - MThe CP/M monitor provides rapid access to programs through a -XMcomprehensive file management package. The file subsystem supports -XMa named file structure, allowing dynamic allocation of file space as -XMwell as sequential and random file access. Using this file system, -XMa large number of programs can be stored in both source and machine- -Xexecutable form. - - MCP/M 2 is a high-performance, single console operating system -XMthat uses table-driven techniques to allow field reconfiguration to -XMmatch a wide variety of disk capacities. All fundamental file -XMrestrictions are removed, maintaining upward compatibility from -Xprevious versions of release 1. - - MFeatures of CP/M 2 include field specification of one to -XMsixteen logical drives, each containing up to eight megabytes. Any -XMparticular file can reach the full drive size with the capability of -XMexpanding to thirty-two megabytes in future releases. The directory -XMsize can be field-configured to contain any reasonable number of -XMentries, and each file is optionally tagged with Read-Only and -XMsystem attributes. Users of CP/M 2 are physically separated by user -XMnumbers, with facilities for file copy operations from one user area -XMto another. Powerful relative-record random access functions are -XMpresent in CP/M 2 that provide direct access to any of the 65536 -Xrecords of an eight-megabyte file. - - MCP/M also supports ED, a powerful context editor, ASM , an -XMIntel-compatible assembler, and DDT , debugger subsystems. Optional -XMsoftware includes a powerful Intel-compatible macro assembler, -XMsymbolic debugger, along with various high-level languages. When -XMcoupled with CP/M's Console Command Processor (CCP), the resulting -Xfacilities equal or exceed similar large computer facilities. - - - - 1-1 - - - - - -CP/M Operating System Manual 1.1 Introduction - - - CP/M is logically divided into several distinct parts: - - o BIOS (Basic I/O System), hardware-dependent - o BDOS (Basic Disk Operating System) - o CCP (Console Command Processor) - o TPA (Transient Program Area) - - MThe BIOS provides the primitive operations necessary to access -XMthe disk drives and to interface standard peripherals: teletype, -XMCRT, paper tape reader/punch, and user-defined peripherals. You can -XMtailor peripherals for any particular hardware environment by -XMpatching this portion of CP/M. The BDOS provides disk management by -XMcontrolling one or more disk drives containing independent file -XMdirectories. The BDOS implements disk allocation strategies that -XMprovide fully dynamic file construction while minimizing head -XMmovement across the disk during access. The BDOS has entry points -XMthat include the following primitive operations, which the program -Xaccesses: - - o SEARCH looks for a particular disk file by name. - o OPEN opens a file for further operations. - o CLOSE closes a file after processing. - o RENAME changes the name of a particular file. - o READ reads a record from a particular file. - o WRITE writes a record to a particular file. - o MSELECT selects a particular disk drive for further operations. -X - MThe CCP provides a symbolic interface between your console and -XMthe remainder of the CP/M system. The CCP reads the console device -XMand processes commands, which include listing the file directory, -XMprinting the contents of files, and controlling the operation of -XMtransient programs, such as assemblers, editors, and debuggers. The -XMstandard commands that are available in the CCP are listed in -XSection 1.2.1. - - MThe last segment of CP/M is the area called the Transient -XMProgram Area (TPA). The TPA holds programs that are loaded from the -XMdisk under command of the CCP. During program editing, for example, -XMthe TPA holds the CP/M text editor machine code and data areas. -XMSimilarly, programs created under CP/M can be checked out by loading -Xand executing these programs in the TPA. - - MAny or all of the CP/M component subsystems can be overlaid by -XMan executing program. That is, once a user's program is loaded into -XMthe TPA, the CCP, BDOS, and BIOS areas can be used as the program's -XMdata area. A bootstrap loader is programmatically accessible -XMwhenever the BIOS portion is not overlaid; thus, the user program -XMneed only branch to the bootstrap loader at the end of execution and -Xthe complete CP/M monitor is reloaded from disk. - - MThe CP/M operating system is partitioned into distinct modules, -XMincluding the BIOS portion that defines the hardware environment in -XMwhich CP/M is executing. Thus, the standard system is easily -XMmodified to any nonstandard environment by changing the peripheral -Xdrivers to handle the custom system. - - - 1-2 - - - - - -CP/M Operating System Manual 1.2 Functional Description - - -W1.2 Functional Description - - MY&Sou interact with CP/M primarily through the CCP, which reads -XMand interprets commands entered through the console. In general, -XMthe CCP addresses one of several disks that are on-line. The -XMstandard system addresses up to sixteen different disk drives. -XMThese disk drives are labeled A through P. A disk is logged-in if -XMthe CCP is currently addressing the disk. To clearly indicate which -XMdisk is the currently logged disk, the CCP always prompts the -XMoperator with the disk name followed by the symbol >, indicating -XMthat the CCP is ready for another command. Upon initial start-up, -XMthe CP/M system is loaded from disk A, and the CCP displays the -Xfollowing message: - - CP/M VER x.x - -Mwhere x.x is the CP/M version number. All CP/M systems are -XMinitially set to operate in a 20K memory space, but can be easily -XMreconfigured to fit any memory size on the host system (see Section -XM1.6.9). Following system sign-on, CP/M automatically logs in disk -XMA, prompts you with the symbol A>, indicating that CP/M is currently -XMaddressing disk A, and waits for a command. The commands are -XMimplemented at two levels: built-in commands and transient -Xcommands. - - -W1.2.1 General Command Structure - - MB&Suilt-in commands are a part of the CCP program, while -XMtransient commands are loaded into the TPA from disk and executed. -XThe following are built-in commands: - - 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. - -MMost of the commands reference a particular file or group of files. -XThe form of a file reference is specified in Section 1.2.2. - - -W1.2.2 File References - - MA&S file reference identifies a particular file or group of files -XMon a particular disk attached to CP/M. These file references are -XMeither unambiguous (ufn) or ambiguous (afn). An unambiguous file -XMreference uniquely identifies a single file, while an ambiguous file -Xreference is satisfied by a number of different files. - - MFile references consist of two parts: the primary filename and -XMthe filetype. Although the filetype is optional, it usually is -XMgeneric. For example, the filetype ASM is used to denote that the -XMfile is an assembly language source file, while the primary filename -XMdistinguishes each particular source file. The two names are -Xseparated by a period, as shown in the following example: - - 1-3 - - - - - -CP/M Operating System Manual 1.2 Functional Description - - - filename.typ - -MIn this example, filename is the primary filename of eight -XMcharacters or less, and typ is the filetype of no more than three -Xcharacters. As mentioned above, the name - - filename - -Mis also allowed and is equivalent to a filetype consisting of three -XMblanks. The characters used in specifying an unambiguous file -Xreference cannot contain any of the following special characters: - - < > . , ; : = ? * [ ] _ % | ( ) / \textbackslash - -Mwhile all alphanumerics and remaining special characters are -Xallowed. - - MAn ambiguous file reference is used for directory search and -XMpattern matching. The form of an ambiguous file reference is -XMsimilar to an unambiguous reference, except the symbol ? can be -XMinterspersed throughout the primary and secondary names. In various -XMcommands throughout CP/M, the ? symbol matches any character of a -Xfilename in the ? position. Thus, the ambiguous reference - - X?Z.C?M - -matches the following unambiguous filenames - - XYZ.COM - -and - - X3Z.CAM - -MThe * wildcard character can also be used in an ambiguous file -XMreference. The * character replaces all or part of a filename or -Xfiletype. Note that - - *.* - -equals the ambiguous file reference - - ????????.??? - -while - - filename.* - -and - - *.typ - -are abbreviations for - - filename.??? - - - 1-4 - - - - - -CP/M Operating System Manual 1.2 Functional Description - - - -and - - ????????.typ - -respectively. As an example, - - A>WDIR *.* - -Mi&Ss interpreted by the CCP as a command to list the names of all disk -XMfiles in the directory. The following example searches only for a -Xfile by the name X.Y: - - A>WDIR X,Y - -S&Similarly, the command - - A>WDIR X?Y.C?M - -Mc&Sauses a search for all unambiguous filenames on the disk that -Xsatisfy this ambiguous reference. - - MThe following file references are valid unambiguous file -Xreferences: - - X - X.Y - XYZ - XYZ.COM - GAMMA - GAMMA.1 - - MAs an added convenience, the programmer can generally specify -XMthe disk drive name along with the filename. In this case, the -XMdrive name is given as a letter A through P followed by a colon (:). -XMThe specified drive is then logged-in before the file operation -XMoccurs. Thus, the following are valid file references with disk -Xname prefixes: - - A:X.Y - P:XYZ.COM - B:XYZ - B:X.A?M - C:GAMMA - C:*.ASM - -MAll alphabetic lower-case letters in file and drive names are -Xtranslated to upper-case when they are processed by the CCP. - - -W1.3 Switching Disks - - MT&She operator can switch the currently logged disk by typing the -XMdisk drive name, A through P, followed by a colon when the CCP is -XMwaiting for console input. The following sequence of prompts and -Xcommands can occur after the CP/M system is loaded from disk A: - - 1-5 - - - - - -CP/M Operating System Manual 1.3 Switching Disks - - - - CP/M VER 2.2 - A>WDIR &SList all files on disk A. - A:SAMPLE ASM SAMPLE PRN - A>WB: &SSwitch to disk B. - B>WDIR *.ASM &SList all ASM files on B. - B:DUMP ASM FILES ASM - b>WA: &SSwitch back to A. - - -W1.4 Built-in Commands - - MT&She file and device reference forms described can now be used -XMto fully specify the structure of the built-in commands. Assume the -Xfollowing abbreviations in the description below: - - ufn unambiguous file reference - afn ambiguous file reference - -MRecall that the CCP always translates lower-case characters to -XMupper-case characters internally. Thus, lower-case alphabetics are -XMtreated as if they are upper-case in command names and file -Xreferences. - - -W1.4.1 ERA Command - -S&Syntax: - - ERA afn - - MThe ERA (erase) command removes files from the currently -XMlogged-in disk, for example, the disk name currently prompted by -XMCP/M preceding the >. The files that are erased are those that -XMsatisfy the ambiguous file reference afn. The followingE examplRes -Xillustrate the use of ERA: - - - ERA X.Y MThe file named X.Y on the currently logged -X Mdisk is removed from the disk directory and -X the space is returned. - - ERA X.* MAll files with primary name X are removed -X from the current disk. - - ERA *.ASM MAll files with secondary name ASM are -X removed from the current disk. - - ERA X?Y.C?M MAll files on the current disk that satisfy -X Mthe ambiguous reference X?Y.C?M are -X deleted. - - - - - - - 1-6 - - - - - -CP/M Operating System Manual 1.4 Built-in Commands - - - ERA *.* MErase all files on the current disk. In -X Mthis case, the CCP prompts the console with -X the message - - ALL FILES (Y/N)? - - Mwhich requires a Y response before files -X are actually removed. - - ERA b:*.PRN MAll files on drive B that satisfy the -X Mambiguous reference ????????.PRN are -X Mdeleted, independently of the currently -X logged disk. - - - -W1.4.2 DIR Command - -S&Syntax: - - DIR afn - - MThe DIR (directory) command causes the names of all files that -XMsatisfy the ambiguous filename afn to be listed at the console -Xdevice. As a special case, the command - - DIR - -Mlists the files on the currently logged disk (the command DIR is -XMequivalenEt to thRe command DIR *.*). The following are valid DIR -Xcommands: - - DIR X.Y - DIR X?Z.C?M - DIR ??.Y - - MSimilar to other CCP commands, the afn can be preceded by a -XMdrive name. The following DIR commands cause the selected drive to -Xbe addressed before the directory search takes place: - - DIR B: - DIR B:X.Y - DIR B:*.A?M - - MIf no files on the selected disk satisfy the directory request, -Xthe message NO FILE appears at the console. - - - - - - - - - - - - 1-7 - - - - - -CP/M Operating System Manual 1.4 Built-in Commands - - -W1.4.3 REN Command - -S&Syntax: - - REN ufn1=ufn2 - - MThe REN (rename) command allows you to change the names of -XMfiles on disk. The file satisfying ufn2 is changed to ufn1. The -XMcurrently logged disk is assumed to contain the file to rename -XM(ufn2). You can also type a left-directed arrowE insteaRd of the -XMequal sign if the console supports this graphic character. The -Xfollowing are examples of the REN command: - - - REN X.Y=Q.R The file Q.R is changed to X.Y. - - REN XYZ.COM=XYZ.XXX MThe file XYZ.XXX is changed to -X XYZ.COM. - - - MThe operator precedes either ufn1 or ufn2 (or both) by an -XMoptional drive address. If ufn1 is preceded by a drive name, then -XMufn2 is assumed to exist on the same drive. Similarly, if ufn2 is -XMpreceded by a drive name, then ufn1 is assumed to exist on the drive -XMas well. The same drive must be specified in both cases if both -XMufn1 and ufn2 are preceded by drive names. The following REN -Xcommands illustrate this format: - - - REN A:X.ASM=Y.ASM MThe file Y.ASM is changed to X.ASM -X on drive A. - - REN B:ZAP.BAS=ZOT.BAS MThe file ZOT.BAS is changed to -X ZAP.BAS on drive B. - - REN B:A.ASM=B:A.BAK MThe file A.BAK is renamed to A.ASM -X on drive B. - - - MIf ufn1 is already present, the REN command responds with the -XMerror FILE EXISTS and not perform the change. If ufn2 does not -XMexist on the specified disk, the message NO FILE is printed at the -Xconsole. - - -W1.4.4 SAVE Command - -S&Syntax: - - SAVE n ufn - - MThe SAVE command places n pages (256-byte blocks) onto disk -XMfrom the TPA and names this file ufn. In the CP/M distribution -XMsystem, the TPA starts at 100H (hexadecimal) which is the second -XMpage of memory. The SAVE command must specify 2 pEages ofR memory if - - - 1-M8 - - - -X - -CP/M Operating System Manual 1.4 Built-in Commands - - -Mthe user's program occupies the area from 100H through 2FFH. The -XMmachine code file can be subsequently loaded and executed. The -Xfollowing are examples of the SAVE command: - - - SAVE 3X.COM Copies 100H through 3FFH to X.COM. - - SAVE 40 Q MCopies 100H through 28FFH to Q. -X MNote that 28 is the page count in -X M28FFH, and that 28H = 2*16+8=40 -X decimal. - - SAVE 4 X.Y Copies 100H through 4FFH to X.Y. - - -MThe SAVE command can also specify a disk drive in the ufn portion of -Xthe command, as shown in the following example: - - SAVE 10 B:ZOT.COM MCopies 10 pages, 100H through 0AFFH, -X to the file ZOT.COM on drive B. - - - -W1.4.5 TYPE Command - -S&Syntax: - - TYPE ufn - - MThe TYPE command displays the content of the ASCII source file -XMufn on the currently logged disk at the console device. The -Xfollowing are valid TYPE commands: - - TYPE X.Y - TYPE X.PLM - TYPE XXX - - MThe TYPE command expands tabs, CTRL-I characters, assuminEg tabR -XMpRositions are set at every eighth column. The ufn can also -Xreference a drive name. - - TYPE B:X.PRN The file X.PRN from drive B is displayed. - - -W1.4.6 USER Command - -S&Syntax: - - USER n - - MThe USER command allows maintenance of separate files in the -XMsame directory. In the syntax line, n is an integer value in the -XMrange 0 to 15. On cold start, the operator is automatically logged -XMinto user area number 0, which is compatible witEh standRard CP/M 1 -XMdirectories. You can issue the USER command at any time to move to - - - 1-M9 - - - -X - -CP/M Operating System Manual 1.4 Built-in Commands - - -Manother logical area within the same directory. Drives that are -XMlogged-in while addressing one user number are automatically active -XMwhen the operator moves to another. A user number is simply a -XMprefix that accesses particular directory entries on the active -Xdisks. - - MThe active user number is maintained until changed by a -XMsubsequent USER command, or until a cold start when user 0 is again -Xassumed. - - -W1.5 Line Editing and Output Control - - MT&She CCP allows certain line-editing functions while typing -XMcommand lines. The CTRL-key sequences are obtained by pressing the -XMcontrol and letter keys simultaneously. Further, CCP command lines -XMare generally up to 255 characters in length; they are not acted -Xupon until the carriage return key is pressed. - - -=WTable 1-1. Line-editing Control Characters - - 9 F0 &SCharacter Meaning - - CTRL-C MReboots CP/M system when pressed at start of -X line. - - CTRL-E MPhysical end of line; carriage is returned, -X Mbut line is not sent until the carriage -X return key is pressed. - - CTRL-H Backspaces one character position. - - CTRL-J Terminates current input (line feed). - - CTRL-M MTerminates current input (carriage return). -X - CTRL-P MCopies all subsequent console output to the -X Mcurrently assigned list device (see Section -X M1.6.1). Output is sent to the list device -X Mand the console device until the next CTRL-P -X is pressed. - - CTRL-R MRetypes current command line; types a clean -X Mline following character deletion with -X rubouts. - - CTRL-S MStops the console output temporarily. -X MProgram execution and output continue when -X Myou press any character at the console, for -X Mexample another CTRL-S. This feature stops -X Moutput on high speed consoles, such as CRTs, -X Min order to view a segment of output before -X continuing. - - - - 1-10 - - - - 9 K0 - -CP/M Operating System Manual 1.5 Line Editing and Output Control - - -=WTable 1-1. (continued) - - 9 F0 &SCharacter Meaning - - CTRL-U MDeletes the entire line typed at the -X console. - - CTRL-X Same as CTRL-U. - - CTRL-Z MEnds input from the console (used in PIP and -X ED). - - RUB/DEL MDeletes and echoes the last character typed -X at the console. - 9 K0 - -W1.6 Transient Commands - - MT&Sransient commands are loaded from the currently logged disk -XMand executed in the TPA. The transient commands for execution under -XMthe CCP are below. Additional functions are easily defined by the -Xuser (see Section 1.6.3). - - -=WTable 1-2. CP/M Transient Commands - - 9 F0 &SCommand Function - - STAT MLists the number of bytes of storage remaining -X Mon the currently logged disk, provides -X Mstatistical information about particular -X Mfiles, and displays or alters device -X assignment. - - ASM MLoads the CP/M assembler and assembles the -X specified program from disk. - - LOAD MLoads the file in Intel HEX machine code -X Mformat and produces a file in machine -X Mexecutable form which can be loaded into the -X MTPA. This loaded program becomes a new -X command under the CCP. - - DDT MLoads the CP/M debugger into TPA and starts -X execution. - - PIP MLoads the Peripheral Interchange Program for -X Msubsequent disk file and peripheral transfer -X operations. - - ED MLoads and executes the CP/M text editor -X program. - - SYSGEN Creates a new CP/M system disk. - - - - 1-11 - - - - 9 K0 - -CP/M Operating System Manual 1.6 Transient Commands - - -=WTable 1-2. (continued) - - 9 F0 &SCommand Function - - SUBMIT MSubmits a file of commands for batch -X processing. - - DUMP Dumps the contents of a file in hex. - - MOVCPM MRegenerates the CP/M system for a particular -X memory size. - - 9 K0 - MTransient commands are specified in the same manner as built-in -XMcommands, and additional commands are easily defined by the user. -XMFor convenience, the transient command can be preceded by a drive -XMname which causes the transient to be loaded from the specified -Xdrive into the TPA for execution. Thus, the command - - B:STAT - -Mcauses CP/M to temporarily log in drive B for the source of the STAT -XMtransient, and then return to the original logged disk for -Xsubsequent processing. - - -W1.6.1 STAT Command - -S&Syntax: - - STAT - STAT "command line" - - MThe STAT command provides general statistical information about -XMfile storage and device assignment. Special forms of the command -XMline allow the current device assignment to be examined and altered. -XMThe various command lines Ethat caRn be specified are shown with an -Xexplanation of each form to the right. - - - STAT MIf you type an empty command line, the STAT -X Mtransient calculates the storage remaining -X Mon all active drives, and prints one of the -X following messages: - - d: R/W, SPACE: nnnK - - d: R/O, SPACE: nnnK - - Mfor each active drive d:, where R/W -X Mindicates the drive can be read or written, -X Mand R/O indicates the drive is Read-Only (a -X Mdrive becomes R/O by explicitly setting it -X Mto Read-Only, as shown below, or by -X Minadvertently changing disks without - - - 1-M12 - - - -X - -CP/M Operating System Manual 1.6 Transient Commands - - - Mperforming a warm start). The space -X Mremaining on the disk in drive d: is given -X in kilobytes by nnn. - - STAT d: MIf a drive name is given, then the drive is -X Mselected before the storage is computed. -X MThus, the command STAT B: could be issued -X Mwhile logged into drive A, resulting in the -X message - - BYTES REMAINING ON B: nnnK - - STAT afn MThe command line can also specify a set of -X Mfiles to be scanned by STAT. The files -X Mthat satisfy afn are listed in alphabetical -X Morder, with storage requirements for each -X file under the heading: - - RECS BYTES EXT D:FILENAME.TYP - rrrr bbbK ee d:filename.typ - - Mwhere rrrr is the number of 128-byte -X Mrecords allocated to the file, bbb is the -X Mnumber of kilobytes allocated to the file -X M(bbb=rrrr*128/1024), ee is the number of -X M16K extensions (ee=bbb/16), d is the drive -X Mname containing the file (A...P), filename -X Mis the eight-character primary filename, -X Mand typ is the three-character filetype. -X MAfter listing the individual files, the -X storage usage is summarized. - - STAT d:afn MThe drive name can be given ahead of the -X Mafn. The specified drive is first -X Mselected, and the form STAT afn is -X executed. - - STAT d:=R/O MThis form sets the drive given by d to -X MRead-Only, remaining in effect until the -X Mnext warm or cold start takes place. When -X a disk is Read-Only, the message - - BDOS ERR ON d: Read-Only - - Mappears if there is an attempt to write to -X Mthe Read-Only disk. CP/M waits until a key -X Mis pressed before performing an automatic -X Mwarm start, at which time the disk becomes -X R/W. - - - - - - - - - 1-13 - - - - - -CP/M Operating System Manual 1.6 Transient Commands - - - - MThe STAT command allows you to control the physical-to-logical -XMdevice assignment. See the IOBYTE function described in Sections 5 -XMand 6. There are four logical peripheral devices that are, at any -XMparticular instant, each assigned one of several physical peripheral -Xdevices. The following is a list of the four logical devices: - - - o MCON: is the system console device, used by CCP for -X communication with the operator. - - o RDR: is the paper tape reader device. - - o PUN: is the paper tape punch device. - - o LST: is the output list device. - - - MThe actual devices attached to any particular computer system -XMare driven by subroutines in the BIOS portion of CP/M. Thus, the -XMlogical RDR: device, for example, could actually be a high speed -XMreader, teletype reader, or cassette tape. To allow some -XMflexibility in device naming and assignment, several physical -Xdevices are defined in Table 1-3. - - -=WTable 1-3. Physical Devices - 9 F0 - &SDevice Meaning - - TTY: Teletype device (slow speed console) - - CRT: Cathode ray tube device (high speed console) - - BAT: MBatch processing (console is current RDR:, -X output goes to current LST: device) - - UC1: User-defined console - - PTR: Paper tape reader (high speed reader) - - UR1: User-defined reader #1 - - UR2: User-defined reader #2 - - PTP: Paper tape punch (high speed punch) - - UP1: User-defined punch #1 - - UP2: User-defined punch #2 - - LPT: Line printer - - UL1: User-defined list device #1 - 9 K0 - - - 1-14 - - - - - -CP/M Operating System Manual 1.6 Transient Commands - - - - MIt is emphasized that the physical device names might not -XMactually correspond to devices that the names imply. That is, you -XMcan implement the PTP: device as a cassette write operation. The -XMexact correspondence and driving subroutine is defined in the BIOS -XMportion of CP/M. In the standard distribution version of CP/M, -XMthese devices correspond to their names on the Model 800 development -Xsystem. - - The command, - - STAT VAL: - -Mproduces a summary of the available status commands, resulting in -Xthe output: - - Temp R/O Disk d:$R/O - Set Indicator: filename.typ $R/O $R/W $SYS $DIR - Disk Status: DSK: d:DSK - Iobyte Assign: - -Mwhich gives an instant summary of the possible STAT commands and -Xshows the permissible logical-to-physical device assignments: - - CON: = TTY: CRT: BAT: UC1: - RDR: = TTY: PTR: UR1: UR2: - PUN: = TTY: PTP: UP1: UP2: - LST: = TTY: CRT: LPT: UL1: - -MThe logical device to the left takes any of the four physical -XMassignments shown to the right. The current logical-to-physical -Xmapping is displayed by typing the command: - - STAT DEV: - -MThis command produces a list of each logical device to the left and -XMthe current corresponding physical device to the right. For -Xexample, the list might appear as follows: - - CON: = CRT: - RDR: = UR1: - PUN: = PTP: - LST: = TTY: - -MThe current logical-to-physical device assignment is changed by -Xtyping a STAT command of the form: - - STAT ld1 = pd1, ld2 = pd2, ... , ldn = pdn - -Mwhere ld1 through ldn are logical device names and pd1 through pdn -XMare compatible physical device names. For example, ldi and pdi -XMappear on the same line in the VAL: command shown above. The -XMfollowing example shows valid STAT commands that change the current -Xlogical-to-physical device assignments: - - - - 1-15 - - - - - -CP/M Operating System Manual 1.6 Transient Commands - - - STAT CON:=CRT: - STAT PUN:=TTY:, LST:=LPT:, RDR:=TTY: - - The command form, - - STAT d:filename.typ $S - -Mwhere d: is an optional drive name and filename.typ is an -XMunambiguous or ambiguous filename, produces the following output -Xdisplay format: - - - Size Recs Bytes Ext Acc - - 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 - - -Mwhere the $S parameter causes the Size field to be displayed. -XMWithout the $S, the Size field is skipped, but the remaining fields -XMare displayed. The Size field lists the virtual file size in -XMrecords, while the Recs field sums the number of virtual records in -XMeach extent. For files constructed sequentially, the Size and Recs -XMfields are identical. The Bytes field lists the actual number of -XMbytes allocated to the corresponding file. The minimum allocation -XMunit is determined at configuration time; thus, the number of bytes -XMcorresponds to the record count plus the remaining unused space in -XMthe last allocated block for sequential files. Random access files -XMare given data areas only when written, so the Bytes field contains -XMthe only accurate allocation figure. In the case of random access, -XMthe Size field gives the logical end-of-file record position and the -XMRecs field counts the logical records of each extent. Each of these -XMextents, however, can contain unallocated holes even though they are -Xadded into the record count. - - MThe Ext field counts the number of physical extents allocated -XMto the file. The Ext count corresponds to the number of directory -XMentries given to the file. Depending on allocation size, there can -XMbe up to 128K bytes (8 logical extents) directly addressed by a -XMsingle directory entry. In a special case, there are actually 256K -Xbytes that can be directly addressed by a physical extent. - - MThe Acc field gives the R/O or R/W file indicator, which you -Xcan change using the commands shown. The four command forms, - - STAT d:filename.typ $R/O - STAT d:filename.typ $R/W - STAT d:filename.typ $SYS - STAT d:filename.typ $DIR - -Mset or reset various permanent file indicators. The R/O indicator -XMplaces the file, or set of files, in a Read-Only status until -XMchanged by a subsequent STAT command. The R/O status is recorded in -XMthe directory with the file so that it remains R/O through - - - 1-M16 - - - -X - -CP/M Operating System Manual 1.6 Transient Commands - - -Mintervening cold start operations. The R/W indicator places the -XMfile in a permanent Read-Write status. The SYS indicator attaches -XMthe system indicator to the file, while the DIR command removes the -XMsystem indicator. The filename.typ may be ambiguous or unambiguous, -XMbut files whose attributes are changed are listed at the console -Xwhen the change occurs. The drive name denoted by d: is optional. - - MWhen a file is marked R/O, subsequent attempts to erase or -XMwrite into the file produce the following BDOS message at your -Xscreen: - - BDOS Err on d: File R/O - -Mlists the drive characteristics of the disk named by d: that is in -XMthe range A:, B:,...,P:. The drive characteristics are listed in -Xthe following format: - - 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 - -Mwhere d: is the selected drive, followed by the total record -XMcapacity (65536 is an eight-megabyte drive), followed by the total -XMcapacity listed in kilobytes. The directory size is listed next, -XMfollowed by the checked entries. The number of checked entries is -XMusually identical to the directory size for removable media, because -XMthis mechanism is used to detect changed media during CP/M operation -XMwithout an intervening warm start. For fixed media, the number is -XMusually zero, because the media are not changed without at least a -Xcold or warm start. - - MThe number of records per extent determines the addressing -XMcapacity of each directory entry (1024 times 128 bytes, or 128K in -XMthe previous example). The number of records per block shows the -XMbasic allocation size (in the example, 128 records/block times 128 -XMbytes per record, or 16K bytes per block). The listing is then -XMfollowed by the number of physical sectors per track and the number -Xof reserved tracks. - - MFor logical drives that share the same physical disk, the -XMnumber of reserved tracks can be quite large because this mechanism -XMis used to skip lower-numbered disk areas allocated to other logical -Xdisks. The command form - - STAT DSK: - -Mproduces a drive characteristics table for all currently active -Xdrives. The final STAT command form is - - - - 1-17 - - - - - -CP/M Operating System Manual 1.6 Transient Commands - - - STAT USR: - -Mwhich produces a list of the user numbers that have files on the -Xcurrently addressed disk. The display format is - - Active User: 0 - Active Files: 0 1 3 - -Mwhere the first line lists the currently addressed user number, as -XMset by the last CCP USER command, followed by a list of user numbers -XMscanned from the current directory. In this case, the active user -XMnumber is 0 (default at cold start) with three user numbers that -XMhave active files on the current disk. The operator can -XMsubsequently examine the directories of the other user numbers by -XMlogging in with USER 1 or USER 3 commands, followed by a DIR command -Xat the CCP level. - - -W1.6.2 ASM Command - -S&Syntax: - - ASM ufn - - MThe ASM command loads and executes the CP/M 8080 assembler. -XMThe ufn specifies a source file containing assembly language -XMstatements, where the filetype is assumed to be ASM and is not -Xspecified. The following ASM commands are valid: - - ASM X - ASM GAMMA - -MThe two-pass assembler is automatically executed. Assembly errors -Xthat occur during the second pass are printed at the console. - - The assembler produces a file: - - X.PRN - -Mwhere X is the primary name specified in the ASM command. The PRN -XMfile contains a listing of the source program with embedded tab -XMcharacters if present in the source program, along with the machine -XMcode generated for each statement and diagnostic error messages, if -XMany. The PRN file is listed at the console using the TYPE command, -XMor sent to a peripheral device using PIP (see Section 1.6.4). Note -XMthat the PRN file contains the original source program, augmented by -XMmiscellaneous assembly information in the leftmost 16 columns; for -XMexample, program addresses and hexadecimal machine code. The PRN -XMfile serves as a backup for the original source file. If the source -XMfile is accidentally removed or destroyed, the PRN file can be -XMedited by removing the leftmost 16 characters of each line (see -XMSection 2). This is done by issuing a single editor macro command. -XMThe resulting file is identical to the original source file and can -XMbe renamed from PRN to ASM for subsequent editing and assembly. The -Xfile - - - 1-18 - - - - - -CP/M Operating System Manual 1.6 Transient Commands - - - - X.HEX - -Mis also produced, which contains 8080 machine language in Intel HEX -XMformat suitable for subsequent loading and execution (see Section -XM1.6.3). For complete details of CP/M's assembly language program, -Xsee Section 3. - - MThe source file for assembly is taken from an alternate disk by -XMprefixing the assembly language filename by a disk drive name. The -Xcommand - - ASM B:ALPHA - -Mloads the assembler from the currently logged drive and processes -XMthe source program ALPHA.ASM on drive B. The HEX and PRN files are -Xalso placed on drive B in this case. - - -W1.6.3 LOAD Command - -S&Syntax: - - LOAD ufn - - MThe LOAD command reads the file ufn, which is assumed to -XMcontain HEX format machine code, and produces a memory image file -XMthat can subsequently be executed. The filename ufn is assumed to -Xbe of the form: - - X.HEX - -Mand only the filename X need be specified in the command. The LOAD -Xcommand creates a file named - - X.COM - -Mthat marks it as containing machine executable code. The file is -XMactually loaded into memory and executed when the user types the -XMfilename X immediately after the prompting character > printed by -Xthe CCP. - - MGenerally, the CCP reads the filename X following the prompting -XMcharacter and looks for a built-in function name. If no function -XMname is found, the CCP searches the system disk directory for a file -Xby the name - - X.COM - -MIf found, the machine code is loaded into the TPA, and the program -XMexecutes. Thus, the user need only LOAD a hex file once; it can be -XMsubsequently executed any number of times by typing the primary -XMname. This way, you can invent new commands in the CCP. -XMInitialized disks contain the transient commands as COM files, which -XMare optionally deleted. The operation takes place on an alternate -Xdrive if the filename is prefixed by a drive name. Thus, - - 1-19 - - - - - -CP/M Operating System Manual 1.6 Transient Commands - - - - LOAD B:BETA - -Mbrings the LOAD program into the TPA from the currently logged disk -Xand operates on drive B after execution begins. - -MWNote: &Sthe BETA.HEX file must contain valid Intel format hexadecimal -XMmachine code records (as produced by the ASM program, for example) -XMthat begin at 100H of the TPA. The addresses in the hex records -XMmust be in ascending order; gaps in unfilled memory regions are -XMfilled with zeroes by the LOAD command as the hex records are read. -XMThus, LOAD must be used only for creating CP/M standard COM files -XMthat operate in the TPA. Programs that occupy regions of memory -Xother than the TPA are loaded under DDT. - - -W1.6.4 PIP - -S&Syntax: - - PIP - PIP destination=source#1, source#2, ..., source #n - - MPIP is the CP/M Peripheral Interchange Program that implements -XMthe basic media conversion operations necessary to load, print, -XMpunch, copy, and combine disk files. The PIP program is initiated -XbyE typingR one of the following forms: - - PIP - PIP command line - -MIn both cases PIP is loaded into the TPA and executed. In the first -XMform, PIP reads command lines directly from the console, prompted -XMwith the * character, until an empty command line is typed (for -XMexample, a single carriage return is issued by the operator). Each -XMsuccessive command line causes some media conversion to take place -Xaccording to the rules shown below. - - MIn the second form, the PIP command is equivalent to the first, -XMexcept that the single command line given with the PIP command is -XMautomatically executed, and PIP terminates immediately with no -XMfurther prompting of the console for input command lines. The form -Xof each command line is - - destination = source#1, source#2, ..., source#n - -Mwhere destination is the file or peripheral device to receive the -XMdata, and source#1, ..., source#n is a series of one or more files -Xor devices that are copied from left to right to the destination. - - MWhen multiple files are given in the command line (for example, -XMn>1), the individual files are assumed to contain ASCII characters, -XMwith an assumed CP/M end-of-file character (CTRL-Z) at the end of -XMeach file (see the O parameter to override this assumption). Lower- -XMcase ASCII alphabetics are internally translated to upper-case to be - - - 1-M20 - - - -X - -CP/M Operating System Manual 1.6 Transient Commands - - -Mconsistent with CP/M file and device name conventions. Finally, the -XMtotal command line length cannot exceed 255 characters. CTRL-E can -XMbe used to force a physical carriage return for lines that exceed -Xthe console width. - - MThe destination and source elements are unambiguous references -XMto CP/M source files with or without a preceding disk drive name. -XMThat is, any file can be referenced with a preceding drive name (A: -XMthrough P:) that defines the particular drive where the file can be -XMobtained or stored. When the drive name is not included, the -XMcurrently logged disk is assumed. The destination file can also -XMappear as one or more of the source files, in which case the source -XMfile is not altered until the entire concatenation is complete. If -XMit already exists, the destination file is removed if the command -XMline is properly formed. It is not removed if an error condition -XMarises. The following command lines, with explanations to the -Xright, are valid as input to PIP: - - - X=Y MCopies to file X from file Y, where -X MX and Y are unambiguous filenames; -X Y remains unchanged. - - X=Y,Z MConcatenates files Y and z and -X Mcopies to file X, with Y and Z -X unchanged. - - X.ASM=Y.ASM,Z.ASM MCreates the file X.ASM from the -X Mconcatenation of the Y and Z.ASM -X files. - - NEW.ZOT=B:OLD.ZAP MMoves a copy of OLD.ZAPP from drive -X MB to the currently logged disk; -X names the file NEW.ZOT. - - B:A.U=B:B.V,A:C.W,D.X MConcatenates file B.V from drive B -X Mwith C.W from drive a and D.X from -X Mthe logged disk; creates the file -X A.U on drive b. - - - MFor convenience, PIP allows abbreviated commands for -XMtransferring files between disk drives. The abbreviated PIP forms -Xare - - PIP d:=afn - PIP dU1D=dU2D:afn - PIP ufn = dU2D: - PIP dU1D:ufn = dU2D: - -MThe first form copies all files from the currently logged disk that -XMsatisfy the afn to the same files on drive d, where d = A...P. The -XMsecond form is equivalent to the first, where the source for the -XMcopy is drive dU2D, where dU2D = A...P. The third form is equivalent to -XMthe command PIP dU1D:ufn=dU2D:ufn which copies the file given by ufn - - - 1-M21 - - - -X - -CP/M Operating System Manual 1.6 Transient Commands - - -Mfrom drive dU2D to the file ufn on drive dU1D:. The fourth form is -XMequivalent to the third, where the source disk is explicitly given -Xby dU2D:. - - MThe source and destination disks must be different in all of -XMthese cases. If an afn is specified, PIP lists each ufn that -XMsatisfies the afn as it is being copied. If a file exists by the -XMsame name as the destination file, it is removed after successful -Xcompletion of the copy and replaced by the copied file. - - MThe following PIP commands give examples of valid disk-to-disk -Xcopy operations: - - - B:=*.COM MCopies all files that have the secondary -X Mname COM to drive B from the current drive. -X - A:=B:ZAP.* MCopies all files that have the primary name -X ZAP to drive A from drive B. - - ZAP.ASM=B: Same as ZAP.ASM=B:ZAP.ASM - - B:ZOT.COM=A: Same as B:ZOT.COM=A:ZOT.COM - - B:=GAMMA.BAS Same as B:GAMMA.BAS=GAMMA.BAS - - B:=A:GAMMA.BAS Same as B:GAMMA.BAS=A:GAMMA.BAS - - - MPIP allows reference to physical and logical devices that are -XMattached to the CP/M system. The device names are the same as given -XMunder the STAT command, along with a number of specially named -XMdevices. The following is a list of logical devices given in the -XSTAT command - - CON: (console) - RDR: (reader) - PUN: (punch) - LST: (list) - -while the physical devices are - - 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) - -MThe BAT: physical device is not included, because this assignment is -XMused only to indicate that the RDR: and LST: devices are used for -Xconsole input/output. - - MThe RDR, LST, PUN, and CON devices are all defined within the -XMBIOS portion of CP/M, and are easily altered for any particular I/O -XMsystem. The current physical device mapping is defined by IOBYTE; - - - 1-M22 - - - -X - -CP/M Operating System Manual 1.6 Transient Commands - - -Msee Section 6 for a discussion of this function. The destination -XMdevice must be capable of receiving data, for example, data cannot -XMbe sent to the punch, and the source devices must be capable of -Xgenerating data, for example, the LST: device cannot be read. - - MThe following list describes additional device names that can -Xbe used in PIP commands. - - - o MNUL: sends 40 nulls (ASCII 0s) to the device. This can be -X issued at the end of punched output. - - o MEOF: sends a CP/M end-of-file (ASCII CTRL-Z) to the destination -X Mdevice (sent automatically at the end of all ASCII data -X transfers through PIP). - - o MINP: is a special PIP input source that can be patched into the -X MPIP program. PIP gets the input data character-by-character, -X Mby CALLing location 103H, with data returned in location 109H -X (parity bit must be zero). - - o MOUT: is a special PIP output destination that can be patched -X Minto the PIP program. PIP CALLs location 106H with data in -X Mregister C for each character to transmit. Note that locations -X M109H through 1FFH of the PIP memory image are not used and can -X Mbe replaced by special purpose drivers using DDT (see Section -X 4). - - o MPRN: is the same as LST:, except that tabs are expanded at -X Mevery eighth character position, lines are numbered, and page -X Mejects are inserted every 60 lines with an initial eject (same -X as using PIP options [t8np]). - - - MFile and device names can be interspersed in the PIP commands. -XMIn each case, the specific device is read until end-of-file (CTRL-Z -XMfor ASCII files, and end-of-data for non-ASCII disk files). Data -XMfrom each device or file are concatenated from left to right until -Xthe last data source has been read. - - MThe destination device or file is written using the data from -XMthe source files, and an end-of-file character, CTRL-Z, is appended -XMto the result for ASCII files. If the destination is a disk file, a -XMtemporary file is created ($$$ secondary name) that is changed to -XMthe actual filename only on successful completion of the copy. -XFiles with the extension COM are always assumed to be non-ASCII. - - MThe copy operation can be aborted at any time by pressing any -XMkey on the keyboard. PIP responds with the message ABORTED to -XMindicate that the operation has not been completed. If any -XMoperation is aborted, or if an error occurs during processing, PIP -XMremoves any pending commands that were set up while using the SUBMIT -Xcommand. - - - - - 1-23 - - - - - -CP/M Operating System Manual 1.6 Transient Commands - - - MPIP performs a special function if the destination is a disk -XMfile with type HEX (an Intel hex-formatted machine code file), and -XMthe source is an external peripheral device, such as a paper tape -XMreader. In this case, the PIP program checks to ensure that the -XMsource file contains a properly formed hex file, with legal -Xhexadecimal values and checksum records. - - MWhen an invalid input record is found, PIP reports an error -XMmessage at the console and waits for corrective action. Usually, -XMyou can open the reader and rerun a section of the tape (pull the -XMtape back about 20 inches). When the tape is ready for the reread, -XMa single carriage return is typed at the console, and PIP attempts -XManother read. If the tape position cannot be properly read, -XMcontinue the read by typing a return following the error message, -XMand enter the record manually with the ED program after the disk -Xfile is constructed. - - MPIP allows the end-of-file to be entered from the console if -XMthe source file is an RDR: device. In this case, the PIP program -XMreads the device and monitors the keyboard. If CTRL-Z is typed at -Xthe keyboard, the read operation is terminated normally. - - The following are valid PIP commands: - - - PIP LST: = X.PRN - - MCopies X.PRN to the LST device and -X terminates the PIP program. - - PIP - - MStarts PIP for a sequence of commands. PIP -X prompts with *. - - *CON:=X.ASM,Y.ASM,Z.ASM - - MConcatenates three ASM files and copies to -X the CON device. - - *X.HEX=CON:,Y.HEX,PTR: - - MCreates a HEX file by reading the CON until -X Ma CTRL-Z is typed, followed by data from -X MY.HEX and PTR until a CTRL-Z is -X encountered. - - PIP PUN:=NUL:,X.ASM,EOF:,NUL: - - MSends 40 nulls to the punch device; copies -X Mthe X.ASM file to the punch, followed by an -X Mend-of-file, CTRL-Z, and 40 more null -X characters. - - (carriage return) - - A single carriage return stops PIP. - - 1-24 - - - - -CP/M Operating System Manual 1.6 Transient Commands - - - - MYou can also specify one or more PIP parameters, enclosed in -XMleft and right square brackets, separated by zero or more blanks. -XMEach parameter affects the copy operation, and the enclosed list of -XMparameters must immediately follow the affected file or device. -XMGenerally, each parameter can be followed by an optional decimal -XMinteger value (the S and Q parameters are exceptions). Table 1-4 -Xdescribes valid PIP parameters. - - -=WTable 1-4. PIP Parameters - 9 F0 - Parameter Meaning - - B MBlocks mode transfer. Data are buffered by -X MPIP until an ASCII x-off character, CTRL-S, -X Mis received from the source device. This -X Mallows transfer of data to a disk file from a -X Mcontinuous reading device, such as a cassette -X Mreader. Upon receipt of the x-off, PIP -X Mclears the disk buffers and returns for more -X Minput data. The amount of data that can be -X Mbuffered depends on the memory size of the -X Mhost system. PIP issues an error message if -X the buffers overflow. - - Dn MDeletes characters that extend past column n -X Min the transfer of data to the destination -X Mfrom the character source. This parameter is -X Mgenerally used to truncate long lines that -X Mare sent to a narrow printer or console -X device. - - E MEchoes all transfer operations to the console -X as they are being performed. - - F MFilters form-feeds from the file. All -X Membedded form-feeds are removed. The P -X Mparameter can be used simultaneously to -X insert new form-feeds. - - Gn MGets file from user number n (n in the range -X 0-15). - - H MTransfers HEX data. All data are checked for -X Mproper Intel hex file format. Nonessential -X Mcharacters between hex records are removed -X Mduring the copy operation. The console is -X Mprompted for corrective action in case errors -X occur. - - I MIgnores :00 records in the transfer of Intel -X Mhex format file. The I parameter -X automatically sets the H parameter. - - - - 1-25 - - - - 9 K0 - -CP/M Operating System Manual 1.6 Transient Commands - - -=WTable 1-4. (continued) - 9 F0 - Parameter Meaning - - L MTranslates upper-case alphabetics to lower- -X case. - - N MAdds line numbers to each line transferred to -X Mthe destination, starting at one and -X Mincrementing by 1. Leading zeroes are -X Msuppressed, and the number is followed by a -X Mcolon. If N2 is specified, leading zeroes -X Mare included and a tab is inserted following -X Mthe number. The tab is expanded if T is set. -X - O MTransfers non-ASCII object files. The normal -X CP/M end-of-file is ignored. - - Pn MIncludes page ejects at every n lines with an -X Minitial page eject. If n = 1 or is excluded -X Maltogether, page ejects occur every 60 lines. -X MIf the F parameter is used, form-feed -X Msuppression takes place before the new page -X ejects are inserted. - - Qs^Z MQuits copying from the source device or file -X Mwhen the string s, terminated by CTRL-Z, is -X encountered. - - R Reads system files. - - Ss^Z MStart copying from the source device when the -X Mstring s, terminated by CTRL-Z, is -X Mencountered. The S and Q parameters can be -X Mused to abstract a particular section of a -X Mfile, such as a subroutine. The start and -X Mquit strings are always included in the copy -X operation. - - MIf you specify a command line after the PIP -X Mcommand keyword, the CCP translates strings -X Mfollowing the S and Q parameters to upper- -X Mcase. If you do not specify a command line, -X MPIP does not perform the automatic upper-case -X translation. - - Tn MExpands tabs, CTRL-I characters, to every nth -X Mcolumn during the transfer of characters to -X the destination from the source. - - U MTranslates lower-case alphabetics to upper- -X case during the copy operation. - - - - - - 1-26 - - - - 9 K0 - -CP/M Operating System Manual 1.6 Transient Commands - - -=WTable 1-4. (continued) - 9 F0 - Parameter Meaning - - V MVerifies that data have been copied correctly -X Mby rereading after the write operation (the -X destination must be a disk file). - - W MWrites over R/O files without console -X interrogation. - - Z MZeros the parity bit on input for each ASCII -X character. - 9 K0 - - MThe following examples show valid PIP commands that specify -Xparameters in the file transfer. - - - PIP X.ASM=B:[v] - - MCopies X.ASM from drive B to the current -X Mdrive and verifies that the data were -X properly copied. - - - PIP LPT:=X.ASM[nt8u] - - MCopies X.ASM to the LPT: device; numbers -X Meach line, expands tabs to every eighth -X Mcolumn, and translates lower-case -X alphabetics to upper-case. - - - PIP PUN:=X.HEX[i],Y.ZOT[h] - - MFirst copies X.HEX to the PUN: device and -X Mignores the trailing :00 record in X.HEX; -X Mcontinues the transfer of data by reading -X MY.ZOT, which contains HEX records, -X including any :00 records it contains. - - - PIP X.LIB=Y.ASM[sSUBRI:^z qJMP L3^z] - - MCopies from the file Y.ASM into the file -X MX.LIB. The command starts the copy when -X Mthe string SUBR1: has been found, and quits -X Mcopying after the string JMP L3 is -X encountered. - - - - - - - - 1-27 - - - - - -CP/M Operating System Manual 1.6 Transient Commands - - - PIP PRN:=X.ASM[p50] - - MSends X.ASM to the LST: device with line -X Mnumbers, expands tabs to every eighth -X Mcolumn, and ejects pages at every 50th -X Mline. The assumed parameter list for a PRN -X Mfile is nt8p60; p50 overrides the default -X value. - - - MUnder normal operation, PIP does not overwrite a file that is -XMset to a permanent R/O status. If an attempt is made to overwrite -Xan R/O file, the following prompt appears: - - DESTINATION FILE IS R/O, DELETE (Y/N)? - -MIf you type Y, the file is overwritten. Otherwise, the following -Xresponse appears: - - ** NOT DELETED ** - -MThe file transfer is skipped, and PIP continues with the next -XMoperation in sequence. To avoid the prompt and response in the case -XMof R/O file overwrite, the command line can include the W parameter, -Xas shown in this example: - - PIP A:=B:*.COM[W] - -MThe W parameter copies all nonsystem files to the A drive from the B -XMdrive and overwrites any R/O files in the process. If the operation -XMinvolves several concatenated files, the W parameter need only be -Xincluded with the last file in the list, as in this example: - - PIP A.DAT=B.DAT,F:NEW.DAT,G:OLD.DAT[W] - - MFiles with the system attribute can be included in PIP -XMtransfers if the R parameter is included; otherwise, system files -Xare not recognized. For example, the command line: - - PIP ED.COM=B:ED.COM[R] - -Mreads the ED.COM file from the B drive, even if it has been marked -XMas an R/O and system file. The system file attributes are copied, -Xif present. - - MDownward compatibility with previous versions of CP/M is only -XMmaintained if the file does not exceed one megabyte, no file -XMattributes are set, and the file is created by user 0. If -XMcompatibility is required with nonstandard, for example, double- -XMdensity versions of 1.4, it might be necessary to select 1.4 -XMcompatibility mode when constructing the internal disk parameter -XMblock. See Section 6 and refer to Section 6.10, which describes -XBIOS differences. - - - - - 1-28 - - - - - -CP/M Operating System Manual 1.6 Transient Commands - - -MWNote: &Sto copy files into another user area, PIP.COM must be located -XMin that user area. Use the following procedure to make a copy of -XPIP.COM in another user area. - - - 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 - - -MIn this procedure, s is the integral number of memory pages, 256- -XMbyte segments, occupied by PIP. The number s can be determined when -XMPIP.COM is loaded under DDT, by referring to the value under the -XMNEXT display. If, for example, the next available address is 1D00, -XMthen PIP.COM requires 1C hexadecimal pages, or 1 times 16 + 12 = 28 -XMpages, and the value of s is 28 in the subsequent save. Once PIP is -XMcopied in this manner, it can be copied to another disk belonging to -Xthe same user number through normal PIP transfers. - - -W1.6.5 ED Command - -S&Syntax: - - ED ufn - - MThe ED program is the CP/M system context editor that allows -XMcreation and alteration of ASCII files in the CP/M environment. -XMComplete details of operation are given in Section 2. ED allows the -XMoperator to create and operate upon source filesE that aRre organized -XMas a sequence of ASCII characters, separated by end-of-line -XMcharacters (a carriage return/line-feed sequence). There is no -XMpractical restriction on line length (no single line can exceed the -XMsize of the working memory) that is defined by the number of -Xcharacters typed between carriage returns. - - MThe ED program has a number of commands for character string -XMsearching, replacement, and insertion that are useful for creating -XMand correcting programs or text files under CP/M. Although the CP/M -XMhas a limited memory work space area (approximately 5000 characters -XMin a 20K CP/M system), the file size that can be edited is not -Xlimited, since data are easily paged through this work area. - - MIf it does not exist, ED creates the specified source file and -XMopens the file for access. If the source file does exist, the -XMprogrammer appends data for editing (see the A command). The -XMappended data can then be displayed, altered, and written from the -XMwork area back to the disk (see the W command). Particular points -XMin the program can be automatically paged and located by context, - - - 1-M29 - - - -X - -CP/M Operating System Manual 1.6 Transient Commands - - -Mallowing easy access to particular portions of a large file (see the -XN command). - - If you type the following command line: - - ED X.ASM - -the ED program creates an intermediate work file with the name - - X.$$$ - -Mto hold the edited data during the ED run. Upon completion of ED, -XMthe X.ASM file (original file) is renamed to X.BAK, and the edited -XMwork file is renamed to X.ASM. Thus, the X.BAK file contains the -XMoriginal unedited file, and the X.ASM file contains the newly edited -XMfile. The operator can always return to the previous version of a -XMfile by removing the most recent version and renaming the previous -XMversion. If the current X.ASM file has been improperly edited, the -Xfollowing sequence of commands reclaim the back-up file. - - - 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. - - -MYou can abort the edit at any point (reboot, power failure, CTRL-C, -XMor CTRL-Q command) without destroying the original file. In this -XMcase, the BAK file is not created and the original file is always -Xintact. - - MThe ED program allows the user to edit the source on one disk -XMand create the back-up file on another disk. This form of the ED -Xcommand is - - ED ufn d: - -Mwhere ufn is the name of the file to edit on the currently logged -XMdisk and d is the name of an alternate drive. The ED program reads -XMand processes the source file and writes the new file to drive d -XMusing the name ufn. After processing, the original file becomes the -XMback-up file. If the operator is addressing disk A, the following -Xcommand is valid. - - ED X.ASM b: - -MThis edits the file X.ASM on drive A, creating the new file X.$$$ on -XMdrive B. After a successful edit, A:X.ASM is renamed to A:X.BAK, -XMand B:X.$$$ is renamed to B:X.ASM. For convenience, the currently -XMlogged disk becomes drive B at the end of the edit. Note that if a -XMfile named B:X.ASM exists before the editing begins, the following -Xmessage appears on the screen: - - - 1-30 - - - - - -CP/M Operating System Manual 1.6 Transient Commands - - - - FILE EXISTS - -MThis message is a precaution against accidentally destroying a -XMsource file. You should first erase the existing file and then -Xrestart the edit operation. - - MSimilar to other transient commands, editing can take place on -XMa drive different from the currently logged disk by preceding the -XMsource filename by a drive name. The following are examples of -Xvalid edit requests: - - - ED A:X.ASM MEdits the file X.ASM on drive A, with new -X file and back-up on drive A. - - ED B:X.ASM A: MEdits the file X.ASM on drive B to the -X Mtemporary file X.$$$ on drive A. After -X Mediting, this command changes X.ASM on -X Mdrive B to X.BAK and changes X.$$$ on -X drive A to X.ASM. - - -W1.6.6 SYSGEN Command - -S&Syntax: - - SYSGEN - - MThe SYSGEN transient command allows generation of an -XMinitialized disk containing the CP/M operating system. The SYSGEN -Xprogram prompts the console for commands by interacting as shown. - - - SYSGEN - - Initiates the SYSGEN program. - - - SYSGEN VERSION x.x - - SYSGEN sign-on message. - - - SOURCE DRIVE NAME - (OR RETURN TO SKIP) - - MRespond with the drive name (one of the -X Mletters A, B, C, or D) of the disk -X Mcontaining a CP/M system, usually A. If a -X Mcopy of CP/M already exists in memory due -X Mto a MOVCPM command, press only a carriage -X Mreturn. Typing a drive name d causes the -X response: - - - - 1-31 - - - - - -CP/M Operating System Manual 1.6 Transient Commands - - - SOURCE ON d THEN TYPE RETURN - - MPlace a disk containing the CP/M operating -X Msystem on drive d (d is one of A, B, C, or -X MD). Answer by pressing a carriage return -X when ready. - - - FUNCTION COMPLETE - - MSystem is copied to memory. SYSGEN then -X prompts with the following: - - - DESTINATION DRIVE NAME - (OR RETURN TO REBOOT) - - MIf a disk is being initialized, place the -X Mnew disk into a drive and answer with the -X Mdrive name. Otherwise, press a carriage -X Mreturn and the system reboots from drive A. -X MTyping drive name d causes SYSGEN to prompt -X with the following message: - - - DESTINATION ON d - THEN TYPE RETURN - - MPlace new disk into drive d; press return -X when ready. - - - FUNCTION COMPLETE - - New disk is initialized in drive d. - - -MThe DESTINATION prompt is repeated until a single carriage return is -XMpressed at the console, so that more than one disk can be -Xinitialized. - - MUpon completion of a successful system generation, the new disk -XMcontains the operating system, and only the built-in commands are -XMavailable. An IBM-compatible disk appears to CP/M as a disk with an -XMempty directory; therefore, the operator must copy the appropriate -XMCOM files from an existing CP/M disk to the newly constructed disk -Xusing the PIP transient. - - MYou can copy all files from an existing disk by typing the -Xfollowing PIP command: - - PIP B: = A:*.*[v] - - - - - - 1-32 - - - - - -CP/M Operating System Manual 1.6 Transient Commands - - -MThis command copies all files from disk drive A to disk drive B and -XMverifies that each file has been copied correctly. The name of each -Xfile is displayed at the console as the copy operation proceeds. - - MNote that a SYSGEN does not destroy the files that already -XMexist on a disk; it only constructs a new operating system. If a -XMdisk is being used only on drives B through P and will never be the -XMsource of a bootstrap operation on drive A, the SYSGEN need not take -Xplace. - - -W1.6.7 SUBMIT Command - -ESyntax:R - - RSUBMIT ufn parm#1 ... parm#n - - MThe SUBMIT command allows CP/M commands to be batched for -XMautomatic processing. The ufn given in the SUBMIT command must be -XMthe filename of a file that exists on the currently logged disk, -XMwith an assumed file type of SUB. The SUB file contains CP/M -XMprototype commands with possible parameter substitution. The actual -XMparameters parm#1 ... parm#n are substituted into the prototype -XMcommands, and, if no errors occur, the file of substituted commands -Xare processed sequentially by CP/M. - - MThe prototype command file is created using the ED program, -Xwith interspersed $ parameters of the form: - - $1 $2 $3 ...$n - -Mcorresponding to the number of actual parameters that will be -XMincluded when the file is submitted for execution. When the SUBMIT -XMtransient is executed, the actual parameters parm#1 ... parm#n are -XMpaired with the formal parameters $1 ... $n in the prototype -XMcommands. If the numbers of formal and actual parameters do not -XMcorrespond, the SUBMIT function is aborted with an error message at -XMthe console. The SUBMIT function creates a file of substituted -Xcommands with the name - - $$$.SUB - -Mon the logged disk. When the system reboots, at the termination of -XMthe SUBMIT, this command file is read by the CCP as a source of -XMinput rather than the console. If the SUBMIT function is performed -XMon any disk other than drive A, the commands are not processed until -XMthe disk is inserted into drive A and the system reboots. You can -XMabort command processing at any time by pressing the rubout key when -XMthe command is read and echoed. In this case, the $$$.SUB file is -XMremoved and the subsequent commands come from the console. Command -XMprocessing is also aborted if the CCP detects an error in any of the -XMcommands. Programs that execute under CP/M can abort processing of -XMcommand files when error conditions occur by erasing any existing -X$$$.SUB file. - - - - 1-33 - - - - - -CP/M Operating System Manual 1.6 Transient Commands - - - MTo introduce dollar signs into a SUBMIT file, you can type a $$ -XMwhich reduces to a single $ within the command file. A caret, ^, -XMprecedes an alphabetic character s, which produces a single CTRL-X -Xcharacter within the file. - - MThe last command in a SUB file can initiate another SUB file, -Xallowing chained batch commands: - - MSuppose the file ASMBL.SUB exists on disk and contains the -Xprototype commands - - ASM $1 - DIR $1.* - ERA *.BAK - PIP $2:=$1.PRN - ERA $1.PRN - -then, you issue the following command: - - SUBMIT ASMBL X PRN - -MThe SUBMIT program reads the ASMBL.SUB file, substituting X: for all -XMoccurrences of $1 and PRN for all occurrences of $2. This results -Xin a $$$.SUB file containing the commands: - - ASM X - DIR X.* - ERA *.BAK - PIP PRN:=X.PRN - ERA X.PRN - -which are executed in sequence by the CCP. - - MThe SUBMIT function can access a SUB file on an alternate drive -XMby preceding the filename by a drive name. Submitted files are only -XMacted upon when they appear on drive A. Thus, it is possible to -XMcreate a submitted file on drive B that is executed at a later time -Xwhen inserted in drive A. - - MAn additional utility program called XSUB extends the power of -XMthe SUBMIT facility to include line input to programs as well as the -XMCCP. The XSUB command is included as the first line of the SUBMIT -XMfile. When it is executed, XSUB self-relocates directly below the -XMCCP. All subsequent SUBMIT command lines are processed by XSUB so -XMthat programs that read buffered console input, BDOS Function 10, -XMreceive their input directly from the SUBMIT file. For example, the -Xfile SAVER.SUB can contain the following SUBMIT lines: - - XSUB - DDT - |$1.COM - R - GO - SAVE 1 $2.COM - - - - 1-34 - - - - - -CP/M Operating System Manual 1.6 Transient Commands - - -a subsequent SUBMIT command, such as - - A>WSUBMIT SAVER PIP Y - -Ms&Substitutes X for $1 and Y for $2 in the command stream. The XSUB -XMprogram loads, followed by DDT, which is sent to the command lines -XMPIP.COM, R, and G0, thus returning to the CCP. The final command -XSAVE 1 Y.COM is processed by the CCP. - - The XSUB program remains in memory and prints the message - - (xsub active) - -Mon each warm start operation to indicate its presence. Subsequent -XMSUBMIT command streams do not require the XSUB, unless an -XMintervening cold start occurs. Note that XSUB must be loaded after -XMthe optional CP/M DESPOOL utility, if both are to run -Xsimultaneously. - - -W1.6.8 DUMP Command - -ESyntax:R - - RDUMP ufn - - MThe DUMP program types the contents of the disk file (ufn) at -XMthe console in hexadecimal form. The file contents are listed -XMsixteen bytes at a time, with the absolute byte address listed to -XMthe left of each line in hexadecimal. Long typeouts can be aborted -XMby pressing the rubout key during printout. The source listing of -XMthe DUMP program is given in Section 5 as an example of a program -Xwritten for the CP/M environment. - - -W1.6.9 MOVCPM Command - -ESyntax:R - - RMOVCPM - - MThe MOVCPM program allows you to reconfigure the CP/M system -XMfor any particular memory size. Two optional parameters can be used -XMto indicate the desired size of the new system and the disposition -XMof the new system at program termination. If the first parameter is -XMomitted or an * is given, the MOVCPM program reconfigures the system -XMto its maximum size, based upon the kilobytes of contiguous RAM in -XMthe host system (starting at 0000H). If the second parameter is -XMomitted, the system is executed, but not permanently recorded; if * -XMis given, the system is left in memory, ready for a SYSGEN -XMoperation. The MOVCPM program relocates a memory image of CP/M and -XMplaces this image in memory in preparation for a system generation -Xoperation. The following is a list of MOVCPM command forms: - - - - - 1-35 - - - - - -CP/M Operating System Manual 1.6 Transient Commands - - - MOVCPM MRelocates and executes CP/M for management -X Mof the current memory configuration (memory -X Mis examined for contiguous RAM, starting at -X M100H). On completion of the relocation, the -X Mnew system is executed but not permanently -X Mrecorded on the disk. The system that is -X Mconstructed contains a BIOS for the Intel -X microcomputer development system 800. - - MOVCPM n MCreates a relocated CP/M system for -X Mmanagement of an n kilobyte system (n must -X Mbe in the range of 20 to 64), and executes -X the system as described. - - MOVCPM * * MConstructs a relocated memory image for the -X Mcurrent memory configuration, but leaves the -X Mmemory image in memory in preparation for a -X SYSGEN operation. - - MOVCPM n * MConstructs a relocated memory image for an n -X Mkilobyte memory system, and leaves the -X Mmemory image in preparation for a SYSGEN -X operation. - - - For example, the command, - - MOVCPM * * - -Mconstructs a new version of the CP/M system and leaves it in memory, -Xready for a SYSGEN operation. The message - - READY FOR 'SYSGEN' OR - 'SAVE 34 CPMxx.COM' - -Mappears at the console upon completion, where xx is the current -XMmemory size in kilobytes. You can then type the following sequence: -X - - SYSGEN MThis starts the system -X generation. - - SOURCE DRIVE NAME Respond with a carriage return - (OR RETURN TO SKIP) Mto skip the CP/M read operation, -X Mbecause the system is already -X Min memory as a result of the -X previous MOVCPM operation. - - DESTINATION DRIVE NAME Respond with B to write new - (OR RETURN TO REBOOT) Msystem to the disk in drive B. -X MSYSGEN prompts with the -X following message: - - DESTINATION ON B, Place the new disk on drive B - THEN TYPE RETURN Mand press the RETURN key when -X ready. - - 1-36 - - - - - -CP/M Operating System Manual 1.6 Transient Commands - - - - MIf you respond with A rather than B above, the system is -XMwritten to drive A rather than B. SYSGEN continues to print this -Xprompt: - - DESTINATION DRIVE NAME (OR RETURN TO REBOOT) - -Muntil you respond with a single carriage return, which stops the -XSYSGEN program with a system reboot. - - MYou can then go through the reboot process with the old or new -XMdisk. Instead of performing the SYSGEN operation, you can type a -Xcommand of the form: - - SAVE 34 CPMxx.COM - -Mat the completion of the MOVCPM function, where xx is the value -XMindicated in the SYSGEN message. The CP/M memory image on the -XMcurrently logged disk is in a form that can be patched. This is -XMnecessary when operating in a nonstandard environment where the BIOS -XMmust be altered for a particular peripheral device configuration, as -Xdescribed in Section 6. - - The following are valid MOVCPM commands: - - - MOVCPM 48 MConstructs a 48K version of CP/M and starts -X execution. - - MOVCPM 48 * MConstructs a 48K version of CP/M in -X Mpreparation for permanent recording; the -X response is - - READY FOR 'SYSGEN' OR - 'SAVE 34 CPM48.COM' - - MOVCPM * * MConstructs a maximum memory version of CP/M -X and starts execution. - - MThe newly created system is serialized with the number attached -XMto the original disk and is subject to the conditions of the Digital -XResearch Software Licensing Agreement. - - -W1.7 BDOS Error Messages - - MT&Shere are three error situations that the Basic Disk Operating -XMSystem intercepts during file processing. When one of these -Xconditions is detected, the BDOS prints the message: - - BDOS ERR ON d: error - - - - - - - 1-37 - - - - - -CP/M Operating System Manual 1.7 BDOS Error Messages - - -Mwhere d is the drive name and error is one of the three error -Xmessages: - - BAD SECTOR - SELECT - READ ONLY - - MThe BAD SECTOR message indicates that the disk controller -XMelectronics has detected an error condition in reading or writing -XMthe disk. This condition is generally caused by a malfunctioning -XMdisk controller or an extremely worn disk. If you find that CP/M -XMreports this error more than once a month, the state of the -XMcontroller electronics and the condition of the media should be -Xchecked. - - MYou can also encounter this condition in reading files -XMgenerated by a controller produced by a different manufacturer. -XMEven though controllers claim to be IBM..-compatible, one often -XMfinds small differences in recording formats. The Model 800 -XMcontroller, for example, requires two bytes of one's following the -XMdata CRC byte, which is not required in the IBM format. As a -XMresult, disks generated by the Intel microcomputer development -XMsystem can be read by almost all other IBM-compatible system, while -XMdisk files generated on other manufacturers' equipment produce the -XMBAD SECTOR message when read by the microcomputer development -XMsystem. To recover from this condition, press a CTRL-C to reboot -XM(the safest course), or a return, which ignores the bad sector in -Xthe file operation. - -MWNote: &Spressing a return might destroy disk integrity if the -XMoperation is a directory write. Be sure you have adequate back-ups -Xin this case. - - MThe SELECT error occurs when there is an attempt to address a -XMdrive beyond the range supported by the BIOS. In this case, the -XMvalue of d in the error message gives the selected drive. The -Xsystem reboots following any input from the console. - - MThe READ ONLY message occurs when there is an attempt to write -XMto a disk or file that has been designated as Read-Only in a STAT -XMcommand or has been set to Read-Only by the BDOS. Reboot CP/M by -XMusing the warm start procedure, CTRL-C, or by performing a cold -XMstart whenever the disks are changed. If a changed disk is to be -XMread but not written, BDOS allows the disk to be changed without the -XMwarm or cold start, but internally marks the drive as Read-Only. -XMThe status of the drive is subsequently changed to Read-Write if a -XMwarm or cold start occurs. On issuing this message, CP/M waits for -XMinput from the console. An automatic warm start takes place -Xfollowing any input. - - -W1.8 CP/M Operation on the Model 800 - - - - - - 1-38 - - - - - -CP/M Operating System Manual 1.8 Operation of CP/M on the Model 800 - - - MThis section gives operating procedures for using CP/M on the -XMIntel Model 800 microcomputer development system microcomputer -XMdevelopment system. Basic knowledge of the microcomputer -Xdevelopment system hardware and software systems is assumed. - - MCP/M is initiated in essentially the same manner as the Intel -XMISIS operating system. The disk drives are labeled 0 through 3 on -XMthe microcomputer development system, corresponding to CP/M drives A -XMthrough D, respectively. The CP/M system disk is inserted into -XMdrive 0, and the BOOT and RESET switches are pressed in sequence. -XMThe interrupt 2 light should go on at this point. The space bar is -XMthen pressed on the system console, and the light should go out. If -XMit does not, the user should check connections and baud rates. The -XMBOOT switch is turned off, and the CP/M sign-on message should -XMappear at the selected console device, followed by the A> system -XMprompt. You can then issue the various resident and transient -Xcommands. - - MThe CP/M system can be restarted (warm start) at any time by -XMpushing the INT 0 switch on the front panel. The built-in Intel ROM -XMmonitor can be initiated by pushing the INT 7 switch, which -XMgenerates an RST 7, except when operating under DDT, in which case -Xthe DDT program gets control instead. - - MDiskettes can be removed from the drives at any time, and the -XMsystem can be shut down during operation without affecting data -XMintegrity. Do not remove a disk and replace it with another without -XMrebooting the system (cold or warm start) unless the inserted disk -Xis Read-Only. - - MAs a result of hardware hang-ups or malfunctions, CP/M might -Xprint the following message: - - BDOS ERR ON d: BAD SECTOR - -Mwhere d is the drive that has a permanent error. This error can -XMoccur when drive doors are opened and closed randomly, followed by -XMdisk operations, or can be caused by a disk, drive, or controller -XMfailure. You can optionally elect to ignore the error by pressing a -XMsingle return at the console. The error might produce a bad data -XMrecord, requiring reinitialization of up to 128 bytes of data. You -Xcan reboot the CP/M system and try the operation again. - - MTermination of a CP/M session requires no special action, -XMexcept that it is necessary to remove the disks before turning the -XMpower off to avoid random transients that often make their way to -Xthe drive electronics. - - MYou should use IBM-compatible disks rather than disks that have -XMpreviously been used with any ISIS version. In particular, the ISIS -XMFORMAT operation produces nonstandard sector numbering throughout -XMthe disk. This nonstandard numbering seriously degrades the -XMperformance of CP/M, and causes CP/M to operate noticeably slower -XMthan the distribution version. If it becomes necessary to reformat -XMa disk, which should not be the case for standard disks, a program - - - 1-M39 - - - -X - -CP/M Operating System Manual 1.8 Operation of CP/M on the Model 800 - - -Mcan be written under CP/M that causes the Model 800 controller to -Xreformat with sequential sector numbering (1-26) on each track. - - MGenerally, IBM-compatible 8-inch disks do not need to be -Xformatted. However, 5 1/4-inch disks need to be formatted. - - -=End of Section 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1-40 - - - - - - - - -=WSection 2 - -=WThe CP/M Editor - - - -W2.1 Introduction to Ed - - ME&Sd is the context editor for CP/M, and is used to create and -XMalter CP/M source files. To start ED, type a command of the -Xfollowing form: - - ED filename -or - ED filename.typ - -MGenerally, ED reads segments of the source file given by filename or -XMfilename.typ into the central memory, where you edit the file and it -XMis subsequently written back to disk after alterations. If the -XMsource file does not exist before editing, it is created by ED and -XMinitialized to empty. The overall operation of Ed is shown in -XFigure 2-1. - - -W2.1.1 ED Operation - - ME&Sd operates upon the source file, shown in Figure 2-1 by x.y, -XMand passes all text through a memory buffer where the text can be -XMviewed or altered. The number of lines that can be maintained in -XMthe memory buffer varies with the line length, but has a total -Xcapacity of about 5000 characters in a 20K CP/M system. - - MEdited text material is written into a temporary work file -XMunder your command. Upon termination of the edit, the memory buffer -XMis written to the temporary file, followed by any remaining (unread) -XMtext in the source file. The name of the original file is changed -XMfrom x.y to x.BAK so that the most recent edited source file can be -XMreclaimed if necessary. See the CP/M commands ERASE and RENAME. -XMThe temporary file is then changed from x.$$$ to x.y, which becomes -Xthe resulting edited file. - - MThe memory buffer is logically between the source file and -Xworking file, as shown in Figure 2-2. - - - - - - - - - - - - - - - 2-1 - - - - - -CP/M Operating System Manual 2.1 Introduction to ED - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -=WFigure 2-1. Overall ED Operation - - - - Source File Memory Buffer Temporary File - - 1 First Line 1 First Line 1 First Line - 2 Appended 2 Buffered 2 Processed - 3 Lines 3 Text 3 Text - - - - SP MP TP - - - - Unprocessed Next Free Next Free File - Source Append Memory Write Space - Lines Space - - - - SP = Source Pointer - MP = Memory Pointer - TP = Temporary Pointer - - -=WFigure 2-2. Memory Buffer Organization - - - 2-2 - - - - - -CP/M Operating System Manual 2.1 Introduction to ED - - -W2.1.2 Text Transfer Functions - - MG&Siven that n is an integer value in the range 0 through 65535, -XMseveral single-letter ED commands transfer lines of text from the -XMsource file through the memory buffer to the temporary (and -XMeventually final) file. Single letter commands are shown in upper- -Xcase, but can be typed in either upper- or lower-case. - - -=WTable 2-1. ED Text Transfer Commands - - Command Result - - 9 F0 nA MAppends the next n unprocessed source lines -X Mfrom the source file at SP to the end of the -X Mmemory buffer at MP. Increment SP and MP by n. -X MIf upper-case translation is set (see the U -X Mcommand) and the A command is typed in upper- -X Mcase, all input lines will automatically be -X translated to upper-case. - - nW MWrites the first n lines of the memory buffer -X Mto the temporary file free space. Shift the -X Mremaining lines n+1 through MP to the top of -X the memory buffer. Increment TP by n. - - E MEnds the edit. Copy all buffered text to -X Mtemporary file and copy all unprocessed source -X lines to temporary file. Rename files. - - H MMoves to head of new file by performing -X Mautomatic E command. The temporary file -X Mbecomes the new source file, the memory buffer -X Mis emptied, and a new temporary file is -X Mcreated. The effect is equivalent to issuing -X Man E command, followed by a reinvocation of ED, -X using x.y as the file to edit. - - O MReturns to original file. The memory buffer is -X Memptied, the temporary file is deleted, and the -X MSP is returned to position 1 of the source -X Mfile. The effects of the previous editing -X commands are thus nullified. - - Q MQuits edit with no file alterations, returns to -X CP/M. - 9 K0 - - MThere are a number of special cases to consider. If the -XMinteger n is omitted in any ED command where an integer is allowed, -XMthen 1 is assumed. Thus, the commands A and W append one line and -XMwrite one line, respectively. In addition, if a pound sign # is -XMgiven in the place of n, then the integer 65535 is assumed (the -XMlargest value for n that is allowed). Because most source files can -XMbe contained entirely in the memory buffer, the command #A is often - - - 2-M3 - - - -X - -CP/M Operating System Manual 2.1 Introduction to ED - - -Missued at the beginning of the edit to read the entire source file -XMto memory. Similarly, the command #W writes the entire buffer to -Xthe temporary file. - - MTwo special forms of the A and W commands are provided as a -XMconvenience. The command 0A fills the current memory buffer at -XMleast half full, while 0W writes lines until the buffer is at least -XMhalf empty. An error is issued if the memory buffer size is -XMexceeded. You can then enter any command, such as W, that does not -XMincrease memory requirements. The remainder of any partial line -XMread during the overflow will be brought into memory on the next -Xsuccessful append. - - -W2.1.3 Memory Buffer Organization - - MT&She memory buffer can be considered a sequence of source lines -XMbrought in with the A command from a source file. The memory buffer -XMhas an imaginary character pointer (CP) that moves throughout the -Xmemory buffer under command of the operator. - - MThe memory buffer appears logically as shown in Figure 2-3, -XMwhere the dashes represent characters of the source line of -XMindefinite length, terminated by carriage return () and line- -XMfeed () characters, and CP represents the imaginary character -XMpointer. Note that the CP is always located ahead of the first -XMcharacter of the first line, behind the last character of the last -XMline, or between two characters. The current line CL is the source -Xline that contains the CP. - - - - Memory Buffer - - - first line ----------------------- - - - ----------------------- - - - current line CL --------------------------- - - - CP - - last line ----------------------- - - -W Figure 2-3. Logical Organization of Memory Buffer - - - - - - - - 2-4 - - - - - -CP/M Operating System Manual 2.1 Introduction to ED - - -&SW2.1.4 Line Numbers and ED Start-up - - ME&SD produces absolute line number prefixes that are used to -XMreference a line or range of lines. The absolute line number is -XMdisplayed at the beginning of each line when ED is in insert mode -XM(see the I command in Section 2.1.5). Each line number takes the -Xform - - nnnnn: - -Mwhere nnnnn is an absolute line number in the range of 1 to 65535. -XMIf the memory buffer is empty or if the current line is at the end -Xof the memory buffer, nnnnn appears as 5 blanks. - - MYou can reference an absolute line number by preceding any -XMcommand by a number followed by a colon, in the same format as the -XMline number display. In this case, the ED program moves the current -XMline reference to the absolute line number, if the line exists in -XMthe current memory buffer. The line denoted by the absolute line -XMnumber must be in the memory buffer (see the A command). Thus, the -Xcommand - - 345:T - -Mis interpreted as move to absolute 345, and type the line. -XMAbsolute line numbers are produced only during the editing process -XMand are not recorded with the file. In particular, the line numbers -Xwill change following a deleted or expanded section of text. - - MYou can also reference an absolute line number as a backward or -XMforward distance from the current line by preceding the absolute -Xnumber by a colon. Thus, the command - - :400T - -Mis interpreted as type from the current line number through the line -XMwhose absolute number is 400. Combining the two line reference -Xforms, the command - - 345::400T - -Mis interpreted as move to absolute line 345, then type through -XMabsolute line 400. Absolute line references of this sort can -Xprecede any of the standard ED commands. - - MLine numbering is controlled by the V (Verify Line Numbers) -XMcommand. Line numbering can be turned off by typing the -V command. -X - - - - - - - - - - 2-5 - - - - - -CP/M Operating System Manual 2.1 Introduction to ED - - -MIf the file to edit does not exist, ED displays the following -Xmessage: - - NEW FILE - -MTo move text into the memory buffer, you must enter an i command -XMbefore typing input lines and terminate each line with a carriage -Xreturn. A single CTRL-Z character returns ED to command mode. - - -W2.1.5 Memory Buffer Operation - - MW&Shen ED begins, the memory buffer is empty. You can either -XMappend lines from the source file with the A command, or enter the -XMlines directly from the console with the insert command. The insert -Xcommand takes the following form: - - I - -MED then accepts any number of input lines. You must terminate each -XMline with a (the is supplied automatically). A single -XMCTRL-Z, denoted by a caret (^)Z, returns ED to command mode. The CP -XMis positioned after the last character entered. The following -Xsequence: - - I - NOW IS THE - TIME FOR - ALL GOOD MEN - ^Z - -leaves the memory buffer as - - NOW IS THE - TIME FOR - ALL GOOD MEN - - MGenerally, ED accepts command letters in upper- or lower-case. -XMIf the command is upper-case, all input values associated with the -XMcommand are translated to upper-case. If the I command is typed, -XMall input lines are automatically translated internally to upper- -XMcase. The lower-case form of the i command is most often used to -Xallow both upper- and lower-case letters to be entered. - - MVarious commands can be issued that control the CP or display -XMsource text in the vicinity of the CP. The commands shown below -XMwith a preceding n indicate that an optional unsigned value can be -XMspecified. When preceded by +_, the command can be unsigned, or have -XMan optional preceding plus or minus sign. As before, the pound sign -XM# is replaced by 65535. If an integer n is optional, but not -XMsupplied, then n=1 is assumed. Finally, if a plus sign is optional, -Xbut none is specified, then + is assumed. - - - - - - 2-6 - - - - - -CP/M Operating System Manual 2.1 Introduction to ED - - -=WTable 2-2. Editing Commands - - Command Action - - 9 F0 +_B MMove CP to beginning of memory buffer if + and -X to bottom if -. - - +_nC MMove CP by +_n characters (moving ahead if +), -X counting the as two characters. - - +_nD MDelete n characters ahead of CP if plus and -X behind CP if minus. - - +_nK MKill (remove) +_n lines of source text using CP -X Mas the current reference. If CP is not at the -X Mbeginning of the current line when K is issued, -X Mthe characters before CP remain if + is -X Mspecified, while the characters after CP remain -X if - is given in the command. - - +_nL MIf n = 0, move CP to the beginning of the -X Mcurrent line, if it is not already there. If n -X M=/ 0, first move the CP to the beginning of the -X Mcurrent line and then move it to the beginning -X Mof the line that is n lines down (if +) or up -X M(if -). The CP will stop at the top or bottom -X Mof the memory buffer if too large a value of n -X is specified. - - +_nT MIf n = 0, type the contents of the current line -X Mup to CP. If n = 1, type the contents of the -X Mcurrent line from CP to the end of the line. -X MIf n>1, type the current line along with n - 1 -X Mlines that follow, if + is specified. -X MSimilarly, if n>1 and - is given, type the -X Mprevious n lines up to the CP. Any key can be -X depressed to abort long type-outs. - - +_n MEquivalent to +_nLT, which moves up or down and -X types a single line. - 9 K0 - - -W2.1.6 Command Strings - - MA&Sny number of commands can be typed contiguously (up to the -XMcapacity of the console buffer) and are executed only after you -XMpress the . Table 2-3 summarizes the CP/M console line-editing -Xcommands used to control the input command line. - - - - - - - - - 2-7 - - - - - -CP/M Operating System Manual 2.1 Introduction to ED - - -=WTable 2-3. Line-editing Controls - - Command Result - - 9 F0 CTRL-C MReboots the CP/M system when typed at the -X start of a line. - - CTRL-E MPhysical end of line: carriage is returned, -X Mbut line is not sent until the carriage return -X key is depressed. - - CTRL-H Backspaces one character position. - - CTRL-J Terminates current input (line-feed). - - CTRL-M Terminates current input (carriage return). - - CTRL-R MRetypes current command line: types a clean -X line character deletion with rubouts. - - CTRL-U MDeletes the entire line typed at the console. -X - CTRL-X Same as CTRL-U. - - CTRL-Z MEnds input from the console (used in PIP and -X ED). - - rub/del MDeletes and echos the last character typed at -X the console. - 9 K0 - - MSuppose the memory buffer contains the characters shown in the -XMprevious section, with the CP following the last character of the -XMbuffer. In the following example, the command strings on the left -XMproduce the results shown to the right. Use lower-case command -Xletters to avoid automatic translation of strings to upper-case. - - - Command String Effect - - 9 F0 B2T MMove to beginning of the buffer and type -X two lines: - - NOW IS THE - TIME FOR - The result in the memory buffer is - - NOW IS THE - TIME FOR - ALL GOOD MEN - - - - - - - - 2-8 - - - - - -CP/M Operating System Manual 2.1 Introduction to ED - - - Command String Effect - - 5C0T MMove CP five characters and type the -X Mbeginning of the line NOW I. The result -X in the memory buffer is - - NOW I S THE - - - 2L-T MMove two lines down and type the previous -X Mline TIME FOR. The result in the memory -X buffer is - - NOW IS THE - TIME FOR - ALL GOOD MEN - - - -L#K MMove up one line, delete 65535 lines that -X Mfollow. The result in the memory buffer -X is - - NOW IS THE - - - I Insert two lines of text with automatic - TIME TO translation to upper-case. The result in - INSERT the memory buffer is - ^Z - - NOW IS THE - TIME TO - INSERT - - - -2L#T MMove up two lines and type 65535 lines -X Mahead of CP NOW IS THE. The result in the -X memory buffer is - - NOW IS THE - TIME TO - INSERT - - - MMove down one line and type one line -X MINSERT. The result in the memory buffer -X is - - NOW IS THE - TIME TO - INSERT - 9 K0 - - - - - - 2-9 - - - - - -CP/M Operating System Manual 2.1 Introduction to ED - - -W2.1.7 Text Search and Alteration - - ME&SD has a command that locates strings within the memory buffer. -XThe command takes the form - - nF s -or - nF s ^Z - -Mwhere s represents the string to match, followed by either a or -XMCTRL-Z, denoted by ^Z. ED starts at the current position of CP and -XMattempts to match the string. The match is attempted n times and, -XMif successful, the CP is moved directly after the string. If the n -XMmatches are not successful, the CP is not moved from its initial -XMposition. Search strings can include CTRL-L, which is replaced by -Xthe pair of symbols . - - The following commands illustrate the use of the F command: - - - Command String Effect - - 9 F0 B#T MMove to the beginning and type the entire -X Mbuffer. The result in the memory buffer -X is - - NOW IS THE - TIME FOR - ALL GOOD MEN - - - FS T MFind the end of the string S T. The -X result in the memory buffer is - - NOW IS T HE - - - FIs^Z0TT MFind the next I and type to the CP; then -X Mtype the remainder of the current line ME -X FOR. The result in the memory buffer is - - NOW IS THE - TI ME FOR - - ALL GOOD MEN - 9 K0 - - MAn abbreviated form of the insert command is also allowed, -XMwhich is often used in conjunction with the F command to make simple -Xtextual changes. The form is - - | s ^Z -or - | s - - - - 2-10 - - - - - -CP/M Operating System Manual 2.1 Introduction to ED - - -Mwhere s is the string to insert. If the insertion string is -XMterminated by a CTRL-Z, the string is inserted directly following -XMthe CP, and the CP is positioned directly after the string. The -XMaction is the same if the command is followed by a except that -XMa is automatically inserted into the text following the -XMstring. The following command sequences are examples of the F and I -Xcommands: - - - Command String Effect - 9 F0 - BITHIS IS ^Z - - MInsert THIS IS at the beginning of the -X text. The result in the memory buffer is - - THIS IS NOW THE - - TIME FOR - ALL GOOD MEN - - - FTIME^Z-4DIPLACE^Z - - MFind TIME and delete it; then insert -X MPLACE. The result in the memory buffer is -X - THIS IS NOW THE - PLACE FOR - - ALL GOOD MEN - - - 3FO^Z-3D5D1 - CHANGES^Z MFind third occurrence of O (that is, the -X Msecond O in GOOD), delete previous 3 -X Mcharacters and the subsequent 5 -X Mcharacters; then insert CHANGES. The -X result in the memory buffer is - - THIS IS NOW THE - PLACE FOR - ALL CHANGES - - - -8CISOURCE - - MMove back 8 characters and insert the line -X MSOURCE. The result in the memory -X buffer is - - THIS IS NOW THE - PLACE FOR - ALL SOURCE - CHANGES - - - 2-11 - - - - 9 K0 - -CP/M Operating System Manual 2.1 Introduction to ED - - - - - MED also provides a single command that combines the F and I -XMcommands to perform simple string substitutions. The command takes -Xthe following form: - - nS sU1D^ZsU2D -or - nS sU1D^ZsU2D ^Z - -Mand has exactly the same effect as applying the following command -Xstring a total of n times: - - F sU1D^Z-kDIsU2 -or - F sU1D^Z-kDIsU2D ^Z - -Mwhere k is the length of the string. ED searches the memory buffer -XMstarting at the current position of CP and successively substitutes -XMthe second string for the first string until the end of buffer, or -Xuntil the substitution has been performed n times. - - MAs a convenience, a command similar to F is provided by ED that -XMautomatically appends and writes lines as the search proceeds. The -Xform is - - n N s -or - n N s ^Z - -Mwhich searches the entire source file for the nth occurrence of the -XMstrings (you should recall that F fails if the string cannot be -XMfound in the current buffer). The operation of the N command is -XMprecisely the same as F except in the case that the string cannot be -XMfound within the current memory buffer. In this case, the entire -XMmemory content is written (that is, an automatic #W is issued). -XMInput lines are then read until the buffer is at least half full, or -XMthe entire source file is exhausted. The search continues in this -XMmanner until the string has been found n times, or until the source -Xfile has been completely transferred to the temporary file. - - MA final line editing function, called the juxtaposition -Xcommand, takes the form - - n J sU1D^ZsU2D^ZsU3D -or - n J sU1D^ZsU2D^ZsU3D ^Z - -Mwith the following action applied n times to the memory buffer: -XMsearch from the current CP for the next occurrence of the string s1. -XMIf found, insert the string s2, and move CP to follow s2. Then -XMdelete all characters following CP up to, but not including, the -XMstring sU3D, leaving CP directly after sU2D. If sU3D cannot be found, -Xthen no deletion is made. If the current line is - - - - 2-12 - - - - - -CP/M Operating System Manual 2.1 Introduction to ED - - - NOW IS THE TIME - -the command - - JW ^ZWHAT^Z^1 - -results in - - NOW WHAT - -MYou should recall that ^1 (CTRL-L) represents the pair in -Xsearch and substitute strings. - - MThe number of characters ED allows in the F, S, N, and J -Xcommands is limited to 100 symbols. - - -W2.1.8 Source Libraries - - ME&SD also allows the inclusion of source libraries during the -Xediting process with the R command. The form of this command is - - R filename ^Z -or - R filename - -Mwhere filename is the primary filename of a source file on the disk -XMwith an assumed filetype of LIB. ED reads the specified file, and -XMplaces the characters into the memory buffer after CP, in a manner -Xsimilar to the I command. Thus, if the command - - RMACRO - -Mis issued by the operator, ED reads from the file MACRO.LIB until -XMthe end-of-file and automatically inserts the characters into the -Xmemory buffer. - - MED also includes a block move facility implemented through the -XX (Transfer) command. The form - - nX - -Mtransfers the next n lines from the current line to a temporary file -Xcalled - - X$$$$$$.LIB - -Mwhich is active only during the editing process. You can reposition -XMthe current line reference to any portion of the source file and -XMtransfer lines to the temporary file. The transferred lines -XMaccumulate one after another in this file and can be retrieved by -Xsimply typing - - R - - - - 2-13 - - - - - -CP/M Operating System Manual 2.1 Introduction to ED - - -Mwhich is the trivial case of the library read command. In this -XMcase, the entire transferred set of lines is read into the memory -XMbuffer. Note that the X command does not remove the transferred -XMlines from the memory buffer, although a K command can be used -XMdirectly after the X, and the R command does not empty the -XMtransferred LIB file. That is, given that a set of lines has been -XMtransferred with the X command, they can be reread any number of -Xtimes back into the source file. The command - - 0X - -is provided to empty the transferred line file. - - MNote that upon normal completion of the ED program through Q or -XME, the temporary LIB file is removed. If ED is aborted with a CTRL- -XMC, the LIB file will exist if lines have been transferred, but will -XMgenerally be empty (a subsequent ED invocation will erase the -Xtemporary file). - - -W2.1.9 Repetitive Command Execution - - MT&She macro command M allows you to group ED commands together -Xfor repeated evaluation. The M command takes the following form: - - n M CS -or - n M CS ^Z - -Mwhere CS represents a string of ED commands, not including another M -XMcommand. ED executes the command string n times if n>1. If n=0 or -XM1, the command string is executed repetitively until an error -XMcondition is encountered (for example, the end of the memory buffer -Xis reached with an F command). - - MAs an example, the following macro changes all occurrences of -XMGAMMA to DELTA within the current buffer, and types each line that -Xis changed: - - MFGAMMA^Z-5DIDELTA^Z0TT - -or equivalently - - MSGAMMA^ZDELTA^Z0TT - - -W2.2 ED Error Conditions - - MO&Sn error conditions, ED prints the message BREAK X AT C where X -Xis one of the error indicators shown in Table 2-4. - - - - - - - - 2-14 - - - - - -CP/M Operating System Manual 2.2 ED Error Conditions - - -=WTable 2-4. Error Message Symbols - - Symbol Meaning - - 9 H0 ? Unrecognized command. - - > MMemory buffer full (use one of the commands D, K, -X MN, S, or W to remove characters); F, N, or S -X strings too long. - - # MCannot apply command the number of times -X specified (for example, in F command). - - O Cannot open LIB file in R command. - 9 K0 - -If there is a disk error, CP/M displays the following message: - - BDOS ERR on d: BAD SECTOR - -MYou can choose to ignore the error by pressing RETURN at the console -XM(in this case, the memory buffer data should be examined to see if -XMthey were incorrectly read), or you can reset the system with a -XMCTRL-C and reclaim the back-up file if it exists. The file can be -XMreclaimed by first typing the contents of the BAK file to ensure -XMthat it contains the proper information. For example, type the -Xfollowing: - - TYPE x.BAK - -where x is the file being edited. Then remove the primary file - - ERA x.y - -and rename the BAK file - - REN x.y=x.BAK - -The file can then be reedited, starting with the previous version. - - MED also takes file attributes into account. If you attempt to -Xedit a Read-Only file, the message - - ** FILE IS READ/ONLY ** - -Mappears at the console. The file can be loaded and examined, but -XMcannot be altered. You must end the edit session and use STAT to -XMchange the file attribute to R/W. If the edited file has the system -Xattribute set, the following message: - - 'SYSTEM' FILE NOT ACCESSIBLE - -Mis displayed and the edit session is aborted. Again, the STAT -Xprogram can be used to change the system attribute, if desired. - - - - 2-15 - - - - - -CP/M Operating System Manual 2.3 Control Characters and Commands - - -W2.3 Control Characters and Commands - - MT&Sable 2-5 summarizes the control characters and commands -Xavailable in ED. - - -=WTable 2-5. ED Control Characters - - 9 F0 Control Function - Character - - CTRL-C System reboot - - CTRL-E MPhysical (not actually entered in -X command) - - CTRL-H Backspace - - CTRL-J Logical tab (cols 1, 9, 16, ...) - - CTRL-L MLogical in search and substitute -X strings - - CTRL-R Repeat line - - CTRL-U Line delete - - CTRL-X Line delete - - CTRL-Z String terminator - - rub/del Character delete - - 9 K0 - Table 2-6 summarizes the commands used in ED. - - -=WTable 2-6. ED Commands - - Command Function - 9 F0 - nA Append lines - - +_B Begin or bottom of buffer - - +_nC Move character positions - - +_nD Delete characters - - E End edit and close files (normal end) - - nF Find string - - - - - - 2-16 - - - - 9 K0 - -CP/M Operating System Manual 2.3 Control Characters and Commands - - -=WTable 2-6. (continued) - - Command Function - 9 F0 - H End edit, close and reopen files - - I MInsert characters, use i if both upper and -X lower-case characters are to be entered. - - nJ Place strings in juxtaposition - - +_nK Kill lines - - +_nL Move down/up lines - - nM Macro definition - - nN Find next occurrence with autoscan - - O Return to original file - - +_nP Move and print pages - - Q Quit with no file changes - - R Read library file - - nS Substitute strings - - +_nT Type lines - - +_U MTranslate lower- to upper-case if U, no -X translation if -U - - +_V MVerify line numbers, or show remaining -X free character space - - 0V MA special case of the V command, OV, -X Mprints the memory buffer statistics in the -X form - - free/total - - Mwhere free is the number of free bytes in -X Mthe memory buffer (in decimal) and total -X is the size of the memory buffer - - nW Write lines - - nZ Wait (sleep) for approximately n seconds - - +_n Move and type (+_nLT). - 9 K0 - - - - - 2-17 - - - - - -CP/M Operating System Manual 2.3 Control Characters and Commands - - - MBecause of common typographical errors, ED requires several -XMpotentially disastrous commands to be typed as single letters, -Xrather than in composite commands. The following commands: - - o E(end) - o H(head) - o O(original) - o Q(quit) - -must be typed as single letter commands. - - MThe commands I, J, M, N, R, and S should be typed as i, j, m, -XMn, r, and s if both upper- and lower-case characters are used in the -XMoperation, otherwise all characters are converted to upper-case. -XMWhen a command is entered in upper-case, ED automatically converts -Xthe associated string to upper-case, and vice versa. - - -=End of Section 2 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 2-18 - - - - - - - - -=WSection 3 - -=WCP/M Assembler - - - -&SW3.1 Introduction - - MT&She CP/M assembler reads assembly-language source files from -XMthe disk and produces 8080 machine language in Intel hex format. To -XMstart the CP/M assembler, type a command in one of the following -Xforms: - - ASM filename - ASM filename.parms - -MIn both cases, the assembler assumes there is a file on the disk -Xwith the name: - - filename.ASM - -Mwhich contains an 8080 assembly-language source file. The first and -XMsecond forms shown above differ only in that the second form allows -XMparameters to be passed to the assembler to control source file -Xaccess and hex and print file destinations. - - MIn either case, the CP/M assembler loads and prints the -Xmessage: - - CP/M ASSEMBLER VER n.n - -Mwhere n.n is the current version number. In the case of the first -XMcommand, the assembler reads the source file with assumed filetype -XASM and creates two output files - - filename.HEX - filename.PRN - - MThe HEX file contains the machine code corresponding to the -XMoriginal program in Intel hex format, and the PRN file contains an -XMannotated listing showing generated machine code, error flags, and -XMsource lines. If errors occur during translation, they are listed -Xin the PRN file and at the console. - - MThe form ASM filename parms is used to redirect input and -XMoutput files from their defaults. In this case, the parms portion -XMof the command is a three-letter group that specifies the origin of -XMthe source file, the destination of the hex file, and the -Xdestination of the print file. The form is - - - - - - - - - 3-1 - - - - - -CP/M Operating System Manual 3.1 Introduction - - - filename.p1p2p3 - -where p1, p2, and p3 are single letters. P1 can be - - A,B, ...,P - -Mwhich designates the disk name that contains the source file. P2 -Xcan be - - A,B, ...,P - -Mwhich designates the disk name that will receive the hex file; or, -XP2 can be - - Z - -which skips the generation of the hex file. - - P3 can be - - A,B, ...,P - -Mwhich designates the disk name that will receive the print file. P3 -Xcan also be specified as - - X - -which places the listing at the console; or - - Z - -which skips generation of the print file. Thus, the command - - ASM X.AAA - -Mindicates that the source, X.HEX, and print, X.PRN, files are also -XMto be created on disk A. This form of the command is implied if the -XMassembler is run from disk A. Given that you are currently -Xaddressing disk A, the above command is the same as - - ASM X - -The command - - ASM X.ABX - -Mindicates that the source file is to be taken from disk A, the hex -XMfile is to be placed on disk B, and the listing file is to be sent -Xto the console. The command - - ASM X.BZZ - -Mtakes the source file from disk B and skips the generation of the -XMhex and print files. This command is useful for fast execution of -Xthe assembler to check program syntax. - - - 3-2 - - - - - -CP/M Operating System Manual 3.1 Introduction - - - - MThe source program format is compatible with the Intel 8080 -XMassembler. Macros are not implemented in ASM; see the optional MAC -XMmacro assembler. There are certain extensions in the CP/M assembler -XMthat make it somewhat easier to use. These extensions are described -Xbelow. - - -W3.2 Program Format - - MA&Sn assembly-language program acceptable as input to the -Xassembler consists of a sequence of statements of the form - - line# label operation operand ;comment - -Mwhere any or all of the fields may be present in a particular -XMinstance. Each assembly-language statement is terminated with a -XMcarriage return and line-feed (the line-feed is inserted -XMautomatically by the ED program), or with the character !, which is -XMtreated as an end-of-line by the assembler. Thus, multiple -XMassembly-language statements can be written on the same physical -Xline if separated by exclamation point symbols. - - MThe line# is an optional decimal integer value representing the -Xsource program line number, and ASM ignores this field if present. - - The label field takes either of the following forms: - - identifier - identifier: - -MThe label field is optional, except where noted in particular -XMstatement types. The identifier is a sequence of alphanumeric -XMcharacters where the first character is alphabetic. Identifiers can -XMbe freely used by the programmer to label elements such as program -XMsteps and assembler directives, but cannot exceed 16 characters in -XMlength. All characters are significant in an identifier, except for -XMthe embedded dollar symbol $, which can be used to improve -XMreadability of the name. Further, all lower-case alphabetics are -XMtreated as upper-case. The following are all valid instances of -Xlabels: - - - x xy long$name - - x: yxl: longer$named$data: - - X1Y2 X1x2 x234$5678$9012$3456: - - - MThe operation field contains either an assembler directive or -XMpseudo operation, or an 8080 machine operation code. The pseudo -XMoperations and machine operation codes are described in Section 3.3. -X - - - - 3-3 - - - - - -CP/M Operating System Manual 3.2 Program Format - - - MGenerally, the operand field of the statement contains an -XMexpression formed out of constants and labels, along with arithmetic -XMand logical operations on these elements. Again, the complete -Xdetails of properly formed expressions are given in Section 3.3. - - MThe comment field contains arbitrary characters following the -XMsemicolon symbol until the next real or logical end-of-line. These -XMcharacters are read, listed, and otherwise ignored by the assembler. -XMThe CP/M assembler also treats statements that begin with an * in -XMcolumn one as comment statements that are listed and ignored in the -Xassembly process. - - MThe assembly-language program is formulated as a sequence of -XMstatements of the above form, terminated by an optional END -XMstatement. All statements following the END are ignored by the -Xassembler. - - -W3.3 Forming the Operand - - MT&So describe the operation codes and pseudo operations -XMcompletely, it is necessary first to present the form of the operand -XMfield, since it is used in nearly all statements. Expressions in -XMthe operand field consist of simple operands, labels, constants, and -XMreserved words, combined in properly formed subexpressions by -XMarithmetic and logical operators. The expression computation is -XMcarried out by the assembler as the assembly proceeds. Each -XMexpression must produce a 16-bit value during the assembly. -XMFurther, the number of significant digits in the result must not -XMexceed the intended use. If an expression is to be used in a byte -XMmove immediate instruction, the most significant 8 bits of the -XMexpression must be zero. The restriction on the expression -Xsignificance is given with the individual instructions. - - -W3.3.1 Labels - - MA&Ss discussed above, a label is an identifier that occurs on a -XMparticular statement. In general, the label is given a value -XMdetermined by the type of statement that it precedes. If the label -XMoccurs on a statement that generates machine code or reserves memory -XMspace (for example, a MOV instruction or a DS pseudo operation), the -XMlabel is given the value of the program address that it labels. If -XMthe label precedes an EQU or SET, the label is given the value that -XMresults from evaluating the operand field. Except for the SET -Xstatement, an identifier can label only one statement. - - MWhen a label appears in the operand field, its value is -XMsubstituted by the assembler. This value can then be combined with -XMother operands and operators to form the operand field for a -Xparticular instruction. - - - - - - - 3-4 - - - - - -CP/M Operating System Manual 3.3 Forming the Operand - - -W3.3.2 Numeric Constants - - MA&S numeric constant is a 16-bit value in one of several bases. -XMThe base, called the radix of the constant, is denoted by a trailing -Xradix indicator. The following are radix indicators: - - 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). - - MQ is an alternate radix indicator for octal numbers because the -XMletter O is easily confused with the digit 0. Any numeric constant -XMthat does not terminate with a radix indicator is a decimal -Xconstant. - - MA constant is composed as a sequence of digits, followed by an -XMoptional radix indicator, where the digits are in the appropriate -XMrange for the radix. Binary constants must be composed of 0 and 1 -XMdigits, octal constants can contain digits in the range 0-7, while -XMdecimal constants contain decimal digits. Hexadecimal constants -XMcontain decimal digits as well as hexadecimal digits A(10D), B(11D), -XMC(12D), D(13D), E(14D), and F(15D). Note that the leading digit of -XMa hexadecimal constant must be a decimal digit to avoid confusing a -XMhexadecimal constant with an identifier. A leading 0 will always -XMsuffice. A constant composed in this manner must evaluate to a -XMbinary number that can be contained within a 16-bit counter, -Xotherwise it is truncated on the right by the assembler. - - MSimilar to identifiers, embedded $ signs are allowed within -XMconstants to improve their readability. Finally, the radix -XMindicator is translated to upper-case if a lower-case letter is -XMencountered. The following are all valid instances of numeric -Xconstants: - - - 1234 1234D 1100B 1111$0000$1111$0000B - - 1234H OFFEH 3377O 33$77$22Q - - 3377o Ofe3h 1234d Offffh - - -W3.3.3 Reserved Words - - MT&Shere are several reserved character sequences that have -XMpredefined meanings in the operand field of a statement. The names -XMof 8080 registers are given below. When they are encountered, they -Xproduce the values shown to the right. - - - - - - - - 3-5 - - - - - -CP/M Operating System Manual 3.3 Forming the Operand - - -W Table 3-1. Reserved Characters - - Character Value - - A 7 - B 0 - C 1 - D 2 - E 3 - H 4 - L 5 - M 6 - SP 6 - PSW 6 - - - MAgain, lower-case names have the same values as their upper- -XMcase equivalents. Machine instructions can also be used in the -XMoperand field; they evaluate to their internal codes. In the case of -XMinstructions that require operands, where the specific operand -XMbecomes a part of the binary bit pattern of the instruction, for -XMexample, MOV A,B, the value of the instruction, in this case MOV, is -XMthe bit pattern of the instruction with zeros in the optional -Xfields, for example, MOV produces 40H. - - MWhen the symbol $ occurs in the operand field, not embedded -XMwithin identifiers and numeric constants, its value becomes the -XMaddress of the next instruction to generate, not including the -Xinstruction contained within the current logical line. - - -W3.3.4 String Constants - - MS&String constants represent sequences of ASCII characters and -XMare represented by enclosing the characters within apostrophe -XMsymbols. All strings must be fully contained within the current -XMphysical line (thus allowing exclamation point symbols within -XMstrings) and must not exceed 64 characters in length. The -XMapostrophe character itself can be included within a string by -XMrepresenting it as a double apostrophe (the two keystrokes ''), -XMwhich becomes a single apostrophe when read by the assembler. In -XMmost cases, the string length is restricted to either one or two -XMcharacters (the DB pseudo operation is an exception), in which case -XMthe string becomes an 8- or 16-bit value, respectively. Two- -XMcharacter strings become a 16-bit constant, with the second -XMcharacter as the low-order byte, and the first character as the -Xhigh-order byte. - - MThe value of a character is its corresponding ASCII code. -XMThere is no case translation within strings; both upper- and lower- -XMcase characters can be represented. You should note that only -Xgraphic printing ASCII characters are allowed within strings. - - - - - - 3-6 - - - - - -CP/M Operating System Manual 3.3 Forming the Operand - - - 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 - - -W3.3.5 Arithmetic and Logical Operators - - MT&She operands described in Section 3.3 can be combined in normal -XMalgebraic notation using any combination of properly formed -XMoperands, operators, and parenthesized expressions. The operators -Xrecognized in the operand field are described in Table 3-2. - - -=WTable 3-2. Arithmetic and Logical Operators - 9 F0 - Operators Meaning - - a + b unsigned arithmetic sum of a and b - - a - b Munsigned arithmetic difference between a -X and b - - + b unary plus (produces b) - - - b unary minus (identical to 0 - b) - - a * b Munsigned magnitude multiplication of a and -X b - - a / b unsigned magnitude division of a by b - - a MOD b remainder after a / b. - - NOT b Mlogical inverse of b (all 0s become 1s, 1s -X Mbecome 0s), where b is considered a 16-bit -X value - - a AND b bit-by-bit logical and of a and b - - a OR b bit-by-bit logical or of a and b - - a XOR b bit-by-bit logical exclusive or of a and b - - a SHL b Mthe value that results from shifting a to -X the left by an amount b, with zero fill - - a SHR b Mthe value that results from shifting a to -X the right by an amount b, with zero fill - 9 K0 - - - - - 3-7 - - - - - -CP/M Operating System Manual 3.3 Forming the Operand - - - MIn each case, a and b represent simple operands (labels, -XMnumeric constants, reserved words, and one- or two-character -XMstrings) or fully enclosed parenthesized subexpressions, like those -Xshown in the following examples: - - - 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)) - - - MNote that all computations are performed at assembly time as -XM16-bit unsigned operations. Thus, -1 is computed as 0-1, which -XMresults in the value 0ffffh (that is, all 1s). The resulting -XMexpression must fit the operation code in which it is used. For -XMexample, if the expression is used in an ADI (add immediate) -XMinstruction, the high-order 8 bits of the expression must be zero. -XMAs a result, the operation ADI-1 produces an error message (-1 -XMbecomes 0ffffh, which cannot be represented as an 8-bit value), -XMwhile ADI(-1) AND 0FFH is accepted by the assembler because the AND -Xoperation zeros the high-order bits of the expression. - - -W3.3.6 Precedence of Operators - - MA&Ss a convenience to the programmer, ASM assumes that operators -XMhave a relative precedence of application that allows the programmer -XMto write expressions without nested levels of parentheses. The -XMresulting expression has assumed parentheses that are defined by the -XMrelative precedence. The order of application of operators in -XMunparenthesized expressions is listed below. Operators listed first -XMhave highest precedence (they are applied first in an -XMunparenthesized expression), while operators listed last have lowest -XMprecedence. Operators listed on the same line have equal -XMprecedence, and are applied from left to right as they are -Xencountered in an expression. - - - * / MOD SHL SHR - - - + - - NOT - - AND - - OR XOR - - - MThus, the expressions shown to the left below are interpreted -XMby the assembler as the fully parenthesized expressions shown to the -Xright. - - - - 3-8 - - - - - -CP/M Operating System Manual 3.3 Forming the Operand - - - 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)))) - - - MBalanced, parenthesized subexpressions can always be used to -XMoverride the assumed parentheses; thus, the last expression above -XMcould be rewritten to force application of operators in a different -Xorder, as shown: - - (a OR b) AND (NOT c)+ d SHL e - -This results in these assumed parentheses: - - (a OR b) AND ((NOT c) + (d SHL e)) - - MAn unparenthesized expression is well-formed only if the -XMexpression that results from inserting the assumed parentheses is -Xwell-formed. - - -W3.4 Assembler Directives - - MA&Sssembler directives are used to set labels to specific values -XMduring the assembly, perform conditional assembly, define storage -XMareas, and specify starting addresses in the program. Each -XMassembler directive is denoted by a pseudo operation that appears in -XMthe operation field of the line. The acceptable pseudo operations -Xare shown in Table 3-3. - - -W Table 3-3. Assembler Directives - - Directive Meaning - - ORG set the program or data origin - - END end program, optional start address - - EQU numeric equate - - SET numeric set - - IF begin conditional assembly - - ENDIF end of conditional assembly - - DB define data bytes - - DW define data words - - DS define data storage area - - 3-9 - - - - - -CP/M Operating System Guide 3.4 Assembler Directives - - -W3.4.1 The ORG Directive - - T&She ORG statement takes the form: - - label ORG expression - -Mwhere label is an optional program identifier and expression is a -XM16-bit expression, consisting of operands that are defined before -XMthe ORG statement. The assembler begins machine code generation at -XMthe location specified in the expression. There can be any number -XMof ORG statements within a particular program, and there are no -XMchecks to ensure that the programmer is not defining overlapping -XMmemory areas. Note that most programs written for the CP/M system -Xbegin with an ORG statement of the form: - - ORG 100H - -Mwhich causes machine code generation to begin at the base of the -XMCP/M transient program area. If a label is specified in the ORG -XMstatement, the label is given the value of the expression. This -XMlabel can then be used in the operand field of other statements to -Xrepresent this expression. - - -W3.4.2 The END Directive - - MT&She END statement is optional in an assembly-language program, -XMbut if it is present it must be the last statement. All subsequent -XMstatements are ignored in the assembly. The END statement takes the -Xfollowing two forms: - - label END - - label END expression - -Mwhere the label is again optional. If the first form is used, the -XMassembly process stops, and the default starting address of the -XMprogram is taken as 0000. Otherwise, the expression is evaluated, -XMand becomes the program starting address. This starting address is -XMincluded in the last record of the Intel-formatted machine code hex -XMfile that results from the assembly. Thus, most CP/M assembly- -Xlanguage programs end with the statement: - - END 100H - -Mresulting in the default starting address of 100H (beginning of the -Xtransient program area). - - - - - - - - - - - 3-10 - - - - - -CP/M Operating System Guide 3.4 Assembler Directives - - -W3.4.3 The EQU Directive - - MT&She EQU (equate) statement is used to set up synonyms for -Xparticular numeric values. The EQU statement takes the form: - - label EQU expression - -Mwhere the label must be present and must not label any other -XMstatement. The assembler evaluates the expression and assigns this -XMvalue to the identifier given in the label field. The identifier is -XMusually a name that describes the value in a more human-oriented -XMmanner. Further, this name is used throughout the program to place -XMparameters on certain functions. Suppose data received from a -XMteletype appears on a particular input port, and data is sent to the -XMteletype through the next output port in sequence. For example, you -XMcan use this series of equate statements to define these ports for a -Xparticular hardware environment: - - - TTYBASE EQU 10H ;BASE PORT NUMBER FOR TTY - - TTYIN EQU TTYBASE ;TTY DATA IN - - TTYOUT EQU TTYBASE+1 ;TTY DATA OUT - - - MAt a later point in the program, the statements that access the -Xteletype can appear as follows: - - - IN TTYIN ;READ TTY DATA TO REG-A - - ... - - OUT TTYOUT ;WRITE DATA TO TTY FROM REG-A - - -Mmaking the program more readable than if the absolute I/O ports are -XMused. Further, if the hardware environment is redefined to start -XMthe teletype communications ports at 7FH instead of 10H, the first -Xstatement need only be changed to - - TTYBASE EQU 7FH ;BASE PORT NUMBER FOR TTY - -Mand the program can be reassembled without changing any other -Xstatements. - - -W3.4.4 The SET Directive - - T&She SET statement is similar to the EQU, taking the form: - - label SET expression - -Mexcept that the label can occur on other SET statements within the -XMprogram. The expression is evaluated and becomes the current value - - 3-M11 - - - -X - -CP/M Operating System Guide 3.4 Assembler Directives - - -Massociated with the label. Thus, the EQU statement defines a label -XMwith a single value, while the SET statement defines a value that is -XMvalid from the current SET statement to the point where the label -XMoccurs on the next SET statement. The use of the SET is similar to -XMthe EQU statement, but is used most often in controlling conditional -Xassembly. - - -W3.4.5 The IF and ENDIF Directives - - MT&She IF and ENDIF statements define a range of assembly-language -XMstatements that are to be included or excluded during the assembly -Xprocess. These statements take on the form: - - - IF expression - - statement#1 - - statement#2 - - ... - - statement#n - - ENDIF - - - MWhen encountering the IF statement, the assembler evaluates the -XMexpression following the IF. All operands in the expression must be -XMdefined ahead of the IF statement. If the expression evaluates to a -XMnonzero value, then statement#1 through statement#n are assembled. -XMIf the expression evaluates to zero, the statements are listed but -XMnot assembled. Conditional assembly is often used to write a single -XMgeneric program that includes a number of possible run-time -XMenvironments, with only a few specific portions of the program -XMselected for any particular assembly. The following program -XMsegments, for example, might be part of a program that communicates -XMwith either a teletype or a CRT console (but not both) by selecting -Xa particular value for TTY before the assembly begins. - - - - - - - - - - - - - - - - - - 3-12 - - - - - -CP/M Operating System Guide 3.4 Assembler Directives - - - 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 - - -MIn this case, the program assembles for an environment where a -XMteletype is connected, based at port 10H. The statement defining -XTTY can be changed to - - TTY EQU FALSE - -Mand, in this case, the program assembles for a CRT based at port -X20H. - - -W3.4.6 The DB Directive - - MT&She DB directive allows the programmer to define initialized -XMstorage areas in single-precision byte format. The DB statement -Xtakes the form: - - label DB e#1, e#2, ..., e#n - -Mwhere e#1 through e#n are either expressions that evaluate to 8-bit -XMvalues (the high-order bit must be zero) or are ASCII strings of -XMlength no greater than 64 characters. There is no practical -XMrestriction on the number of expressions included on a single source -XMline. The expressions are evaluated and placed sequentially into -XMthe machine code file following the last program address generated -XMby the assembler. String characters are similarly placed into -XMmemory starting with the first character and ending with the last -XMcharacter. Strings of length greater than two characters cannot be -Xused as operands in more complicated expressions. - - - - - 3-13 - - - - - -CP/M Operating System Guide 3.4 Assembler Directives - - -MWNote: &SASCII characters are always placed in memory with the parity -XMbit reset (0). Also, there is no translation from lower- to upper- -XMcase within strings. The optional label can be used to reference -XMthe data area throughout the remainder of the program. The -Xfollowing are examples of valid DB statements: - - - 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 - - - -W3.4.7 The DW Directive - - MT&She DW statement is similar to the DB statement except double- -XMprecision two-byte words of storage are initialized. The DW -Xstatement takes the form: - - label DW e#1, e#2, ..., e#n - -Mwhere e#1 through e#n are expressions that evaluate to 16-bit -XMresults. Note that ASCII strings of one or two characters are -XMallowed, but strings longer than two characters are disallowed. In -XMall cases, the data storage is consistent with the 8080 processor; -XMthe least significant byte of the expression is stored first in -XMmemory, followed by the most significant byte. The following are -Xexamples of DW statements: - - - doub: DW 0ffefh,doub+4,signon-$,255+255 - DW 'a', 5, 'ab', 'CD', 6 shl 8 or llb. - - - -W3.4.8 The DS Directive - - MT&She DS statement is used to reserve an area of uninitialized -Xmemory, and takes the form: - - label DS expression - -Mwhere the label is optional. The assembler begins subsequent code -XMgeneration after the area reserved by the DS. Thus, the DS -XMstatement given above has exactly the same effect as the following -Xstatement: - - label: EQU $ ;LABEL VALUE IS CURRENT CODE LOCATION - ORG $+expression ;MOVE PAST RESERVED AREA - - - - - - - 3-14 - - - - - -CP/M Operating System Manual 3.5 Operation Codes - - -W3.5 Operation Codes - - MA&Sssembly-language operation codes form the principal part of -XMassembly-language programs and form the operation field of the -XMinstruction. In general, ASM accepts all the standard mnemonics for -XMthe Intel 8080 microcomputer, which are given in detail in the EIntelR -XM8080 Assembly Language Programming Manual.R Labels are optional on -XMeach input line. The individual operators are listed briefly in the -XMfollowing sections for completeness, although the Intel manuals -XMshould be referenced for exact operator details. In Tables 3-4 -Xthrough 3-8, bit values have the following meaning: - - - o Me3 represents a 3-bit value in the range 0-7 that can be one of -X the predefined registers A, B, C, D, E, H, L, M, SP, or PSW. - - o e8 represents an 8-bit value in the range 0-255. - - o e16 represents a 16-bit value in the range 0-65535. - - - MThese expressions can be formed from an arbitrary combination -XMof operands and operators. In some cases, the operands are -XMrestricted to particular values within the allowable range, such as -XMthe PUSH instruction. These cases are noted as they are -Xencountered. - - MIn the sections that follow, each operation code is listed in -XMits most general form, along with a specific example, a short -Xexplanation, and special restrictions. - - -W3.5.1 Jumps, Calls, and Returns - - MT&She Jump, Call, and Return instructions allow several different -XMforms that test the condition flags set in the 8080 microcomputer -XCPU. The forms are shown in Table 3-4. - - -=WTable 3-4. Jumps, Calls, and Returns - 9 I0 - 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 - - - 3-15 - - - - 9 K0 - -CP/M Operating System Manual 3.5 Operation Codes - - -=WTable 3-4. (continued) - 9 I0 - 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 - 9 K0 - - - - - 3-16 - - - - - -CP/M Operating System Manual 3.5 Operation Codes - - -W3.5.2 Immediate Operand Instructions - - MS&Several instructions are available that load single- or double- -XMprecision registers or single-precision memory cells with constant -XMvalues, along with instructions that perform immediate arithmetic or -XMlogical operations on the accumulator (register A). Table 3-5 -Xdescribes the immediate operand instructions. - - -=WTable 3-5. Immediate Operand Instructions - - 9 F0 Form with Example Meaning - Bit Values - - MVI e3,e8 MVI B,255 MMove immediate data to -X Mregister A, B, C, D, E, H, -X L, or M (memory) - - ADI e8 ADI 1 MAdd immediate operand to A -X without carry - - ACI e8 ACI 0FFH MAdd immediate operand to A -X with carry - - SUI e8 SUI L + 3 MSubtract from A without -X borrow (carry) - - SBI e8 SBI L AND 11B MSubtract from A with borrow -X (carry) - - ANI e8 ANI $ AND 7FH MLogical and A with -X immediate data - - XRI e8 XRI 1111$0000B MExclusive or A with -X immediate data - - ORI e8 ORI L AND 1+1 MLogical or A with immediate -X data - - CPI e8 CPI 'a' MCompare A with immediate -X Mdata, same as SUI except -X register A not changed. - - LXI e3,e16 LXI B,100H MLoad extended immediate to -X Mregister pair. e3 must be -X Mequivalent to B, D, H, or -X SP. - 9 K0 - -W3.5.3 Increment and Decrement Instructions - - MT&She 8080 provides instructions for incrementing or decrementing -XMsingle- and double-precision registers. The instructions are -Xdescribed in Table 3-6. - - - - 3-17 - - - - - -CP/M Operating System Manual 3.5 Operation Codes - - -=WTable 3-6. Increment and Decrement Instructions - 9 F0 - Form with Example Meaning - Bit Value - - INR e3 INR E MSingle-precision increment -X Mregister. e3 produces one -X Mof A, B, C, D, E, H, L, M. -X - DCR e3 DCR A MSingle-precision decrement -X Mregister. e3 produces one -X Mof A, B, C, D, E, H, L, M. -X - INX e3 INX SP MDouble-precision increment -X Mregister pair. e3 must be -X Mequivalent to B, D, H, or -X SP. - - DCX e3 DCX B MDouble-precision decrement -X Mregister pair. e3 must be -X Mequivalent to B, D, H, or -X SP. - 9 K0 - - -W3.5.4 Data Movement Instructions - - MI&Snstructions that move data from memory to the CPU and from CPU -Xto memory are given in the following table. - - -=WTable 3-7. Data Movement Instructions - 9 F0 - Form with Example Meaning - Bit Value - - MOV e3,e3 MOV A,B MMove data to leftmost -X Melement from rightmost -X Melement. e3 produces on -X Mof A, B, C, D, E, H, L, or -X MM. MOV M,M is disallowed. -X - LDAX e3 LDAX B MLoad register A from -X Mcomputed address. e3 must -X produce either B or D. - - STAX e3 STAX D MStore register A to -X Mcomputed address. e3 must -X produce either B or D. - - LHLD e16 LHLD L1 MLoad HL direct from -X Mlocation e16. Double- -X Mprecision load to H and L. -X - - - - 3-18 - - - - 9 K0 - -CP/M Operating System Manual 3.5 Operation Codes - - -=WTable 3-7. (continued) - 9 F0 - Form with Example Meaning - Bit Value - - SHLD e16 SHLD L5+x MStore HL direct to -X Mlocation e16. Double- -X Mprecision store from H and -X L to memory. - - LDA e16 LDA Gamma MLoad register A from -X address e16. - - STA e16 STA X3-5 MStore register A into -X memory at e16. - - POP e3 POP PSW MLoad register pair from -X Mstack, set SP. e3 must -X Mproduce one of B, D, H, or -X PSW. - - PUSH e3 PUSH B MStore register pair into -X Mstack, set SP. e3 must -X Mproduce on of B, D, H, or -X PSW. - - IN e8 IN 0 MLoad register A with data -X from port e8. - - OUT e8 OUT 255 MSend data from register A -X to port e8. - - XTHL MExchange data from top of -X stack with HL. - - PCHL MFill program counter with -X data from HL. - - SPHL MFill stack pointer with -X data from HL. - - XCHG MExchange DE pair with HL -X pair. - 9 K0 - - -W3.5.5 Arithmetic Logic Unit Operations - - MI&Snstructions that act upon the single-precision accumulator to -XMperform arithmetic and logic operations are given in the following -Xtable. - - - - - - - 3-19 - - - - - -CP/M Operating System Manual 3.5 Operation Codes - - -=WTable 3-8. Arithmetic Logic Unit Operations - 9 F0 - Form with Example Meaning - Bit Value - - ADD e3 ADD B MAdd register given by e3 to -X Maccumulator without carry. -X Me3 must produce one of A, -X B, C, D, E, H, or L. - - ADC e3 ADC L MAdd register to A with -X carry, e3 as above. - - SUB e3 SUB H MSubtract reg e3 from A -X Mwithout carry, e3 is -X defined as above. - - SBB e3 SBB 2 MSubtract register e3 from A -X Mwith carry, e3 defined as -X above. - - ANA e3 ANA 1+1 MLogical and reg with A, e3 -X as above. - - XRA e3 XRA A MExclusive or with A, e3 as -X above. - - ORA e3 ORA B MLogical or with A, e3 -X defined as above. - - CMP e3 CMP H MCompare register with A, e3 -X as above. - - DAA MDecimal adjust register A -X Mbased upon last arithmetic -X logic unit operation. - - CMA MComplement the bits in -X register A. - - STC Set the carry flag to 1. - - CMC MComplement the carry flag. -X - RLC MRotate bits left, (re)set -X Mcarry as a side effect. -X MHigh-order A bit becomes -X carry. - - RRC MRotate bits right, (re)set -X Mcarry as side effect. -X MLow-order A bit becomes -X carry. - - - - - 3-20 - - - - 9 K0 - -CP/M Operating System Manual 3.5 Operation Codes - - -=WTable 3-8. (continued) - 9 F0 - Form with Example Meaning - Bit Value - - RAL MRotate carry/A register to -X Mleft. Carry is involved -X in the rotate. - - RAR MRotate carry/A register to -X Mright. Carry is involved -X in the rotate. - - DAD e3 DAD B MDouble-precision add -X Mregister pair e3 to HL. -X Me3 must produce B, D, H, -X or SP. - 9 K0 - -W3.5.6 Control Instructions - - MT&She four remaining instructions, categorized as control -Xinstructions, are the following: - - o HLT halts the 8080 processor. - o DI disables the interrupt system. - o EI enables the interrupt system. - o NOP means no operation. - - -W3.6 Error Messages - - MW&Shen errors occur within the assembly-language program, they -XMare listed as single-character flags in the leftmost position of the -XMsource listing. The line in error is also echoed at the console so -XMthat the source listing need not be examined to determine if errors -Xare present. The error codes are listed in the following table. - - -=WTable 3-9. Error Codes - - 9 F0 Error Code Meaning - - D MData error: element in data statement cannot -X be placed in the specified data area. - - E MExpression error: expression is ill-formed -X and cannot be computed at assembly time. - - L MLabel error: label cannot appear in this -X context; might be duplicate label. - - N MNot implemented: features that will appear in -X Mfuture ASM versions. For example, macros are -X recognized, but flagged in this version. - - - 3-21 - - - - 9 K0 - -CP/M Operating System Manual 3.6 Error Messages - - -=WTable 3-9. (continued) - - 9 F0 Error Code Meaning - - O MOverflow: expression is too complicated (too -X Mmany pending operators) to be computed and -X should be simplified. - - P MPhase error: label does not have the same -X Mvalue on two subsequent passes through the -X program. - - R MRegister error: the value specified as a -X Mregister is not compatible with the operation -X code. - - S MSyntax error: statement is not properly -X formed. - - V MValue error: operand encountered in -X expression is improperly formed. - 9 K0 - - MTable 3-10 lists the error messages that are due to terminal -Xerror conditions. - - -=WTable 3-10. Error Messages - - 9 F0 Message Meaning - - NO SOURCE FILE PRESENT - - MThe file specified in the ASM command does -X not exist on disk. - - - NO DIRECTORY SPACE - - MThe disk directory is full; erase files -X that are not needed and retry. - - - SOURCE FILE NAME ERROR - - MImproperly formed ASM filename, for -X example, it is specified with ? fields. - - - SOURCE FILE READ ERROR - - MSource file cannot be read properly by the -X Massembler; execute a TYPE to determine the -X point of error. - - - - 3-22 - - - - 9 K0 - -CP/M Operating System Manual 3.6 Error Messages - - -=WTable 3-10. (continued) - - 9 F0 Message Meaning - - OUTPUT FILE WRITE ERROR - - MOutput files cannot be written properly; -X Mmost likely cause is a full disk, erase and -X retry. - - - CANNOT CLOSE FILE - - MOutput file cannot be closed; check to see -X if disk is write protected. - 9 K0 - - -W3.7 A Sample Session - - MT&She following sample session shows interaction with the -XMassembler and debugger in the development of a simple assembly- -XMlanguage program. The arrow represents a carriage return keystroke. -X - - 9 d0 A>WASM SORT &SAssemble SORT.ASM - -CP/M ASSEMBLER - VER 1.0 - -0015C Next free address -003H USE FACTOR Percent of table used 00 to ff (hexadecimal) -END OF ASSEMBLY - -A>WDIR SORT.* - -&SSORT ASM Source file -SORT BAK Back-up from last edit -SORT PRN Print file (contains tab characters) -SORT HEX Machine code file - -A>WTYPE SORT.PRN -&S Source line - - ; SORT PROGRAM IN CP/M ASSEMBLY LANGUAGE - ; START AT THE BEGINNING OF THE TRANSIENT - PROGRAM AREA - -Machine code location -0100 ORG 100H - -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 - - - 3-23 - - - - - -CP/M Operating System Manual 3.7 A Sample Session - - - ; - ; 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>WTYPE SORT.HEX &SEquate value - -:10010000214601360121470136007EFE09D2190140 -:100110002146017EB7C20001FF5F16002148011988 Machine code in -:10012000194E79234623965778239EDA3F01B2CAA7 HEX format - -:100130003F0156702B5E712B722B732146013421C7 -:07014000470134C30A01006E Machine code in -:10014800050064001E00320014000700E8032C01BB HEX format -:0401580064000180BE -:0000000000 - - 3-24 - - - - - -CP/M Operating System Manual 3.7 A Sample Session - - -A>WDDT SORT.HEX &SStart debug run - -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 10U16D 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 - - - 3-25 - - - - - -CP/M Operating System Manual 3.7 A Sample Session - - -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>WDDT SORT.HEX &SReload 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 - - - 3-26 - - - - - -CP/M Operating System Manual 3.7 A Sample Session - - - - 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>WDDT SORT.COM &SRestart 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>WED SORT.ASM &SMake 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 - - - - - 3-27 - - - - - -CP/M Operating System Manual 3.7 A Sample Session - - -*- 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>WASM SORT.AAZ &SSkip PRN file - -CP/M ASSEMBLER - VER 1.0 - -015C Next address to assemble -003H USE FACTOR -END OF ASSEMBLY - -A>WDDT SORT.HEX &STest 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. - 9 K0 - -=End of Section 3 - - - - - - - - - 3-28 - - - - - - - - -W Section 4 - -W CP/M Dynamic Debugging Tool - - - -&SW4.1 Introduction - - MThe DDT program allows dynamic interactive testing and -XMdebugging of programs generated in the CP/M environment. Invoke the -Xdebugger with a command of one of the following forms: - - DDT - DDT filename.HEX - DDT filename.COM - -Mwhere filename is the name of the program to be loaded and tested. -XMIn both cases, the DDT program is brought into main memory in place -XMof the Console Command Processor (CCP) and resides directly below -XMthe Basic Disk Operating System (BDOS) portion of CP/M. Refer to -XMSection 5 for standard memory organization. The BDOS starting -XMaddress, located in the address field of the JMP instruction at -XMlocation 5H, is altered to reflect the reduced Transient Program -XArea (TPA) size. - - MThe second and third forms of the DDT command perform the same -XMactions as the first, except there is a subsequent automatic load of -XMthe specified HEX or COM file. The action is identical to the -Xfollowing sequence of commands: - - DDT - Ifilename.HEX or Ifilename.COM - R - -Mwhere the I and R commands set up and read the specified program to -XMtest. See the explanation of the I and R commands below for exact -Xdetails. - - Upon initiation, DDT prints a sign-on message in the form: - - DDT VER m.m - -where m.m is the revision number. - - MFollowing the sign-on message, DDT prompts you with the hyphen -XMcharacter, -, and waits for input commands from the console. You -XMcan type any of several single-character commands, followed by a -XMcarriage return to execute the command. Each line of input can be -Xline-edited using the following standard CP/M controls: - - - - - - - - - 4-1 - - - - - -CP/M Operating System Manual 4.1 Introduction - - -=WTable 4-1. Line-editing Controls - 9 F0 - Control Result - - rubout removes the last character typed - - CTRL-U removes the entire line, ready for retyping - - CTRL-C reboots system - 9 K0 - - MAny command can be up to 32 characters in length. An automatic -XMcarriage return is inserted as character 33, where the first -XMcharacter determines the command type. Table 4-2 describes DDT -Xcommands. - - -W Table 4-2. DDT Commands - - Command Result - Character - - 9 C0 A Menters assembly-language mnemonics with -X operands. - - D displays memory in hexadecimal and ASCII. - - F fills memory with constant data. - - G Mbegins execution with optional breakpoints. -X - I Msets up a standard input File Control -X Block. - - L lists memory using assembler mnemonics. - - M Mmoves a memory segment from source to -X destination. - - R reads a program for subsequent testing. - - S substitutes memory values. - - T traces program execution. - - U untraced program monitoring. - - X Mexamines and optionally alters the CPU -X state. - 9 K0 - -MThe command character, in some cases, is followed by zero, one, two, -XMor three hexadecimal values, which are separated by commas or single -XMblank characters. All DDT numeric output is in hexadecimal form. -XMThe commands are not execution until the carriage return is typed at -Xthe end of the command. - - - 4-2 - - - - -CP/M Operating System Manual 4.1 Introduction - - - MAt any point in the debug run, you can stop execution of DDT by -XMusing either a CTRL-C or G0 (jump to location 0000H) and save the -Xcurrent memory image by using a SAVE command of the form: - - SAVE n filename. COM - -Mwhere n is the number of pages (256 byte blocks) to be saved on -XMdisk. The number of blocks is determined by taking the high-order -XMbyte of the address in the TPA and converting this number to -XMdecimal. For example, if the highest address in the TPA is 134H, -XMthe number of pages is 12H or 18 in decimal. You could type a CTRL- -XC during the debug run, returning to the CCP level, followed by - - SAVE 18 X.COM - -MThe memory image is saved as X.COM on the disk and can be directly -XMexecuted by typing the name X. If further testing is required, the -Xmemory image can be recalled by typing - - DDT X.COM - -Mwhich reloads the previously saved program from location 100H -XMthrough page 18, 23FFH. The CPU state is not a part of the COM -XMfile; thus, the program must be restarted from the beginning to test -Xit properly. - - -W4.2 DDT Commands - - MThe individual commands are detailed below. In each case, the -XMoperator must wait for the hyphen prompt character before entering -XMthe command. If control is passed to a program under test, and the -XMprogram has not reached a breakpoint, control can be returned to DDT -XMby executing a RST 7 from the front panel. In the explanation of -XMeach command, the command letter is shown in some cases with numbers -XMseparated by commas, the the numbers are represented by lower-case -XMletters. These numbers are always assumed to be in a hexadecimal -XMradix and from one to four digits in length. Longer numbers are -Xautomatically truncated on the right. - - MMany of the commands operate upon a CPU state that corresponds -XMto the program under test. The CPU state holds the registers of the -XMprogram being debugged and initially contains zeros for all -XMregisters and flags except for the program counter, P, and stack -XMpointer, S, which default to 100H. The program counter is -XMsubsequently set to the starting address given in the last record of -XMa HEX file if a file of this form is loaded, see the I and R -Xcommands. - - -W4.2.1 The A (Assembly) Command - - MDDT allows in-line assembly language to be inserted into the -Xcurrent memory image using the A command, which takes the form: - - - - 4-3 - - - - - -CP/M Operating System Manual 4.2 DDT Commands - - - As - -Mwhere s is the hexadecimal starting address for the in-line -XMassembly. DDT prompts the console with the address of the next -XMinstruction to fill and reads the console, looking for assembly- -XMlanguage mnemonics followed by register references and operands in -XMabsolute hexadecimal form. See the EIntel 8080 Assembly LanguageR -XMReference CardR for a list of mnemonics. Each successive load -XMaddress is printed before reading the console. The A command -Xterminates when the first empty line is input from the console. - - MUpon completion of assembly language input, you can review the -Xmemory segment using the DDT disassembler (see the L command). - - MNote that the assembler/disassembler portion of DDT can be -XMoverlaid by the transient program being tested, in which case the -XMDDT program responds with an error condition when the A and L -Xcommands are used. - - -W4.2.2 The D (Display) Command - - MThe D command allows you to view the contents of memory in -Xhexadecimal and ASCII formats. The D command takes the forms: - - D - Ds - Ds,f - - MIn the first form, memory is displayed from the current display -XMaddress, initially 100H, and continues for 16 display lines. Each -Xdisplay line takes the followng form: - -aaaa bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb cccccccccccccccc - -Mwhere aaaa is the display address in hexadecimal and bb represents -XMdata present in memory starting at aaaa. The ASCII characters -XMstarting at aaaa are to the right (represented by the sequence of -XMcharacter c) where nongraphic characters are printed as a period. -XMYou should note that both upper- and lower-case alphabetics are -XMdisplayed, and will appear as upper-case symbols on a console device -XMthat supports only upper-case. Each display line gives the values -XMof 16 bytes of data, with the first line truncated so that the next -Xline begins at an address that is a multiple of 16. - - MThe second form of the D command is similar to the first, -Xexcept that the display address is first set to address s. - - MThe third form causes the display to continue from address s -XMthrough address f. In all cases, the display address is set to the -XMfirst address not displayed in this command, so that a continuing -XMdisplay can be accomplished by issuing successive D commands with no -Xexplicit addresses. - - - - - 4-4 - - - - - -CP/M Operating System Manual 4.2 DDT Commands - - - MExcessively long displays can be aborted by pressing the return -Xkey. - - -W4.2.3 The F (Fill) Command - - The F command takes the form: - - Fs,f,c, - -Mwhere s is the starting address, f is the final address, and c is a -XMhexadecimal byte constant. DDT stores the constant c at address s, -XMincrements the value of s and test against f. If s exceeds f, the -XMoperation terminates, otherwise the operation is repeated. Thus, -XMthe fill command can be used to set a memory block to a specific -Xconstant value. - - -W4.2.4 The G (Go) Command - - MA program is executed using the G command, with up to two -Xoptional breakpoint addresses. The G command takes the forms: - - - G - Gs - Gs,b - Gs,b,c - G,b - G,b,c - - - MThe first form executes the program at the current value of the -XMprogram counter in the current machine state, with no breakpoints -XMset. The only way to regain control in DDT is through a RST 7 -XMexecution. The current program counter can be viewed by typing an X -Xor XP command. - - MThe second form is similar to the first, except that the -XMprogram counter in the current machine state is set to address s -Xbefore execution begins. - - MThe third form is the same as the second, except that program -XMexecution stops when address b is encountered (b must be in the area -XMof the program under test). The instruction at location b is not -Xexecuted when the breakpoint is encountered. - - MThe fourth form is identical to the third, except that two -XMbreakpoints are specified, one at b and the other at c. -XMEncountering either breakpoint causes execution to stop, and both -XMbreakpoints are cleared. The last two forms take the program -XMcounter from the current machine state and set one and two -Xbreakpoints, respectively. - - - - - 4-5 - - - - - -CP/M Operating System Manual 4.2 DDT Commands - - - MExecution continues from the starting address in real-time to -XMthe next breakpoint. There is no intervention between the starting -XMaddress and the break address by DDT. If the program under test -XMdoes not reach a breakpoint, control cannot return to DDT without -XMexecuting a RST 7 instruction. Upon encountering a breakpoint, DDT -Xstops execution and types - - *d - -Mwhere d is the stop address. The machine state can be examined at -XMthis point using the X (Examine) command. You must specify -XMbreakpoints that differ from the program counter address at the -XMbeginning of the G command. Thus, if the current program counter is -X1234H, then the following commands: - - G,1234 - G400,400 - -Mboth produce an immediate breakpoint without executing any -Xinstructions. - - -W4.2.5 The I (Input) Command - - MThe I command allows you to insert a filename into the default -XMFile Control Block (FCB) at 5CH. The FCB created by CP/M for -XMtransient programs is placed at this location (see Section 5). The -XMdefault FCB can be used by the program under test as if it had been -XMpassed by the CP/M Console Processor. Note that this filename is -XMalso used by DDT for reading additional HEX and COM files. The I -Xcommand takes the forms: - - Ifilename - Ifilename.typ - - MIf the second form is used and the filetype is either HEX or -XMCOM, subsequent R commands can be used to read the pure binary or -Xhex format machine code. Section 4.2.8 gives further details. - - -W4.2.6 The L (List) Command - - MThe L command is used to list assembly-language mnemonics in a -Xparticular program region. The L command takes the forms: - - L - Ls - Ls,f - - MThe first form lists twelve lines of disassembled machine code -XMfrom the current list address. The second form sets the list -XMaddress to s and then lists twelve lines of code. The last form -XMlists disassembled code from s through address f. In all three -XMcases, the list address is set to the next unlisted location in -XMpreparation for a subsequent L command. Upon encountering an - - - 4-M6 - - - -X - -CP/M Operating System Manual 4.2 DDT Commands - - -Mexecution breakpoint, the list address is set to the current value -XMof the program counter (G and T commands). Again, long typeouts can -Xbe aborted by pressing RETURN during the list process. - - -W4.2.7 The M (Move) Command - - MThe M command allows block movement of program or data areas -XMfrom one location to another in memory. The M command takes the -Xform: - - Ms,f,d - -Mwhere s is the start address of the move, f is the final address, -XMand d is the destination address. Data is first removed from s to -XMd, and both addresses are incremented. If s exceeds f, the move -Xoperation stops; otherwise, the move operation is repeated. - - -W4.2.8 The R (Read) Command - - MThe R command is used in conjunction with the I command to read -XMCOM and HEX files from the disk into the transient program area in -Xpreparation for the debug run. The R command takes the forms: - - R - RB - -Mwhere b is an optional bias address that is added to each program or -XMdata address as it is loaded. The load operation must not overwrite -XMany of the system parameters from 000H through 0FFH (that is, the -XMfirst page of memory). If b is omitted, then b=0000 is assumed. -XMThe R command requires a previous I command, specifying the name of -XMa HEX or COM file. The load address for each record is obtained -XMfrom each individual HEX record, while an assumed load address of -XM100H is used for COM files. Note that any number of R commands can -XMbe issued following the I command to reread the program under test, -XMassuming the tested program does not destroy the default area at -XM5CH. Any file specified with the filetype COM is assumed to contain -XMmachine code in pure binary form (created with the LOAD or SAVE -XMcommand), and all others are assumed to contain machine code in -XIntel hex format (produced, for example, with the ASM command). - - Recall that the command, - - DDT filename.filetype - -which initiates the DDT program, equals to the following commands: - - DDT - -Ifilename.filetype - -R - - - - - - 4-7 - - - - - -CP/M Operating System Manual 4.2 DDT Commands - - - - MWhenever the R command is issued, DDT responds with either the -XMerror indicator ? (file cannot be opened, or a checksum error -XMoccurred in a HEX file) or with a load message. The load message -Xtakes the form: - - NEXT PC - nnnn pppp - -Mwhere nnnn is the next address following the loaded program and pppp -XMis the assumed program counter (100H for COM files, or taken from -Xthe last record if a HEX file is specified). - - -W4.2.9 The S (Set) Command - - MThe S command allows memory locations to be examined and -Xoptionally altered. The S command takes the form: - - Ss - -Mwhere s is the hexadecimal starting address for examination and -XMalteration of memory. DDT responds with a numeric prompt, giving -XMthe memory location, along with the data currently held in memory. -XMIf you type a carriage return, the data is not altered. If a byte -XMvalue is typed, the value is stored at the prompted address. In -XMeither case, DDT continues to prompt with successive addresses and -XMvalues until you type either a period or an invalid input value is -Xdetected. - - -W4.2.10 The T (Trace) Command - - MThe T command allows selective tracing of program execution for -X1 to 65535 program steps. The T command takes the forms: - - T - Tn - - MIn the first form, the CPU state is displayed and the next -XMprogram step is executed. The program terminates immediately, with -Xthe termination address displayed as - - *hhhh - -Mwhere hhhh is the next address to execute. The display address -XM(used in the D command) is set to the value of H and L, and the list -XMaddress (used in the L command) is set to hhhh. The CPU state at -Xprogram termination can then be examined using the X command. - - MThe second form of the T command is similar to the first, -XMexcept that execution is traced for n steps (n is a hexadecimal -XMvalue) before a program breakpoint occurs. A breakpoint can be -XMforced in the trace mode by typing a rubout character. The CPU -XMstate is displayed before each program step is taken in trace mode. -XMThe format of the display is the same as described in the X command. -X - - 4-8 - - - - -CP/M Operating System Manual 4.2 DDT Commands - - - MYou should note that program tracing is discontinued at the -XMCP/M interface and resumes after return from CP/M to the program -XMunder test. Thus, CP/M functions that access I/O devices, such as -XMthe disk drive, run in real-time, avoiding I/O timing problems. -XMPrograms running in trace mode execute approximately 500 times -XMslower than real-time because DDT gets control after each user -XMinstruction is executed. Interrupt processing routines can be -XMtraced, but commands that use the breakpoint facility (G, T, and U) -XMaccomplish the break using an RST 7 instruction, which means that -XMthe tested program cannot use this interrupt location. Further, the -XMtrace mode always runs the tested program with interrupts enabled, -XMwhich may cause problems if asynchronous interrupts are received -Xduring tracing. - - MTo get control back to DDT during trace, press RETURN rather -XMthan executing an RST 7. This ensures that the trace for current -Xinstruction is completed before interruption. - - -W4.2.11 The U (Untrace) Command - - MThe U command is identical to the T command, except that -XMintermediate program steps are not displayed. The untrace mode -XMallows from 1 to 65535, (0FFFFH) steps to be executed in monitored -XMmode and is used principally to retain control of an executing -XMprogram while it reaches steady state conditions. All conditions of -Xthe T command apply to the U command. - - -W4.2.12 The X (Examine) Command - - MThe X command allows selective display and alteration of the -XMcurrent CPU state for the program under test. The X command takes -Xthe forms: - - X - Xr - -Mwhere r is one of the 8080 CPU registers listed in the following -Xtable. - - -W Table 4-3. CPU Registers - - Register Meaning Value - - 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) - - - - 4-9 - - - - - -CP/M Operating System Manual 4.2 DDT Commands - - -W Table 4-3. (continued) - - Register Meaning Value - - H HL register pair (0-FFFF) - S Stack pointer (0-FFFF) - P Program counter (0-FFFF) - - -MIn the first case, the CPU register state is displayed in the -Xformat: - - CfZfMfEflf A=bb B=dddd D=dddd H=dddd S=dddd P=dddd inst - -Mwhere f is a 0 or 1 flag value, bb is a byte value, and dddd is a -XMdouble-byte quantity corresponding to the register pair. The inst -XMfield contains the disassembled instruction, that occurs at the -Xlocation addressed by the CPU state's program counter. - - MThe second form allows display and optional alteration of -XMregister values, where r is one of the registers given above (C, Z, -XMM, E, I, A, B, D, H, S, or P). In each case, the flag or register -XMvalue is first displayed at the console. The DDT program then -XMaccepts input from the console. If a carriage return is typed, the -XMflag or register value is not altered. If a value in the proper -XMrange is typed, the flag or register value is altered. You should -XMnote that BC, DE, and HL are displayed as register pairs. Thus, you -XMmust type the entire register pair when B, C, or the BC pair is -Xaltered. - - -W4.3 Implementation Notes - - MThe organization of DDT allows certain nonessential portions to -XMbe overlaid to gain a larger transient program area for debugging -XMlarge programs. The DDT program consists of two parts: the DDT -XMnucleus and the assembler/disassembler module. The DDT nucleus is -XMloaded over the CCP and, although loaded with the DDT nucleus, the -XMassembler/disassembler is overlayable unless used to assemble or -Xdisassemble. - - MIn particular, the BDOS address at location 6H (address field -XMof the JMP instruction at location 5H) is modified by DDT to address -XMthe base location of the DDT nucleus, which, in turn, contains a JMP -XMinstruction to the BDOS. Thus, programs that use this address field -XMto size memory see the logical end of memory at the base of the DDT -Xnucleus rather than the base of the BDOS. - - MThe assembler/disassembler module resides directly below the -XMDDT nucleus in the transient program area. If the A, L, T, or X -XMcommands are used during the debugging process, the DDT program -XMagain alters the address field at 6H to include this module, further -XMreducing the logical end of memory. If a program loads beyond the -XMbeginning of the assembler/disassembler module, the A and L commands -XMare lost (their use produces a ? in response) and the trace and - - - 4-M10 - - - -X - -CP/M Operating System Manual 4.3 Implementation Notes - - -Mdisplay (T and X) commands list the inst field of the display in -Xhexadecimal, rather than as a decoded instruction. - - -W4.4 A Sample Program - - MThe following example shows an edit, assemble, and debug for a -XMsimple program that reads a set of data values and determines the -XMlargest value in the set. The largest value is taken from the -Xvector and stored into LARGE at the termination of the program. - 9 U0 - -A>WED SCAN.ASM &SCreate 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 - - - - - - - - - - - - - - - - - - 4-11 - - - - - -CP/M Operating System Manual 4.4 A Sample Program - - -^-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>WASM SCAN &SStart Assembler - -CP/M ASSEMBLER - VER 1.0 - -0122 -002H USE FACTOR -END OF ASSEMBLY Assembly complete; lock at program listing - -A>WTYPE SCAN.PRN -&S 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 - - - - - - - - - - 4-12 - - - - - -CP/M Operating System Manual 4.4 A Sample Program - - - 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>WDDT SCAN.HEX &SStart 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 - - - - - - - - - - - 4-13 - - - - - -CP/M Operating System Manual 4.4 A Sample Program - - - 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 .................. - - - 4-14 - - - - - -CP/M Operating System Manual 4.4 A Sample Program - - -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 - - - 4-15 - - - - - -CP/M Operating System Manual 4.4 A Sample Program - - -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>WSAVE 1 SCAN.COM &SProgram resides on first - page, so save 1 page. -A>WDDT SCAN.COM -&S 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 - - - 4-16 - - - - - -CP/M Operating System Manual 4.4 A Sample Program - - -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 _. 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 - - - 4-17 - - - - - -CP/M Operating System Manual 4.4 A Sample Program - - - 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 - - - 4-18 - - - - - -CP/M Operating System Manual 4.4 A Sample Program - - - 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>WSAVE 1 SCAN.COM &SSave memory image - -A>WDDT SCAN.COM &SRestart DDT - -DDT VER 1.0 -NEXT PC -0200 0100 --XP - -P=0100 - --L116 - - 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 - - - 4-19 - - - - - -CP/M Operating System Manual 4.4 A Sample Program - - -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>WED SCAN.ASM &SRe-edit the source program, and make both changes - -*NSUB -*0LT - CTRL-Z SUB C ;LARGER VALUE IN C? -*SSUB^|ZCMP^|Z0LT - CMP D ;LARGER VALUE IN C? -* - JNC NFOUND ;JUMP IF LARGER VALUE NOT FOUND -*SNC^|ZC^|Z0LT - JC NFOUND ;JUMP IF LARGER VALUE NOT FOUND -*E - Reassemble, selecting source from disk A -A>WASM SCAN.AAZ &S<--- 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>WDDT SCAN.HEX &SRerun 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 .'...)........ - - - 4-20 - - - - - -CP/M Operating System Manual 4.4 A Sample Program - - -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. - 9 K0 - -=End of Section 4 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 4-21 - - - - - - - - -=WSection 5 - -=&SWCP/M 2 System Interface - - -&S5.1 Introduction - - 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. - - 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. - - 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. - - - - High - Memory FDOS (BDOS+BIOS) - FBASE: - - CCP - CBASE: - - TPA - TBASE: - - System Parameters - BOOT: - - -=WFigure 5-1. CP/M Memory Organization - - - - M&SThe exact memory addresses corresponding to BOOT, TBASE, CBASE, -XMand FBASE vary from version to version and are described fully in -XMSection 6. All standard CP/M versions assume BOOT=0000H, which is -XMthe base of random access memory. The machine code found at - - - 5-M1 - - - -X - -CP/M Operating System Manual 5.1 Introduction - - -Mlocation BOOT performs a system warm start, which loads and -XMinitializes the programs and variables necessary to return control -XMto the CCP. Thus, transient programs need only jump to location -XMBOOT to return control to CP/M at the command level. Further, the -XMstandard versions assume TBASE=BOOT+0100H, which is normally -XMlocation 0100H. The principal entry point to the FDOS is at -XMlocation BOOT+0005H (normally 0005H) where a jump to FBASE is found. -XMThe address field at BOOT+0006H (normally 0006H) contains the value -XMof FBASE and can be used to determine the size of available memory, -Xassuming that the CCP is being overlaid by a transient program. - - MTransient programs are loaded into the TPA and executed as -XMfollows. The operator communicates with the CCP by typing command -XMlines following each prompt. Each command line takes one of the -Xfollowing forms: - - command - command file1 - command file1 file2 - -Mwhere command is either a built-in function, such as DIR or TYPE, or -XMthe name of a transient command or program. If the command is a -XMbuilt-in function of CP/M, it is executed immediately. Otherwise, -XMthe CCP searches the currently addressed disk for a file by the name -X - command.COM - - MIf the file is found, it is assumed to be a memory image of a -XMprogram that executes in the TPA and thus implicity originates at -XMTBASE in memory. The CCP loads the COM file from the disk into -Xmemory starting at TBASE and can extend up to CBASE. - - MIf the command is followed by one or two file specifications, -XMthe CCP prepares one or two File Control Block (FCB) names in the -XMsystem parameter area. These optional FCBs are in the form -XMnecessary to access files through the FDOS and are described in -XSection 5.2. - - MThe transient program receives control from the CCP and begins -XMexecution, using the I/O facilities of the FDOS. The transient -XMprogram is called from the CCP. Thus, it can simply return to the -XMCCP upon completion of its processing, or can jump to BOOT to pass -XMcontrol back to CP/M. In the first case, the transient program must -XMnot use memory above CBASE, while in the latter case, memory up -Xthrough FBASE-1 can be used. - - MThe transient program can use the CP/M I/O facilities to -XMcommunicate with the operator's console and peripheral devices, -XMincluding the disk subsystem. The I/O system is accessed by passing -XMa function number and an information address to CP/M through the -XMFDOS entry point at BOOT+0005H. In the case of a disk read, for -XMexample, the transient program sends the number corresponding to a -XMdisk read, along with the address of an FCB to the CP/M FDOS. The -XMFDOS, in turn, performs the operation and returns with either a disk -XMread completion indication or an error number indicating that the - - - 5-M2 - - - -X - -CP/M Operating System Manual 5.1 Introduction - - -disk read was unsuccessful. - - -W5.2 Operating System Call Conventions - - MT&Shis section provides detailed information for performing -XMdirect operating system calls from user programs. Many of the -XMfunctions listed below, however, are accessed more simply through -XMthe I/O macro library provided with the MAC macro assembler and -XMlisted in the Digital Research manual entitled, EProgrammer'sR -XUtilities Guide for the CP/M Family of Operating Systems. - - MRCP/M facilities that are available for access by transient -XMprograms fall into two general categories: simple device I/O and -Xdisk file I/O. The simple device operations are - - o read a console character - o write a console character - o read a sequential character - o write a sequential character - o get or set I/O status - o print console buffer - o interrogate console ready - - The following FDOS operations perform disk I/O: - - o disk system reset - o drive selection - o file creation - o file close - o directory search - o file delete - o file rename - o random or sequential read - o random or sequential write - o interrogate available disks - o interrogate selected disk - o set DMA address - o set/reset file indicators. - - MAs mentioned above, access to the FDOS functions is -XMaccomplished by passing a function number and information address -XMthrough the primary point at location BOOT+0005H. In general, the -XMfunction number is passed in register C with the information address -XMin the double byte pair DE. Single byte values are returned in -XMregister A, with double byte values returned in HL, a zero value is -XMreturned when the function number is out of range. For reasons of -XMcompatibility, register A = L and register B = H upon return in all -XMcases. Note that the register passing conventions of CP/M agree -XMwith those of the Intel PL/M systems programming language. CP/M -Xfunctions and their numbers are listed below. - - - - - - - 5-3 - - - - - -CP/M Operating System Manual 5.2 Call Conventions - - - 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 - - - MFunctions 28 and 32 should be avoided in application programs -Xto maintain upward compatibility with CP/M. - - MUpon entry to a transient program, the CCP leaves the stack -XMpointer set to an eight-level stack area with the CCP return address -XMpushed onto the stack, leaving seven levels before overflow occurs. -XMAlthough this stack is usually not used by a transient program (most -XMtransients return to the CCP through a jump to location 0000H) it is -XMlarge enough to make CP/M system calls because the FDOS switches to -XMa local stack at system entry. For example, the assembly-language -XMprogram segment below reads characters continuously until an -XMasterisk is encountered, at which time control returns to the CCP, -Xassuming a standard CP/M system with BOOT = 0000H. - - - 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 - CPI '*' ;END OF PROCESSING? - JNZ NEXTC ;LOOP IF NOT - RET ;RETURN TO CCP - END - - - MCP/M implements a named file structure on each disk, providing -XMa logical organization that allows any particular file to contain -XMany number of records from completely empty to the full capacity of -XMthe drive. Each drive is logically distinct with a disk directory -XMand file data area. The disk filenames are in three parts: the -XMdrive select code, the filename (consisting of one to eight nonblank - - - 5-M4 - - - -X - -CP/M Operating System Manual 5.2 Call Conventions - - -Mcharacters), and the filetype (consisting of zero to three nonblank -XMcharacters). The filetype names the generic category of a -XMparticular file, while the filename distinguishes individual files -XMin each category. The filetypes listed in Table 5-1 name a few -XMgeneric categories that have been established, although they are -Xsomewhat arbitrary. - - -W Table 5-1. CP/M Filetypes - - &S Filetype Meaning - - ASM Assembler Source - PRN Printer Listing - HEX Hex Machine Code - BAS Basic Source File - INT Intermediate Code - COM Command File - PLI PL/I Source File - REL Relocatable Module - TEX TEX Formatter Source - BAK ED Source Backup - SYM SID Symbol File - $$$ Temporary File - - - MSource files are treated as a sequence of ASCII characters, -XMwhere each line of the source file is followed by a carriage return, -XMand line-feed sequence (0DH followed by 0AH). Thus, one 128-byte -XMCP/M record can contain several lines of source text. The end of an -XMASCII file is denoted by a CTRL-Z character (1AH) or a real end-of- -XMfile returned by the CP/M read operation. CTRL-Z characters -XMembedded within machine code files (for example, COM files) are -XMignored and the end-of-file condition returned by CP/M is used to -Xterminate read operations. - - MFiles in CP/M can be thought of as a sequence of up to 65536 -XMrecords of 128 bytes each, numbered from 0 through 65535, thus -XMallowing a maximum of 8 megabytes per file. Note, however, that -XMalthough the records may be considered logically contiguous, they -XMmay not be physically contiguous in the disk data area. Internally, -XMall files are divided into 16K byte segments called logical extents, -XMso that counters are easily maintained as 8-bit values. The -XMdivision into extents is discussed in the paragraphs that follow: -XMhowever, they are not particularly significant for the programmer, -XMbecause each extent is automatically accessed in both sequential and -Xrandom access modes. - - MIn the file operations starting with Function 15, DE usually -XMaddresses a FCB. Transient programs often use the default FCB area -XMreserved by CP/M at location BOOT+005CH (normally 005CH) for simple -XMfile operations. The basic unit of file information is a 128-byte -XMrecord used for all file operations. Thus, a default location for -XMdisk I/O is provided by CP/M at location BOOT+0080H (normally 0080H) -Xwhich is the initial default DMA address. See Function 26. - - - 5-5 - - - - - -CP/M Operating System Manual 5.2 Call Conventions - - - - MAll directory operations take place in a reserved area that -XMdoes not affect write buffers as was the case in release 1, with the -XMexception of Search First and Search Next, where compatibility is -Xrequired. - - MThe FCB data area consists of a sequence of 33 bytes for -XMsequential access and a series of 36 bytes in the case when the file -XMis accessed randomly. The default FCB, normally located at 005CH, -XMcan be used for random access files, because the three bytes -XMstarting at BOOT+007DH are available for this purpose. Figure 5-2 -Xshows the FCB format with the following fields. - - - - 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 - - -W Figure 5-2. File Control Block Format - - - -MThe following table lists and describes each of the fields in the -XFile Control Block figure. - - -W Table 5-2. File Control Block Fields - - Field Definition - - 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. - - f1...f8 contain the filename in ASCII - upper-case, with high bit = 0 - - 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 - - ex contains the current extent - number, normally set to 00 by - the user, but in range 0-31 - during file I/O - - - - 5-6 - - - - - -CP/M Operating System Manual 5.2 Call Conventions - - -W Table 5-2. (continued) - -&S Field Definition - - s1 reserved for internal system use - - s2 reserved for internal system use, - set to zero on call to OPEN, MAKE, - SEARCH - - rc record count for extent ex; - takes on values from 0-127 - - d0...dn filled in by CP/M; reserved for - system use - - cr current record to read or write in - a sequential file operation; - normally set to zero by user - - 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 - - - MEach file being accessed through CP/M must have a corresponding -XMFCB, which provides the name and allocation information for all -XMsubsequent file operations. When accessing files, it is the -XMprogrammer's responsibility to fill the lower 16 bytes of the FCB -XMand initialize the cr field. Normally, bytes 1 through 11 are set -XMto the ASCII character values for the filename and filetype, while -Xall other fields are zero. - - MFCBs are stored in a directory area of the disk, and are -XMbrought into central memory before the programmer proceeds with file -XMoperations (see the OPEN and MAKE functions). The memory copy of -XMthe FCB is updated as file operations take place and later recorded -XMpermanently on disk at the termination of the file operation, (see -Xthe CLOSE command). - - MThe CCP constructs the first 16 bytes of two optional FCBs for -XMa transient by scanning the remainder of the line following the -XMtransient name, denoted by file1 and file2 in the prototype command -XMline described above, with unspecified fields set to ASCII blanks. -XMThe first FCB is constructed at location BOOT+005CH and can be used -XMas is for subsequent file operations. The second FCB occupies the -XMd0...dn portion of the first FCB and must be moved to another area -XMof memory before use. If, for example, the following command line -Xis typed: - - PROGNAME B:X.ZOT Y.ZAP - - - - - 5-7 - - - - - -CP/M Operating System Manual 5.2 Call Conventions - - -Mthe file PROGNAME.COM is loaded into the TPA, and the default FCB at -XMBOOT+005CH is initialized to drive code 2, filename X, and filetype -XMZOT. The second drive code takes the default value 0, which is -XMplaced at BOOT-006CH, with the filename Y placed into location -XMBOOT+006DH and filetype ZAP located 8 bytes later at BOOT+0075H. -XMAll remaining fields through cr are set to zero. Note again that it -XMis the programmer's responsibility to move this second filename and -XMfiletype to another area, usually a separate file control block, -XMbefore opening the file that begins at BOOT+005CH, because the open -Xoperation overwrites the second name and type. - - MIf no filenames are specified in the original command, the -XMfields beginning at BOOT+005DH and BOOT+006DH contain blanks. In -XMall cases, the CCP translates lower-case alphabetics to upper-case -Xto be consistent with the CP/M file naming conventions. - - MAs an added convenience, the default buffer area at location -XMBOOT+0080H is initialized to the command line tail typed by the -XMoperator following the program name. The first position contains -XMthe number of characters, with the characters themselves following -XMthe character count. Given the above command line, the area -Xbeginning at BOOT+0080H is initialized as follows: - - - BOOT+0080H: - - +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' - - -Mwhere the characters are translated to upper-case ASCII with -XMuninitialized memory following the last valid character. Again, it -XMis the responsibility of the programmer to extract the information -XMfrom this buffer before any file operations are performed, unless -Xthe default DMA address is explicitly changed. - - MIndividual functions are described in detail in the pages that -Xfollow. - - - - - - - - - - - - - - - - - - - - 5-8 - - - - - -CP/M Operating System Manual 5.2 Call Conventions - - - - - - - FUNCTION 0: SYSTEM RESET - - Entry Parameters: - Register C: 00H - - - - MThe System Reset function returns control to the CP/M operating -XMsystem at the CCP level. The CCP reinitializes the disk subsystem -XMby selecting and logging-in disk drive A. This function has exactly -Xthe same effect as a jump to location BOOT. - - - - - - - FUNCTION 1: CONSOLE INPUT - - Entry Parameters: - Register C: 01H - - Returned Value: - Register A: ASCII Character - - - - MThe Console Input function reads the next console character to -XMregister A. Graphic characters, along with carriage return, line- -XMfeed, and back space (CTRL-H) are echoed to the console. Tab -XMcharacters, CTRL-I, move the cursor to the next tab stop. A check -XMis made for start/stop scroll, CTRL-S, and start/stop printer echo, -XMCTRL-P. The FDOS does not return to the calling program until a -XMcharacter has been typed, thus suspending execution if a character -Xis not ready. - - - - - - - - - - - - - - - - - - - 5-9 - - - - - -CP/M Operating System Manual 5.2 Call Conventions - - - - - - - FUNCTION 2: CONSOLE OUTPUT - - Entry Parameters - Register C: 02H - Register E: ASCII Character - - - - MThe ASCII character from register E is sent to the console -XMdevice. As in Function 1, tabs are expanded and checks are made for -Xstart/stop scroll and printer echo. - - - - - - - FUNCTION 3: READER INPUT - - Entry Parameters: - Register C: 03H - - Returned Value: - Register A: ASCII Character - - - - MThe Reader Input function reads the next character from the -XMlogical reader into register A. See the IOBYTE definition in -XMChapter 6. Control does not return until the character has been -Xread. - - - - - - - - - - - - - - - - - - - - - - - 5-10 - - - - - -CP/M Operating System Manual 5.2 Call Conventions - - - - - - - FUNCTION 4: PUNCH OUTPUT - - Entry Parameters: - Register C: 04H - register E: ASCII Character - - - - MThe Punch Output function sends the character from register E -Xto the logical punch device. - - - - - - - FUNCTION 5: LIST OUTPUT - - Entry Parameters: - Register C: 05H - Register E: ASCII Character - - - - MThe List Output function sends the ASCII character in register -XE to the logical listing device. - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5-11 - - - - - -CP/M Operating System Manual 5.2 Call Conventions - - - - - - - FUNCTION 6: DIRECT CONSOLE I/O - - Entry Parameters: - Register C: 06H - Register E: 0FFH (input) or - char (output) - - Returned Value: - Register A: char or status - - - - MDirect Console I/O is supported under CP/M for those -XMspecialized applications where basic console input and output are -XMrequired. Use of this function should, in general, be avoided since -XMit bypasses all of the CP/M normal control character functions (for -XMexample, CTRL-S and CTRL-P). Programs that perform direct I/O -XMthrough the BIOS under previous releases of CP/M, however, should be -XMchanged to use direct I/O under BDOS so that they can be fully -Xsupported under future releases of MP/M and CP/M. - - MUpon entry to Function 6, register E either contains -XMhexadecimal FF, denoting a console input request, or an ASCII -XMcharacter. If the input value is FF, Function 6 returns A = 00 if -XMno character is ready, otherwise A contains the next console input -Xcharacter. - - MIf the input value in E is not FF, Function 6 assumes that E -Xcontains a valid ASCII character that is sent to the console. - - MFunction 6 must not be used in conjunction with other console -XI/O functions. - - - - - - - FUNCTION 7: GET I/O BYTE - - Entry Parameters: - Register C: 07H - - Returned Value: - Register A: I/O Byte Value - - - - MThe Get I/O Byte function returns the current value of IOBYTE -Xin register A. See Chapter 6 for IOBYTE definition. - - - - 5-12 - - - - - -CP/M Operating System Manual 5.2 Call Conventions - - - - - - - FUNCTION 8: SET I/O BYTE - - Entry Parameters: - Register C: 08H - Register E: I/O Byte Value - - - - MThe SET I/O Byte function changes the IOBYTE value to that -Xgiven in register E. - - - - - - - FUNCTION 9: PRINT STRING - - Entry Parameters: - Register C: 09H - Registers DE: String Address - - - - MThe Print String function sends the character string stored in -XMmemory at the location given by DE to the console device, until a $ -XMis encountered in the string. Tabs are expanded as in Function 2, -Xand checks are made for start/stop scroll and printer echo. - - - - - - - - - - - - - - - - - - - - - - - - - - 5-13 - - - - - -CP/M Operating System Manual 5.2 Call Conventions - - - - - - - FUNCTION 10: READ CONSOLE BUFFER - - Entry Parameters: - Register C: 0AH - Registers DE: Buffer Address - - Returned Value: - Console Characters in Buffer - - - - MThe Read Buffer functions reads a line of edited console input -XMinto a buffer addressed by registers DE. Console input is -XMterminated when either input buffer overflows or a carriage return -Xor line-feed is typed. The Read Buffer takes the form: - - DE:+0 +1 +2 +3 +4 +5 +6 +7 +8 . . .+n - - mx nc c1 c2 c3 c4 c5 c6 c7 ... ?? - -Mwhere mx is the maximum number of characters that the buffer will -XMhold, 1 to 255, and nc is the number of characters read (set by FDOS -XMupon return) followed by the characters read from the console. If -XMnc < mx, then uninitialized positions follow the last character, -XMdenoted by ?? in the above figure. A number of control functions, -Xsummarized in Table 5-3, are recognized during line editing. - - -W Table 5-3. Edit Control Characters - - Character Edit Control Function - - rub/del removes and echoes the last character - - CTRL-C reboots when at the beginning of line - - CTRL-E causes physical end of line - - CTRL-H backspaces one character position - - CTRL-J (line feed) terminates input line - - CTRL-M (return) terminates input line - - CTRL-R retypes the current line after new line - - CTRL-U removes current line - - CTRL-X same as CTRL-U - - - - - 5-14 - - - - - -CP/M Operating System Manual 5.2 Call Conventions - - -MThe user should also note that certain functions that return the -XMcarriage to the leftmost position (for example, CTRL-X) do so only -XMto the column position where the prompt ended. In earlier releases, -XMthe carriage returned to the extreme left margin. This convention -Xmakes operator data input and line correction more legible. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5-15 - - - - - -CP/M Operating System Manual 5.2 Call Conventions - - - - - - - FUNCTION 11: GET CONSOLE STATUS - - Entry Parameters: - Register C: 0BH - - Returned Value: - Register A: Console Status - - - - MThe Console Status function checks to see if a character has -XMbeen typed at the console. If a character is ready, the value 0FFH -Xis returned in register A. Otherwise a 00H value is returned. - - - - - - - FUNCTION 12: RETURN VERSION NUMBER - - Entry Parameters: - Register C: 0CH - - Returned Value: - Registers HL: Version Number - - - - MFunction 12 provides information that allows version -XMindependent programming. A two-byte value is returned, with H = 00 -XMdesignating the CP/M release (H = 01 for MP/M) and L = 00 for all -XMreleases previous to 2.0. CP/M 2.0 returns a hexadecimal 20 in -XMregister L, with subsequent version 2 releases in the hexadecimal -XMrange 21,22, through 2F. Using Function 12, for example, the user -XMcan write application programs that provide both sequential and -Xrandom access functions. - - - - - - - - - - - - - - - - - 5-16 - - - - - -CP/M Operating System Manual 5.2 Call Conventions - - - - - - - FUNCTION 13: RESET DISK SYSTEM - - Entry Parameters: - Register C: 0DH - - - - MThe Reset Disk function is used to programmatically restore the -XMfile system to a reset state where all disks are set to Read-Write. -XMSee functions 28 and 29, only disk drive A is selected, and the -XMdefault DMA address is reset to BOOT+0080H. This function can be -XMused, for example, by an application program that requires a disk -Xchange without a system reboot. - - - - - - - FUNCTION 14: SELECT DISK - - Entry Parameters: - Register C: 0EH - Register E: Selected Disk - - - - MThe Select Disk function designates the disk drive named in -XMregister E as the default disk for subsequent file operations, with -XME = O for drive A, 1 for drive B, and so on through 15, -XMcorresponding to drive P in a full 16 drive system. The drive is -XMplaced in an on-line status, which activates its directory until the -XMnext cold start, warm start, or disk system reset operation. If the -XMdisk medium is changed while it is on-line, the drive automatically -XMgoes to a Read-Only status in a standard CP/M environment, see -XMFunction 28. FCBs that specify drive code zero (dr = 00H) -XMautomatically reference the currently selected default drive. Drive -XMcode values between 1 and 16 ignore the selected default drive and -Xdirectly reference drives A through P. - - - - - - - - - - - - - - - 5-17 - - - - - -CP/M Operating System Manual 5.2 Call Conventions - - - - - - - FUNCTION 15: OPEN FILE - - Entry Parameters: - Register C: 0FH - Registers DE: FCB Address - - Returned Value: - Register A: Directory Code - - - - MThe Open File operation is used to activate a file that -XMcurrently exists in the disk directory for the currently active user -XMnumber. The FDOS scans the referenced disk directory for a match in -XMpositions 1 through 14 of the FCB referenced by DE (byte s1 is -XMautomatically zeroed) where an ASCII question mark (3FH) matches any -XMdirectory character in any of these positions. Normally, no -XMquestion marks are included, and bytes ex and s2 of the FCB are -Xzero. - - MIf a directory element is matched, the relevant directory -XMinformation is copied into bytes d0 through dn of FCB, thus allowing -XMaccess to the files through subsequent read and write operations. -XMThe user should note that an existing file must not be accessed -XMuntil a successful open operation is completed. Upon return, the -XMopen function returns a directory code with the value 0 through 3 if -XMthe open was successful or 0FFH (255 decimal) if the file cannot be -XMfound. If question marks occur in the FCB, the first matching FCB -XMis activated. Note that the current record, (cr) must be zeroed by -XMthe program if the file is to be accessed sequentially from the -Xfirst record. - - - - - - - - - - - - - - - - - - - - - - - 5-18 - - - - - -CP/M Operating System Manual 5.2 Call Conventions - - - - - - - FUNCTION 16: CLOSE FILE - - Entry Parameters: - Register C: 10H - Registers DE: FCB Address - - Returned Value: - Register A: Directory Code - - - - MThe Close File function performs the inverse of the Open File -XMfunction. Given that the FCB addressed by DE has been previously -XMactivated through an open or make function, the close function -XMpermanently records the new FCB in the reference disk directory see -XMfunctions 15 and 22. The FCB matching process for the close is -XMidentical to the open function. The directory code returned for a -XMsuccessful close operation is 0, 1, 2, or 3, while a 0FFH (255 -XMdecimal) is returned if the filename cannot be found in the -XMdirectory. A file need not be closed if only read operations have -XMtaken place. If write operations have occurred, the close operation -Xis necessary to record the new directory information permanently. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5-19 - - - - - -CP/M Operating System Manual 5.2 Call Conventions - - - - - - - FUNCTION 17: SEARCH FOR FIRST - - Entry Parameters: - Register C: 11H - Registers DE: FCB Address - - Returned Value: - Register A: Directory Code - - - - MSearch First scans the directory for a match with the file -XMgiven by the FCB addressed by DE. The value 255 (hexadecimal FF) is -XMreturned if the file is not found; otherwise, 0, 1, 2, or 3 is -XMreturned indicating the file is present. When the file is found, -XMthe current DMA address is filled with the record containing the -XMdirectory entry, and the relative starting position is A *32 (that -XMis, rotate the A register left 5 bits, or ADD A five times). -XMAlthough not normally required for application programs, the -XMdirectory information can be extracted from the buffer at this -Xposition. - - MAn ASCII question mark (63 decimal, 3F hexadecimal) in any -XMposition from f1 through ex matches the corresponding field of any -XMdirectory entry on the default or auto-selected disk drive. If the -XMdr field contains an ASCII question mark, the auto disk select -XMfunction is disabled and the default disk is searched, with the -XMsearch function returning any matched entry, allocated or free, -XMbelonging to any user number. This latter function is not normally -XMused by application programs, but it allows complete flexibility to -XMscan all current directory values. If the dr field is not a -Xquestion mark, the s2 byte is automatically zeroed. - - - - - - - - - - - - - - - - - - - - - - 5-20 - - - - - -CP/M Operating System Manual 5.2 Call Conventions - - - - - - - FUNCTION 18: SEARCH FOR NEXT - - Entry Parameters: - Register C: 12H - - Returned Value: - Register A: Directory Code - - - - MThe Search Next function is similar to the Search First -XMfunction, except that the directory scan continues from the last -XMmatched entry. Similar to Function 17, Function 18 returns the -Xdecimal value 255 in A when no more directory items match. - - - - - - - FUNCTION 19: DELETE FILE - - Entry Parameters: - Register C: 13H - Registers DE: FCB Address - - Returned Value: - Register A: Directory Code - - - - MThe Delete File function removes files that match the FCB -XMaddressed by DE. The filename and type may contain ambiguous -XMreferences (that is, question marks in various positions), but the -XMdrive select code cannot be ambiguous, as in the Search and Search -XNext functions. - - MFunction 19 returns a decimal 255 if the referenced file or -XMfiles cannot be found; otherwise, a value in the range 0 to 3 -Xreturned. - - - - - - - - - - - - - - 5-21 - - - - - -CP/M Operating System Manual 5.2 Call Conventions - - - - - - - FUNCTION 20: READ SEQUENTIAL - - Entry Parameters: - Register C: 14H - Registers DE: FCB Address - - Returned Value: - Register A: Directory Code - - - - MGiven that the FCB addressed by DE has been activated through -XMan Open or Make function, the Read Sequential function reads the -XMnext 128-byte record from the file into memory at the current DMA -XMaddress. The record is read from position cr of the extent, and the -XMcr field is automatically incremented to the next record position. -XMIf the cr field overflows, the next logical extent is automatically -XMopened and the cr field is reset to zero in preparation for the next -XMread operation. The value 00H is returned in the A register if the -XMread operation was successful, while a nonzero value is returned if -XMno data exist at the next record position (for example, end-of-file -Xoccurs). - - - - - - - FUNCTION 21: WRITE SEQUENTAIL - - Entry Parameters: - Register C: 15H - Registers DE: FCB Address - - Returned Value: - Register A: Directory Code - - - - MGiven that the FCB addressed by DE has been activated through -XMan Open or Make function, the Write Sequential function writes the -XM128-byte data record at the current DMA address to the file named by -XMthe FCB. The record is placed at position cr of the file, and the -XMcr field is automatically incremented to the next record position. -XMIf the cr field overflows, the next logical extent is automatically -XMopened and the cr field is reset to zero in preparation for the next -XMwrite operation. Write operations can take place into an existing -XMfile, in which case, newly written records overlay those that -XMalready exist in the file. Register A = 00H upon return from a -XMsuccessful write operation, while a nonzero value indicates an -Xunsuccessful write caused by a full disk. - - - 5-22 - - - - - -CP/M Operating System Manual 5.2 Call Conventions - - - - - - - FUNCTION 22: MAKE FILE - - Entry Parameters: - Register C: 16H - Registers DE: FCB Address - - Returned Value: - Register A: Directory Code - - - - MThe Make File operation is similar to the Open File operation -XMexcept that the FCB must name a file that does not exist in the -XMcurrently referenced disk directory (that is, the one named -XMexplicitly by a nonzero dr code or the default disk if dr is zero). -XMThe FDOS creates the file and initializes both the directory and -XMmain memory value to an empty file. The programmer must ensure that -XMno duplicate filenames occur, and a preceding delete operation is -XMsufficient if there is any possibility of duplication. Upon return, -XMregister A = 0, 1, 2, or 3 if the operation was successful and 0FFH -XM(255 decimal) if no more directory space is available. The Make -XMfunction has the side effect of activating the FCB and thus a -Xsubsequent open is not necessary. - - - - - - - FUNCTION 23: RENAME FILE - - Entry Parameters: - Register C: 17H - Registers DE: FCB Address - - Returned Value: - Register A: Directory Code - - - - MThe Rename function uses the FCB addressed by DE to change all -XMoccurrences of the file named in the first 16 bytes to the file -XMnamed in the second 16 bytes. The drive code dr at postion 0 is -XMused to select the drive, while the drive code for the new filename -XMat position 16 of the FCB is assumed to be zero. Upon return, -XMregister A is set to a value between 0 and 3 if the rename was -XMsuccessful and 0FFH (255 decimal) if the first filename could not be -Xfound in the directory scan. - - - - - - 5-23 - - - - - -CP/M Operating System Manual 5.2 Call Conventions - - - - - - - FUNCTION 24: RETURN LOG-IN VECTOR - - Entry Parameters: - Register C: 18H - - Returned Value: - Registers HL: Log-in Vector - - - - MThe log-in vector value returned by CP/M is a 16-bit value in -XMHL, where the least significant bit of L corresponds to the first -XMdrive A and the high-order bit of H corresponds to the sixteenth -XMdrive, labeled P. A 0 bit indicates that the drive is not on-line, -XMwhile a 1 bit marks a drive that is actively on-line as a result of -XMan explicit disk drive selection or an implicit drive select caused -XMby a file operation that specified a nonzero dr field. The user -XMshould note that compatibility is maintained with earlier releases, -Xbecause registers A and L contain the same values upon return. - - - - - - - FUNCTION 25: RETURN CURRENT DISK - - Entry Parameters: - Register C: 19H - - Returned Value: - Register A: Current Disk - - - - MFunction 25 returns the currently selected default disk number -XMin register A. The disk numbers range from 0 through 15 -Xcorresponding to drives A through P. - - - - - - - - - - - - - - - - 5-24 - - - - - -CP/M Operating System Manual 5.2 Call Conventions - - - - - - - FUNCTION 26: SET DMA ADDRESS - - Entry Parameters: - Register C: 1AH - Registers DE: DMA Address - - - - MDMA is an acronym for Direct Memory Address, which is often -XMused in connection with disk controllers that directly access the -XMmemory of the mainframe computer to transfer data to and from the -XMdisk subsystem. Although many computer systems use non-DMA access -XM(that is, the data is transferred through programmed I/O -XMoperations), the DMA address has, in CP/M, come to mean the address -XMat which the 128-byte data record resides before a disk write and -XMafter a disk read. Upon cold start, warm start, or disk system -XMreset, the DMA address is automatically set to BOOT+0080H. The Set -XMDMA function can be used to change this default value to address -XManother area of memory where the data records reside. Thus, the DMA -XMaddress becomes the value specified by DE until it is changed by a -XMsubsequent Set DMA function, cold start, warm start, or disk system -Xreset. - - - - - - - FUNCTION 27: GET ADDR (ALLOC) - - Entry Parameters: - Register C: 1BH - - Returned Value: - Registers HL: ALLOC Address - - - - MAn allocation vector is maintained in main memory for each on- -XMline disk drive. Various system programs use the information -XMprovided by the allocation vector to determine the amount of -XMremaining storage (see the STAT program). Function 27 returns the -XMbase address of the allocation vector for the currently selected -XMdisk drive. However, the allocation information might be invalid if -XMthe selected disk has been marked Read-Only. Although this function -XMis not normally used by application programs, additional details of -Xthe allocation vector are found in Chapter 6. - - - - - - - 5-25 - - - - - -CP/M Operating System Manual 5.2 Call Conventions - - - - - - - FUNCTION 28: WRITE PROTECT DISK - - Entry Parameters: - Register C: 1CH - - - - MThe Write Protect Disk function provides temporary write -XMprotection for the currently selected disk. Any attempt to write to -XMthe disk before the next cold or warm start operation produces the -Xmessage: - - BDOS ERR on d:R/O - - - - - - - FUNCTION 29: GET READ-ONLY VECTOR - - Entry Parameters: - Register C: 1DH - - Returned Value: - Registers HL: R/O Vector Value - - - - MFunction 29 returns a bit vector in register pair HL, which -XMindicates drives that have the temporary Read-Only bit set. As in -XMFunction 24, the least significant bit corresponds to drive A, while -XMthe most significant bit corresponds to drive P. The R/O bit is set -XMeither by an explicit call to Function 28 or by the automatic -Xsoftware mechanisms within CP/M that detect changed disks. - - - - - - - - - - - - - - - - - - - 5-26 - - - - - -CP/M Operating System Manual 5.2 Call Conventions - - - - - - - FUNCTION 30: SET FILE ATTRIBUTES - - Entry Parameters: - Register C: 1EH - Registers DE: FCB Address - - Returned Value: - Register A: Directory Code - - - - MThe Set File Attributes function allows programmatic -XMmanipulation of permanent indicators attached to files. In -XMparticular, the R/O and System attributes (t1' and t2') can be set -XMor reset. The DE pair addresses an unambiguous filename with the -XMappropriate attributes set or reset. Function 30 searches for a -XMmatch and changes the matched directory entry to contain the -XMselected indicators. Indicators f1' through f4' are not currently -XMused, but may be useful for applications programs, since they are -XMnot involved in the matching process during file open and close -XMoperations. Indicators f5' through f8' and t3' are reserved for -Xfuture system expansion. - - - - - - - FUNCTION 31: GET ADDR (DISK PARMS) - - Entry Parameters: - Register C: 1FH - - Returned Value: - Registers HL: DPB Address - - - - MThe address of the BIOS resident disk parameter block is -XMreturned in HL as a result of this function call. This address can -XMbe used for either of two purposes. First, the disk parameter -XMvalues can be extracted for display and space computation purposes, -XMor transient programs can dynamically change the values of current -XMdisk parameters when the disk environment changes, if required. -XNormally, application programs will not require this facility. - - - - - - - - - 5-27 - - - - - -CP/M Operating System Manual 5.2 Call Conventions - - - - - - - FUNCTION 32: SET/GET USER CODE - - Entry Parameters: - Register C: 20H - Register E: OFFH (get) or - User Code (set) - - Returned Value: - Register A: Current Code or - (no value) - - - - MAn application program can change or interrogate the currently -XMactive user number by calling Function 32. If register E = 0FFH, -XMthe value of the current user number is returned in register A, -XMwhere the value is in the range of 0 to 15. If register E is not -XM0FFH, the current user number is changed to the value of E, modulo -X16. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5-28 - - - - - -CP/M Operating System Manual 5.2 Call Conventions - - - - - - - FUNCTION 33: READ RANDOM - - Entry Parameters: - Register C: 21H - - Returned Value: - Register A: Return Code - - - - MThe Read Random function is similar to the sequential file read -XMoperation of previous releases, except that the read operation takes -XMplace at a particular record number, selected by the 24-bit value -XMconstructed from the 3-byte field following the FCB (byte positions -XMr0 at 33, r1 at 34, and r2 at 35). The user should note that the -XMsequence of 24 bits is stored with least significant byte first -XM(r0), middle byte next (r1), and high byte last (r2). CP/M does not -XMreference byte r2, except in computing the size of a file (Function -XM35). Byte r2 must be zero, however, since a nonzero value indicates -Xoverflow past the end of file. - - MThus, the r0, r1 byte pair is treated as a double-byte, or word -XMvalue, that contains the record to read. This value ranges from 0 -XMto 65535, providing access to any particular record of the 8- -XMmegabyte file. To process a file using random access, the base -XMextent (extent 0) must first be opened. Although the base extent -XMmight or might not contain any allocated data, this ensures that the -XMfile is properly recorded in the directory and is visible in DIR -XMrequests. The selected record number is then stored in the random -Xrecord field (r0, r1), and the BDOS is called to read the record. - - MUpon return from the call, register A either contains an error -XMcode, as listed below, or the value 00, indicating the operation was -XMsuccessful. In the latter case, the current DMA address contains -XMthe randomly accessed record. Note that contrary to the sequential -XMread operation, the record number is not advanced. Thus, subsequent -Xrandom read operations continue to read the same record. - - MUpon each random read operation, the logical extent and current -XMrecord values are automatically set. Thus, the file can be -XMsequentially read or written, starting from the current randomly -XMaccessed position. However, note that, in this case, the last -XMrandomly read record will be reread as one switches from random mode -XMto sequential read and the last record will be rewritten as one -XMswitches to a sequential write operation. The user can simply -XMadvance the random record position following each random read or -Xwrite to obtain the effect of sequential I/O operation. - - - - - - - 5-29 - - - - - -CP/M Operating System Manual 5.2 Call Conventions - - - - MError codes returned in register A following a random read are -Xlisted below. - - - 01 reading unwritten data - - 02 (not returned in random mode) - - 03 cannot close current extent - - 04 seek to unwritten extent - - 05 (not returned in read mode) - - 06 seek past physical end of disk - - - MError codes 01 and 04 occur when a random read operation -XMaccesses a data block that has not been previously written or an -XMextent that has not been created, which are equivalent conditions. -XMError code 03 does not normally occur under proper system operation. -XMIf it does, it can be cleared by simply rereading or reopening -XMextent zero as long as the disk is not physically write protected. -XMError code 06 occurs whenever byte r2 is nonzero under the current -XM2.0 release. Normally, nonzero return codes can be treated as -XMmissing data, with zero return codes indicating operation complete. -X - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5-30 - - - - - -CP/M Operating System Manual 5.2 Call Conventions - - - - - - - FUNCTION 34: WRITE RANDOM - - Entry Parameters: - Register C: 22H - Registers DE: FCB Address - - Returned Value: - Register A: Return Code - - - - MThe Write Random operation is initiated similarly to the Read -XMRandom call, except that data is written to the disk from the -XMcurrent DMA address. Further, if the disk extent or data block that -XMis the target of the write has not yet been allocated, the -XMallocation is performed before the write operation continues. As in -XMthe Read Random operation, the random record number is not changed -XMas a result of the write. The logical extent number and current -XMrecord positions of the FCB are set to correspond to the random -XMrecord that is being written. Again, sequential read or write -XMoperations can begin following a random write, with the notation -XMthat the currently addressed record is either read or rewritten -XMagain as the sequential operation begins. You can also simply -XMadvance the random record position following each write to get the -XMeffect of a sequential write operation. Note that reading or -XMwriting the last record of an extent in random mode does not cause -Xan automatic extent switch as it does in sequential mode. - - MThe error codes returned by a random write are identical to the -XMrandom read operation with the addition of error code 05, which -XMindicates that a new extent cannot be created as a result of -Xdirectory overflow. - - - - - - - - - - - - - - - - - - - - - - 5-31 - - - - - -CP/M Operating System Manual 5.2 Call Conventions - - - - - - - FUNCTION 35: COMPUTE FILE SIZE - - Entry Parameters: - Register C: 23H - Registers DE: FCB Address - - Returned Value: - Random Record Field Set - - - - MWhen computing the size of a file, the DE register pair -XMaddresses an FCB in random mode format (bytes r0, r1, and r2 are -XMpresent). The FCB contains an unambiguous filename that is used in -XMthe directory scan. Upon return, the random record bytes contain -XMthe virtual file size, which is, in effect, the record address of -XMthe record following the end of the file. Following a call to -XMFunction 35, if the high record byte r2 is 01, the file contains the -XMmaximum record count 65536. Otherwise, bytes r0 and r1 constitute a -XM16-bit value as before (r0 is the least significant byte), which is -Xthe file size. - - MData can be appended to the end of an existing file by simply -XMcalling Function 35 to set the random record position to the end of -XMfile and then performing a sequence of random writes starting at the -Xpreset record address. - - MThe virtual size of a file corresponds to the physical size -XMwhen the file is written sequentially. If the file was created in -XMrandom mode and holes exist in the allocation, the file might -XMcontain fewer records than the size indicates. For example, if only -XMthe last record of an 8-megabyte file is written in random mode -XM(that is, record number 65535), the virtual size is 65536 records, -Xalthough only one block of data is actually allocated. - - - - - - - - - - - - - - - - - - - - 5-32 - - - - - -CP/M Operating System Manual 5.2 Call Conventions - - - - - - - FUNCTION 36: SET RANDOM RECORD - - Entry Parameters: - Register C: 24H - Registers DE: FCB Address - - Returned Value: - Random Record Field Set - - - - MThe Set Random Record function causes the BDOS automatically to -XMproduce the random record position from a file that has been read or -XMwritten sequentially to a particular point. The function can be -Xuseful in two ways. - - MFirst, it is often necessary initially to read and scan a -XMsequential file to extract the positions of various key fields. As -XMeach key is encountered, Function 36 is called to compute the random -XMrecord position for the data corresponding to this key. If the data -XMunit size is 128 bytes, the resulting record position is placed into -XMa table with the key for later retrieval. After scanning the entire -XMfile and tabulating the keys and their record numbers, the user can -XMmove instantly to a particular keyed record by performing a random -XMread, using the corresponding random record number that was saved -XMearlier. The scheme is easily generalized for variable record -XMlengths, because the program need only store the buffer-relative -XMbyte position along with the key and record number to find the exact -Xstarting position of the keyed data at a later time. - - MA second use of Function 36 occurs when switching from a -XMsequential read or write over to random read or write. A file is -XMsequentially accessed to a particular point in the file, Function 36 -XMis called, which sets the record number, and subsequent random read -Xand write operations continue from the selected point in the file. - - - - - - - - - - - - - - - - - - - 5-33 - - - - - -CP/M Operating System Manual 5.2 Call Conventions - - - - - - - FUNCTION 37: RESET DRIVE - - Entry Parameters: - Register C: 25H - Registers DE: Drive Vector - - Returned Value: - Register A: 00H - - - - MThe Reset Drive function allows resetting of specified drives. -XMThe passed parameter is a 16-bit vector of drives to be reset; the -Xleast significant bit is drive A:. - - MTo maintain compatibility with MP/M, CP/M returns a zero value. -X - - - - - - FUNCTION 40: WRITE RANDOM WITH ZERO FILL - - Entry Parameters: - Register C: 28H - Registers DE: FCB Address - - Returned Value: - Register A: Return Code - - - - MThe Write With Zero Fill operation is similar to Function 34, -XMwith the exception that a previously unallocated block is filled -Xwith zeros before the data is written. - - - - - - - - - - - - - - - - - - 5-34 - - - - - -CP/M Operating System Manual 5.3 A Sample Copy Program - - -W5.3 A Sample File-to-File Copy Program - - MT&She following program provides a relatively simple example of -XMfile operations. The program source file is created as COPY.ASM -XMusing the CP/M ED program and then assembled using ASM or MAC, -XMresulting in a HEX file. The LOAD program is used to produce a -XMCOPY.COM file that executes directly under the CCP. The program -XMbegins by setting the stack pointer to a local area and proceeds to -XMmove the second name from the default area at 006CH to a 33-byte -XMFile Control Block called DFCB. The DFCB is then prepared for file -XMoperations by clearing the current record field. At this point, -XMthe source and destination FCBs are ready for processing, because -XMthe SFCB at 005CH is properly set up by the CCP upon entry to the -XMCOPY program. That is, the first name is placed into the default -XMFCB, with the proper fields zeroed, including the current record -XMfield at 007CH. The program continues by opening the source file, -XMdeleting any existing destination file, and creating the destination -XMfile. If all this is successful, the program loops at the label -XMCOPY until each record is read from the source file and placed into -XMthe destination file. Upon completion of the data transfer, the -XMdestination file is closed and the program returns to the CCP -Xcommand level by jumping to BOOT. - 9 U0 - - - ; 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 - - - 5-35 - - - - - -CP/M Operating System Manual 5.3 A Sample Copy Program - - -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 - - - 5-36 - - - - - -CP/M Operating System Manual 5.3 A Sample Copy Program - - -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 - 9 K0 - - - MNote that there are several simplifications in this particular -XMprogram. First, there are no checks for invalid filenames that -XMcould contain ambiguous references. This situation could be -XMdetected by scanning the 32-byte default area starting at location -XM005CH for ASCII question marks. A check should also be make to -XMensure that the filenames have been included (check locations 005DH -XMand 006DH for nonblank ASCII characters). Finally, a check should -XMbe made to ensure that the source and destination filenames are -XMdifferent. An improvement in speed could be obtained by buffering -XMmore data on each read operation. One could, for example, determine - - - 5-M37 - - - -X - -CP/M Operating System Manual 5.3 A Sample Copy Program - - -Mthe size of memory by fetching FBASE from location 0006H and using -XMthe entire remaining portion of memory for a data buffer. In this -XMcase, the programmer simply resets the DMA address to the next -XMsuccessive 128-byte area before each read. Upon writing to the -XMdestination file, the DMA address is reset to the beginning of the -XMbuffer and incremented by 128 bytes to the end as each record is -Xtransferred to the destination file. - - -W5.4 A Sample File Dump Utility - - MT&She following file dump program is slightly more complex than -XMthe simple copy program given in the previous section. The dump -XMprogram reads an input file, specified in the CCP command line, and -XMdisplays the content of each record in hexadecimal format at the -XMconsole. Note that the dump program saves the CCP's stack upon -XMentry, resets the stack to a local area, and restores the CCP's -XMstack before returning directly to the CCP. Thus, the dump program -Xdoes not perform and warm start at the end of processing. - 9 U0 - - -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 - - - 5-38 - - - - - -CP/M Operating System Manual 5.4 A Sample File Dump Utility - - - ;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 - - - 5-39 - - - - - -CP/M Operating System Manual 5.4 A Sample File Dump Utility - - - 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 - ; - - - 5-40 - - - - - -CP/M Operating System Manual 5.4 A Sample File Dump Utility - - - ; 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 - - - 5-41 - - - - - -CP/M Operating System Manual 5.4 A Sample File Dump Utility - - - ; 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 - 9 K0 - - -W5.5 A Sample Random Access Program - - MT&Shis chapter concludes with an extensive example of random -XMaccess operation. The program listed below performs the simple -XMfunction of reading or writing random records upon command from the -XMterminal. When a program has been created, assembled, and placed -Xinto a file labeled RANDOM.COM, the CCP level command - - RANDOM X.DAT - -Mstarts the test program. The program looks for a file by the name -XMX.DAT and, if found, proceeds to prompt the console for input. If -XMnot found, the file is created before the prompt is given. Each -Xprompt takes the form - - next command? - -Mand is followed by operator input, followed by a carriage return. -XThe input commands take the form - - - - 5-42 - - - - - -CP/M Operating System Manual 5.5 Sample Random Access Program - - - nW nR Q - -Mwhere n is an integer value in the range 0 to 65535, and W, R, and Q -XMare simple command characters corresponding to random write, random -XMread, and quit processing, respectively. If the W command is -Xissued, the RANDOM program issues the prompt - - type data: - -MThe operator then responds by typing up to 127 characters, followed -XMby a carriage return. RANDOM then writes the character string into -XMthe X.DAT file at record n. If the R command is issued, RANDOM -XMreads record number n and displays the string value at the console, -XMIf the Q command is issued, the X.DAT file is closed, and the -XMprogram returns to the CCP. In the interest of brevity, the only -Xerror message is - - error, try again. - - MThe program begins with an initialization section where the -XMinput file is opened or created, followed by a continuous loop at -XMthe label ready where the individual commands are interpreted. The -XMDFBC at 005CH and the default buffer at 0080H are used in all disk -XMoperations. The utility subroutines then follow, which contain the -XMprincipal input line processor, called readc. This particular -XMprogram shows the elements of random access processing, and can be -Xused as the basis for further program development. - 9 U0 - - -W Sample Random Access Program for CP/M 2.0 - -&S0100 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 - ; - - - 5-43 - - - - - -CP/M Operating System Manual 5.5 Sample Random Access Program - - -000d = cr equ 0dh ;carriage return -000a = lf equ 0ah ;line feed - ; - - -W Load SP, Set-Up File for Random Access - -&S0100 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 - - -W Loop Back to Ready After Each Command - -&S ; - 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 - - - 5-44 - - - - - -CP/M Operating System Manual 5.5 Sample Random Access Program - - -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 - ; - - -W End of Quit Command, Process Write - -&S 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 - ; - - -W End of Write Command, Process Read - -&S notw: - ; not a write command, read record? -0189 fe52 cpi 'R' -018b c2b900 jnz error ;skip if not - ; - ; read random record - - - 5-45 - - - - - -CP/M Operating System Manual 5.5 Sample Random Access Program - - -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 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5-46 - - - - - -CP/M Operating System Manual 5.5 Sample Random Access Program - - -W End of Read Command, All Errors End Up Here - -&S ; - error: -01b9 115900 lxi d,errmsg -01bc cdda00 call print -01bf c33700 jmp ready - ; - - -W Utility Subroutines for Console I/O - -&S 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 - - - 5-47 - - - - - -CP/M Operating System Manual 5.5 Sample Random Access Program - - - ;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 - ; - - -W String Data Area for Console Messages - -&S 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? $' - ; - - -W Fixed and Variable Data Area - -&S027a 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 - - 5-48 - - - - 9 K0 - -CP/M Operating System Manual 5.5 Sample Random Access Program - - - - MMajor improvements could be made to this particular program to -XMenhance its operation. In fact, with some work, this program could -XMevolve into a simple data base management system. One could, for -XMexample, assume a standard record size of 128 bytes, consisting to -XMarbitrary fields within the record. A program, called GETKEY, could -XMbe developed that first reads a sequential file and extracts a -Xspecific field defined by the operator. For example, the command - - GETKEY NAMES.DAT LASTNAME 10 20 - -Mwould cause GETKEY to read the data base file NAMES.DAT and extract -XMthe LAST-NAME field from each record, starting in position 10 and -XMending at character 20. GETKEY builds a table in memory consisting -XMof each particular LASTNAME field, along with its 16-bit record -XMnumber location within the file. The GETKEY program then sorts this -XMlist and writes a new file, called LASTNAME.KEY, which is an -XMalphabetical list of LASTNAME fields with their corresponding record -XMnumbers. This list is called an inverted index in information -Xretrieval parlance. - - MIf the programmer were to rename the program shown above as -XMQUERY and modify it so that it reads a sorted key file into memory, -Xthe command line might appear as - - QUERY NAMES.DAT LASTNAME.KEY - -MInstead of reading a number, the QUERY program reads an alphanumeric -XMstring that is a particular key to find in the NAMES.DAT data base. -XMBecause the LASTNAME.KEY list is sorted, one can find a particular -XMentry rapidly by performing a binary search, similar to looking up a -XMname in the telephone book. Starting at both ends of the list, one -XMexamines the entry halfway in between and, if not matched, splits -XMeither the upper half or the lower half for the next search. You -XMwill quickly reach the item you are looking for and find the -XMcorresponding record number. You should fetch and display this -XMrecord at the console, just as was done in the program shown above. -X - MWith some more work, you can allow a fixed grouping size that -XMdiffers from the 128-byte record shown above. This is accomplished -XMby keeping track of the record number and the byte offset within the -XMrecord. Knowing the group size, you randomly access the record -XMcontaining the proper group, offset to the beginning of the group -XMwithin the record read sequentially until the group size has been -Xexhausted. - - MFinally, you can improve QUERY considerably by allowing boolean -XMexpressions, which compute the set of records that satisfy several -XMrelationships, such as a LASTNAME between HARDY and LAUREL and an -XMAGE lower than 45. Display all the records that fit this -XMdescription. Finally, if your lists are getting too big to fit into -Xmemory, randomly access key files from the disk as well. - - - - - - 5-49 - - - - - -CP/M Operating System Manual 5.6 System Function Summary - - -W5.6 System Function Summary - -F&Sunction Function Input Output -Number Name - -Decimal Hex - - 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 - - - 5-50 - - - - - -CP/M Operating System Manual 5.6 System Function Summary - - - 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 - - - - -*Note that A = L, and B = H upon return. - - -=End of Section 5 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5-51 - - - - - - - - -=WSection 6 - -=&SWCP/M 2 Alteration - - - -&SW6.1 Introduction - - MT&She standard CP/M system assumes operation on an Intel Model -XM800 microcomputer development system , but is designed so you can -XMalter a specific set of subroutines that define the hardware -Xoperating environment. - - MAlthough standard CP/M 2 is configured for single-density -XMfloppy disks, field-alteration features allow adaptation to a wide -XMvariety of disk subsystems from single-drive minidisks to high- -XMcapacity, hard disk systems. To simplify the following adaptation -XMprocess, it is assumed that CP/M 2 is first configured for single- -XMdensity floppy disks where minimal editing and debugging tools are -XMavailable. If an earlier version of CP/M is available, the -XMcustomizing process is eased considerably. In this latter case, you -XMmight want to review the system generation process and skip to later -XMsections that discuss system alteration for nonstandard disk -Xsystems. - - MTo achieve device independence, CP/M is separated into three -Xdistinct modules: - - o BIOS is the Basic I/O System, which is environment dependent. - - o MBDOS is the Basic Disk Operating System, which is not dependent -X upon the hardware configuration. - - o CCP is the Console Command Processor, which uses the BDOS. - - MOf these modules, only the BIOS is dependent upon the -XMparticular hardware. You can patch the distribution version of CP/M -XMto provide a new BIOS that provides a customized interface between -XMthe remaining CP/M modules and the hardware system. This document -XMprovides a step-by-step procedure for patching a new BIOS into CP/M. -X - MAll disk-dependent portions of CP/M 2 are placed into a BIOS, a -XMresident disk parameter block, which is either hand coded or -XMproduced automatically using the disk definition macro library -XMprovided with CP/M 2. The end user need only specify the maximum -XMnumber of active disks, the starting and ending sector numbers, the -XMdata allocation size, the maximum extent of the logical disk, -XMdirectory size information, and reserved track values. The macros -XMuse this information to generate the appropriate tables and table -XMreferences for use during CP/M 2 operation. Deblocking information -XMis provided, which aids in assembly or disassembly of sector sizes -XMthat are multiples of the fundamental 128-byte data unit, and the -XMsystem alteration manual includes general purpose subroutines that -XMuse the deblocking information to take advantage of larger sector -XMsizes. Use of these subroutines, together with the table-drive data -XMaccess algorithms, makes CP/M 2 a universal data management system. -X - - 6-1 - - - - -CP/M Operating System Manual 6.1 Introduction - - - MFile expansion is achieved by providing up to 512 logical file -XMextents, where each logical extent contains 16K bytes of data. CP/M -XM2 is structured, however, so that as much as 128K bytes of data are -XMaddressed by a single physical extent, corresponding to a single -XMdirectory entry, maintaining compatibility with previous versions -Xwhile taking advantage of directory space. - - MIf CP/M is being tailored to a computer system for the first -XMtime, the new BIOS requires some simple software development and -XMtesting. The standard BIOS is listed in Appendix A and can be used -XMas a model for the customized package. A skeletal version of the -XMBIOS given in Appendix B can serve as the basis for a modified BIOS. -X - MIn addition to the BIOS, you must write a simple memory loader, -XMcalled GETSYS, which brings the operating system into memory. To -XMpatch the new BIOS into CP/M, you must write the reverse of GETSYS, -XMcalled PUTSYS, which places an altered version of CP/M back onto the -XMdisk. PUTSYS can be derived from GETSYS by changing the disk read -XMcommands into disk write commands. Sample skeletal GETSYS and -XMPUTSYS programs are described in Section 6.4 and listed in Appendix -XC. - - MTo make the CP/M system load automatically, you must also -XMsupply a cold start loader, similar to the one provided with CP/M, -XMlisted in Appendixes A and D. A skeletal form of a cold start -XMloader is given in Appendix E, which serves as a model for the -Xloader. - - -W6.2 First-level System Regeneration - - MT&She procedure to patch the CP/M system is given below. Address -XMreferences in each step are shown with H denoting the hexadecimal -XMradix, and are given for a 20K CP/M system. For larger CP/M -XMsystems, a bias is added to each address that is shown with a +b -XMfollowing it, where b is equal to the memory size-20K. Values for b -Xin various standard memory sizes are listed in Table 6-1. - - -W Table 6-1. Standard Memory Size Values - - Memory Size Value - - 24K: b = 24K - 20K = 4K = 1000H - - 32K: b = 32K - 20K = 12K = 3000H - - 40K: b = 40K - 20K = 20K = 5000H - - 48K: b = 48K - 20K = 28K = 7000H - - 56K: b = 56K - 20K = 36K = 9000H - - 62K: b = 62K - 20K = 42K = A800H - - 64K: b = 64K - 20K = 44K = B000H - - - 6-2 - - - - -CP/M Operating System Manual 6.2 First-level Regeneration - - - MNote that the standard distribution version of CP/M is set for -XMoperation within a 20K CP/M system. Therefore, you must first bring -XMup the 20K CP/M system, then configure it for actual memory size -X(see Section 6.3). - - Follow these steps to patch your CP/M system: - - - 1) MRead Section 6.4 and write a GETSYS program that reads the -X Mfirst two tracks of a disk into memory. The program from -X Mthe disk must be loaded starting at location 3380H. GETSYS -X Mis coded to start at location 100H (base of the TPA) as -X shown in Appendix C. - - 2) MTest the GETSYS program by reading a blank disk into memory, -X Mand check to see that the data has been read properly and -X Mthat the disk has not been altered in any way by the GETSYS -X program. - - 3) MRun the GETSYS program using an initialized CP/M disk to see -X Mif GETSYS loads CP/M starting at 3380H (the operating -X system actually starts 128 bytes later at 3400H). - - 4) MRead Section 6.4 and write the PUTSYS program. This writes -X Mmemory starting at 3380H back onto the first two tracks of -X Mthe disk. The PUTSYS program should be located at 200H, as -X shown in Appendix C. - - 5) MTest the PUTSYS program using a blank, uninitialized disk by -X Mwriting a portion of memory to the first two tracks; clear -X Mmemory and read it back using GETSYS. Test PUTSYS -X Mcompletely, because this program will be used to alter CP/M -X on disk. - - 6) MStudy Sections 6.5, 6.6, and 6.7 along with the distribution -X Mversion of the BIOS given in Appendix A and write a simple -X Mversion that performs a similar function for the customized -X Menvironment. Use the program given in Appendix B as a -X Mmodel. Call this new BIOS by name CBIOS (customized BIOS). -X MImplement only the primitive disk operations on a single -X Mdrive and simple console input/output functions in this -X phase. - - 7) MTest CBIOS completely to ensure that it properly performs -X Mconsole character I/O and disk reads and writes. Be -X Mcareful to ensure that no disk write operations occur -X Mduring read operations and check that the proper track and -X Msectors are addressed on all reads and writes. Failure to -X Mmake these checks might cause destruction of the -X initialized CP/M system after it is patched. - - 8) MReferring to Table 6-3 in Section 6.5, note that the BIOS is -X Mplaced between locations 4A00H and 4FFFH. Read the CP/M -X Msystem using GETSYS and replace the BIOS segment by the -X MCBIOS developed in step 6 and tested in step 7. This -X replacement is done in memory. - - - 6-3 - - - - -CP/M Operating System Manual 6.2 First-level Regeneration - - - 9) MUse PUTSYS to place the patched memory image of CP/M onto -X the first two tracks of a blank disk for testing. - - 10) MUse GETSYS to bring the copied memory image from the test -X Mdisk back into memory at 3380H and check to ensure that it -X Mhas loaded back properly (clear memory, if possible, before -X Mthe load). Upon successful load, branch to the cold start -X Mcode at location 4A00H. The cold start routine initializes -X Mpage zero, then jumps to the CCP at location 3400H, which -X Mcalls the BDOS, which calls the CBIOS. The CCP asks the -X MCBIOS to read sixteen sectors on track 2, and CP/M types -X A>, the system prompt. - - MIf difficulties are encountered, use whatever debug -X Mfacilities are available to trace and breakpoint the CBIOS. -X - 11) MUpon completion of step 10, CP/M has prompted the console -X Mfor a command input. To test the disk write operation, -X type - - SAVE 1 X.COM - - MAll commands must be followed by a carriage return. CP/M -X responds with another prompt after several disk accesses: - - A> - - If it does not, debug the disk write functions and retry. - - 12) Test the directory command by typing - - DIR - - CP/M responds with - - A:X COM - - 13) Test the erase command by typing - - ERA X.COM - - MCP/M responds with the A prompt. This is now an -X Moperational system that only requires a bootstrap loader to -X function completely. - - 14) MWrite a bootstrap loader that is similar to GETSYS and place -X Mit on track 0, sector 1, using PUTSYS (again using the test -X Mdisk, not the distribution disk). See Sections 6.5 and 6.8 -X for more information on the bootstrap operation. - - 15) MRetest the new test disk with the bootstrap loader installed -X Mby executing steps 11, 12, and 13. Upon completion of -X Mthese tests, type a CTRL-C. The system executes a warm -X start, which reboots the system, and types the A prompt. - - - - 6-4 - - - - - -CP/M Operating System Manual 6.2 First-level Regeneration - - - 16) MAt this point, there is probably a good version of the -X Mcustomized CP/M system on the test disk. Use GETSYS to -X Mload CP/M from the test disk. Remove the test disk, place -X Mthe distribution disk, or a legal copy, into the drive, and -X Muse PUTSYS to replace the distribution version with the -X Mcustomized version. Do not make this replacement if you -X Mare unsure of the patch because this step destroys the -X system that was obtained from Digital Research. - - 17) Load the modified CP/M system and test it by typing - - DIR - - MCP/M responds with a list of files that are provided on the -X Minitialized disk. The file DDT.COM is the memory image for -X Mthe debugger. Note that from now on, you must always -X Mreboot the CP/M system (CTRL-C is sufficient) when the disk -X Mis removed and replaced by another disk, unless the new -X disk is to be Read-Only. - - 18) Load and test the debugger by typing - - DDT - - See Chapter 4 for operating procedures. - - 19) MBefore making further CBIOS modifications, practice using -X Mthe editor (see Chapter 2), and assembler (see Chapter 3). -X MRecode and test the GETSYS, PUTSYS, and CBIOS programs -X Musing ED, ASM, and DDT. Code and test a COPY program that -X Mdoes a sector-to-sector copy from one disk to another to -X Mobtain back-up copies of the original disk. Read the CP/M -X MLicensing Agreement specifying legal responsibilities when -X Mcopying the CP/M system. Place the following copyright -X notice: - - Copyright (c), 1983 - Digital Research - - on each copy that is made with the COPY program. - - 20) MModify the CBIOS to include the extra functions for punches, -X Mreaders, and sign-on messages, and add the facilities for -X Madditional disk drives, if desired. These changes can be -X Mmade with the GETSYS and PUTSYS programs or by referring to -X the regeneration process in Section 6.3. - - - MYou should now have a good copy of the customized CP/M system. -XMAlthough the CBIOS portion of CP/M belongs to the user, the modified -Xversion cannot be legally copied. - - MIt should be noted that the system remains file-compatible with -XMall other CP/M systems (assuming media compatibility) which allows -Xtransfer of nonproprietary software between CP/M users. - - - 6-5 - - - - - -CP/M Operating System Manual 6.3 Second-level System Generation - - -W6.3 Second-level System Generation - - MO&Snce the system is running, the next step is to configure CP/M -XMfor the desired memory size. Usually, a memory image is first -XMproduced with the MOVCPM program (system relocator) and then placed -XMinto a named disk file. The disk file can then be loaded, examined, -XMpatched, and replaced using the debugger and the system generation -Xprogram (refer to Chapter 1). - - MThe CBIOS and BOOT are modified using ED and assembled using -XMASM, producing files called CBIOS.HEX and BOOT.HEX, which contain -Xthe code for CBIOS and BOOT in Intel hex format. - - MTo get the memory image of CP/M into the TPA configured for the -Xdesired memory size, type the command: - - MOVCPM xx* - -Mwhere xx is the memory size in decimal K bytes, for example, 32 for -X32K. The response is as follows: - - CONSTRUCTING xxK CP/M VERS 2.0 - - READY FOR "SYSGEN" OR - - "SAVE 34 CPMxx.COM" - - MAn image of CP/M in the TPA is configured for the requested -XMmemory size. The memory image is at location 0900H through 227FH, -XMthat is, the BOOT is at 0900H, the CCP is at 980H, the BDOS starts -XMat 1180H, and the BIOS is at 1F80H. Note that the memory image has -XMthe standard Model 800 BIOS and BOOT on it. It is now necessary to -XMsave the memory image in a file so that you can patch the CBIOS and -XCBOOT into it: - - SAVE 34 CPMxx.COM - - MThe memory image created by the MOVCPM program is offset by a -XMnegative bias so that it loads into the free area of the TPA, and -XMthus does not interfere with the operation of CP/M in higher memory. -XMThis memory image can be subsequently loaded under DDT and examined -XMor changed in preparation for a new generation of the system. DDT -Xis loaded with the memory image by typing: - - DDT CPMxx.COM Loads DDT, then reads the CP/M image. - -DDT should respond with the following: - - NEXT PC - 2300 0100 - - The DDT prompt - -MYou can then give the display and disassembly commands to examine -XMportions of the memory image between 900H and 227FH. Note, however, -XMthat to find any particular address within the memory image, you - - - 6-M6 - - - -X - -CP/M Operating System Manual 6.3 Second-level System Generation - - -Mmust apply the negative bias to the CP/M address to find the actual -XMaddress. Track 00, sector 01, is loaded to location 900H (the user -XMshould find the cold start loader at 900H to 97FH); track 00, sector -XM02, is loaded into 980H (this is the base of the CCP); and so on -XMthrough the entire CP/M system load. In a 20K system, for example, -XMthe CCP resides at the CP/M address 3400H, but is placed into memory -XMat 980H by the SYSGEN program. Thus, the negative bias, denoted by -Xn, satisfies - - 3400H + n = 980H, or n =980H - 3400H - -MAssuming two's complement arithmetic, n = D580H, which can be -Xchecked by - - 3400H + D580H = 10980H = 0980H (ignoring high-order - overflow). - - Note that for larger systems, n satisfies - - (3400H+b) + n = 980H, or - n = 980H - (3400H + b), or - n = D580H - b - -The value of n for common CP/M systems is given below. - - -W Table 6-2. Common Values for CP/M Systems - - Memory Size BIAS b Negative Offset n - - 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 - - - MIf you want to locate the address x within the memory image -Xloaded under DDT in a 20K system, first type - - Hx,n Hexadecimal sum and difference - -Mand DDT responds with the value of x+n (sum) and x-n (difference). -XMThe first number printed by DDT is the actual memory address in the -XMimage where the data or code is located. For example, the following -XDDT command: - - H3400,D580 - -Mproduces 980H as the sum, which is where the CCP is located in the -Xmemory image under DDT. - - - - 6-7 - - - - - -CP/M Operating System Manual 6.3 Second-level System Generation - - - MType the L command to disassemble portions of the BIOS located -XMat (4A00H+b)-n, which, when one uses the H command, produces an -XMactual address of 1F80H. The disassembly command would thus be as -Xfollows: - - L1F80 - -MIt is now necessary to patch in the CBOOT and CBIOS routines. The -XMBOOT resides at location 0900H in the memory image. If the actual -XMload address is n, then to calculate the bias (m), type the command: -X - MH900,n Subtract load address from target address. -X - MThe second number typed by DDT in response to the command is -XMthe desired bias (m). For example, if the BOOT executes at 0080H, -Xthe command - - H900,80 - -produces - - 0980 0880 Sum and difference in hex. - -MTherefore, the bias m would be 0880H. To read-in the BOOT, give the -Xcommand: - - ICBOOT.HEX Input file CBOOT.HEX - -Then - - Rm Read CBOOT with a bias of m (=900H-n). - -Examine the CBOOT with - - L900 - -MYou are now ready to replace the CBIOS by examining the area at -XM1F80H, where the original version of the CBIOS resides, and then -Xtyping - - ICBIOS.HEX Ready the hex file for loading. - - MAssume that the CBIOS is being integrated into a 20K CP/M -XMsystem and thus originates at location 4A00H. To locate the CBIOS -XMproperly in the memory image under DDT, you must apply the negative -XMbias n for a 20K system when loading the hex file. This is -Xaccomplished by typing - - RD580 Read the file with bias D580H. - -MUpon completion of the read, reexamine the area where the CBIOS has -XMbeen loaded (use an L1F80 command) to ensure that it is properly -XMloaded. When you are satisfied that the change has been made, -Xreturn from DDT using a CTRL-C or, G0 command. - - - - 6-8 - - - - - -CP/M Operating System Manual 6.3 Second-level System Generation - - - MSYSGEN is used to replace the patched memory image back onto a -XMdisk (you use a test disk until sure of the patch) as shown in the -Xfollowing interaction: - - - SYSGEN Start the SYSGEN program. - - SYSGEN VERSION 2.0 Sign-on message from SYSGEN. - - 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. - - DESTINATION DRIVE NAME Respond with B to write the new - (OR RETURN TO REBOOT) system to the disk in drive B. - - - DESTINATION ON B, Place a scratch disk in drive - THEN TYPE RETURN B, then press RETURN. - - FUNCTION COMPLETE - DESTINATION DRIVE NAME - (OR RETURN TO REBOOT) - - - MPlace the scratch disk in drive A, then perform a cold start to -Xbring up the newly-configured CP/M system. - - MThe new CP/M system is then tested and the Digital Research -XMcopyright notice is placed on the disk, as specified in the -XLicensing Agreement: - - Copyright (c), 1979 - Digital Research - - -W6.4 Sample GETSYS and PUTSYS Programs - - MT&She following program provides a framework for the GETSYS and -XMPUTSYS programs referenced in Sections 6.1 and 6.2. To read and -XMwrite the specific sectors, you must insert the READSEC and WRITESEC -Xsubroutines. - - - - - - - - - - - - - - - 6-9 - - - - - -CP/M Operating System Manual 6.4 Sample GETSYS and PUTSYS - - -; GETSYS PROGRAM -- READ TRACKS 0 AND 1 TO MEMORY AT 3380H -; REGISTER USE - -; A (SCRATCH REGISTER) - -; B TRACK COUNT (0, 1) - -; C SECTOR COUNT (1,2,...,26) - -; DE (SCRATCH REGISTER PAIR) - -; HL LOAD ADDRESS - -; SP SET TO STACK ADDRESS - -; -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 - -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 - -; -; 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 - -; -; USER-SUPPLIED SUBROUTINE TO READ THE DISK -READSEC: -; ENTER WITH TRACK NUMBER IN REGISTER B, - SECTOR NUMBER IN REGISTER C, AND - -; ADDRESS TO FILL IN HL - -; - PUSH B ;SAVE B AND C REGISTERS - PUSH H ;SAVE HL REGISTERS - - -W Listing 6-1. GETSYS Program - - - - 6-10 - - - - - -CP/M Operating System Manual 6.4 Sample GETSYS and PUTSYS - - - ................................................. - 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 - - END START - - -W Listing 6-1. (continued) - - - - MThis program is assembled and listed in Appendix B for -XMreference purposes, with an assumed origin of 100H. The hexadecimal -XMoperation codes that are listed on the left might be useful if the -Xprogram has to be entered through the panel switches. - - MThe PUTSYS program can be constructed from GETSYS by changing -XMonly a few operations in the GETSYS program given above, as shown in -XMAppendix C. The register pair HL becomes the dump address, next -XMaddress to write, and operations on these registers do not change -XMwithin the program. The READSEC subroutine is replaced by a -XMWRITESEC subroutine, which performs the opposite function; data from -XMaddress HL is written to the track given by register B and sector -XMgiven by register C. It is often useful to combine GETSYS and -XMPUTSYS into a single program during the test and development phase, -Xas shown in Appendix C. - - -W6.5 Disk Organization - - MT&She sector allocation for the standard distribution version of -XMCP/M is given here for reference purposes. The first sector -XMcontains an optional software boot section (see the table on the -XMfollowing page. Disk controllers are often set up to bring track -XM0, sector 1, into memory at a specific location, often location -XM0000H. The program in this sector, called BOOT, has the -XMresponsibility of bringing the remaining sectors into memory -XMstarting at location 3400H+b. If the controller does not have a -XMbuilt-in sector load, the program in track 0, sector 1 can be -XMignored. In this case, load the program from track 0, sector 2, to -Xlocation 3400H+b. - - MAs an example, the Intel Model 800 hardware cold start loader -XMbrings track 0, sector 1, into absolute address 3000H. Upon loading -XMthis sector, control transfers to location 3000H, where the -XMbootstrap operation commences by loading the remainder of track 0 -XMand all of track 1 into memory, starting at 3400H+b. Note that this -XMbootstrap loader is of little use in a non-microcomputer development -XMsystem environment, although it is useful to examine it because some -XMof the boot actions will have to be duplicated in the user's cold -Xstart loader. - - - 6-11 - - - - - -CP/M Operating System Manual 6.5 Disk Organization - - -W Table 6-3. CP/M Disk Sector Allocation - -Track # Sector Page# Memory Address CP/M Module name - - 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 ' - 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) - - 6-12 - - - - -CP/M Operating System Manual 6.6 BIOS Entry Points - - -W6.6 The BIOS Entry Points - - MT&She entry points into the BIOS from the cold start loader and -XMBDOS are detailed below. Entry to the BIOS is through a jump vector -XMlocated at 4A00H+b, as shown below. See Appendixes A and B. The -XMjump vector is a sequence of 17 jump instructions that send program -XMcontrol to the individual BIOS subroutines. The BIOS subroutines -XMmight be empty for certain functions (they might contain a single -XMRET operation) during reconfiguration of CP/M, but the entries must -Xbe present in the jump vector. - - MThe jump vector at 4A00H+b takes the form shown below, where -Xthe individual jump addresses are given to the left: - - - 4A00H+b JMP BOOT ;ARRIVE HERE FROM COLD - START LOAD - - 4A03H+b JMP WBOOT ;ARRIVE HERE FOR WARM START - - 4A06H+b JMP CONST ;CHECK FOR CONSOLE CHAR - READY - - 4A09H+b JMP CONIN ;READ CONSOLE CHARACTER IN - - 4A0CH+b JMP CONOUT ;WRITE CONSOLE CHARACTER - OUT - - 4A0FH+b JMP LIST ;WRITE LISTING CHARACTER OUT - - 4A12H+b JMP PUNCH ;WRITE CHARACTER TO PUNCH - DEVICE - - 4A15H+b JMP READER ;READ READER DEVICE - - 4A18H+b JMP HOME ;MOVE TO TRACK 00 ON - SELECTED DISK - - 4A1BH+b JMP SELDSK ;SELECT DISK DRIVE - - 4A1EH+b JMP SETTRK ;SET TRACK NUMBER - - 4A21H+b JMP SETSEC ;SET SECTOR NUMBER - - 4A24H+b JMP SETDMA ;SET DMA ADDRESS - - 4A27H+b JMP READ ;READ SELECTED SECTOR - - 4A2AH+b JMP WRITE ;WRITE SELECTED SECTOR - - 4A2DH+b JMP LISTST ;RETURN LIST STATUS - - 4A30H+b JMP SECTRAN ;SECTOR TRANSLATE - SUBROUTINE - - -W Listing 6-2. BIOS Entry Points - - 6-13 - - - - -CP/M Operating System Manual 6.6 BIOS Entry Points - - - MEach jump address corresponds to a particular subroutine that -XMperforms the specific function, as outlined below. There are three -XMmajor divisions in the jump table: the system reinitialization, -XMwhich results from calls on BOOT and WBOOT; simple character I/O, -XMperformed by calls on CONST, CONIN, CONOUT, LIST, PUNCH, READER, and -XMLISTST; and disk I/O, performed by calls on HOME, SELDSK, SETTRK, -XSETSEC, SETDMA, READ, WRITE, and SECTRAN. - - MAll simple character I/O operations are assumed to be performed -XMin ASCII, upper- and lower-case, with high-order (parity bit) set to -XMzero. An end-of-file condition for an input device is given by an -XMASCII CTRL-Z (1AH). Peripheral devices are seen by CP/M as logical -Xdevices and are assigned to physical devices within the BIOS. - - MTo operate, the BDOS needs only the CONST, CONIN, and CONOUT -XMsubroutines. LIST, PUNCH, and READER can be used by PIP, but not -XMthe BDOS. Further, the LISTST entry is currently used only by -XMDESPOOL, the print spooling utility. Thus, the initial version of -XCBIOS can have empty subroutines for the remaining ASCII devices. - - MThe following list describes the characteristics of each -Xdevice. - - - o MCONSOLE is the principal interactive console that communicates -X Mwith the operator and it is accessed through CONST, CONIN, and -X MCONOUT. Typically, the CONSOLE is a device such as a CRT or -X teletype. - - o MLIST is the principal listing device. If it exists on the -X Muser's system, it is usually a hard-copy device, such as a -X printer or teletype. - - o MPUNCH is the principal tape punching device. If it exists, it -X is normally a high-speed paper tape punch or teletype. - - o MREADER is the principal tape reading device, such as a simple -X optical reader or teletype. - - - MA single peripheral can be assigned as the LIST, PUNCH, and -XMREADER device simultaneously. If no peripheral device is assigned -XMas the LIST, PUNCH, or READER device, the CBIOS gives an appropriate -XMerror message so that the system does not hang if the device is -XMaccessed by PIP or some other user program. Alternately, the PUNCH -XMand LIST routines can just simply return, and the READER routine can -XMreturn with a 1AH (CTRL-Z) in register A to indicate immediate end- -Xof-file. - - MFor added flexibility, you can optionally implement the IOBYTE -XMfunction, which allows reassignment of physical devices. The IOBYTE -XMfunction creates a mapping of logical-to-physical devices that can -XMbe altered during CP/M processing, see the STAT command in Section -X1.6.1. - - - - - 6-14 - - - - -CP/M Operating System Manual 6.6 BIOS Entry Points - - MThe definition of the IOBYTE function corresponds to the Intel -XMstandard as follows: a single location in memory, currently -XMlocation 0003H, is maintained, called IOBYTE, which defines the -XMlogical-to-physical device mapping that is in effect at a particular -XMtime. The mapping is performed by splitting the IOBYTE into four -XMdistinct fields of two bits each, called the CONSOLE, READER, PUNCH, -Xand LIST fields, as shown in the following figure. - - - most significant least significant - - IOBYTE AT 003H LIST PUNCH READER CONSOLE - - bits 6,7 bits 4,5 bits 2,3 bits 0,1 - - -W Figure 6-1. IOBYTE Fields - - - - MThe value in each field can be in the range 0-3, defining the -XMassigned source or destination of each logical device. Table 6-4 -Xgives the values that can be assigned to each field. - - -W Table 6-4. IOBYTE Field Values - - Value Meaning - - CONSOLE field (bits 0,1) - - 0 console is assigned to the console printer - device (TTY:) - 1 console is assigned to the CRT device (CRT:) - 2 batch mode: use the READER as the CONSOLE input, - and the LIST device as the CONSOLE output (BAT:) - 3 user-defined console device (UC1:) - - READER field (bits 2,3) - - 0 READER is the teletype device (TTY:) - 1 READER is the high speed reader device (PTR:) - 2 user-defined reader #1 (UR1:) - 3 user-defined reader #2 (UR2:) - - PUNCH field (bits 4,5) - - 0 PUNCH is the teletype device (TTY:) - 1 PUNCH is the high speed punch device (PTP:) - 2 user-defined punch #1 (UP1:) - 3 user-defined punch #2 (UP2:) - - LIST field (bits 6,7) - - 0 LIST is the teletype device (TTY:) - 1 LIST is the CRT device (CRT:) - 2 LIST is the line printer device (LPT:) - 3 user-defined list device (UL1:) - - 6-15 - - - - -CP/M Operating System Manual 6.6 BIOS Entry Points - - - MThe implementation of the IOBYTE is optional and effects only -XMthe organization of the CBIOS. No CP/M systems use the IOBYTE -XM(although they tolerate the existence of the IOBYTE at location -XM0003H) except for PIP, which allows access to the physical devices, -XMand STAT, which allows logical-physical assignments to be make or -XMdisplayed. For more information see Section 1. In any case the -XMIOBYTE implementation should be omitted until the basic CBIOS is -XMfully implemented and tested; then you should add the IOBYTE to -Xincrease the facilities. - - MDisk I/O is always performed through a sequence of calls on the -XMvarious disk access subroutines that set up the disk number to -XMaccess, the track and sector on a particular disk, and the Direct -XMMemory Access (DMA) address involved in the I/O operation. After -XMall these parameters have been set up, a call is made to the READ or -XWRITE function to perform the actual I/O operation. - - MThere is often a single call to SELDSK to select a disk drive, -XMfollowed by a number of read or write operations to the selected -XMdisk before selecting another drive for subsequent operations. -XMSimilarly, there might be a single call to set the DMA address, -XMfollowed by several calls that read or write from the selected DMA -XMaddress before the DMA address is changed. The track and sector -XMsubroutines are always called before the READ or WRITE operations -Xare performed. - - MThe READ and WRITE routines should perform several retries (10 -XMis standard) before reporting the error condition to the BDOS. If -XMthe error condition is returned to the BDOS, it reports the error to -XMthe user. The HOME subroutine might or might not actually perform -XMthe track 00 seek, depending upon controller characteristics; the -XMimportant point is that track 00 has been selected for the next -XMoperation and is often treated in exactly the same manner as SETTRK -Xwith a parameter of 00. - - MThe following table describes the exact responsibilities of -Xeach BIOS entry point subroutine. - - -W Table 6-5. BIOS Entry Points - - Entry Point Function - - 9 F0 BOOT MThe BOOT entry point gets control from the cold -X Mstart loader and is responsible for basic -X Msystem initialization, including sending a -X Msign-on message, which can be omitted in the -X Mfirst version. If the IOBYTE function is -X Mimplemented, it must be set at this point. The -X Mvarious system parameters that are set by the -X MWBOOT entry point must be initialized, and -X Mcontrol is transferred to the CCP at 3400+b for -X Mfurther processing. Note that register C must -X be set to zero to select drive A. - - - - 6-16 - - - - - -CP/M Operating System Manual 6.6 BIOS Entry Points - - -W Table 6-5. (continued) - - Entry Point Function - - WBOOT MThe WBOOT entry point gets control when a warm -X Mstart occurs. A warm start is performed -X Mwhenever a user program branches to location -X M0000H, or when the CPU is reset from the front -X Mpanel. The CP/M system must be loaded from the -X Mfirst two tracks of drive A up to, but not -X Mincluding, the BIOS, or CBIOS, if the user has -X Mcompleted the patch. System parameters must be -X initialized as follows: - - location 0,1,2 MSet to JMP WBOOT for warm -X starts (000H: JMP 4A03H+b) - - location 3 MSet initial value of IOBYTE, -X if implemented in the CBIOS - - location 4 MHigh nibble = current user no; -X low nibble = current drive - - location 5,6,7 MSet to JMP BDOS, which is the -X Mprimary entry point to CP/M -X Mfor transient programs. -X (0005H: JMP 3C06H+b) - - MRefer to Section 6.9 for complete details of -X Mpage zero use. Upon completion of the -X Minitialization, the WBOOT program must branch -X Mto the CCP at 3400H+b to restart the system. -X MUpon entry to the CCP, register C is set to the -X Mdrive to select after system initialization. -X MThe WBOOT routine should read location 4 in -X Mmemory, verify that is a legal drive, and pass -X it to the CCP in register C. - - CONST MYou should sample the status of the currently -X Massigned console device and return 0FFH in -X Mregister A if a character is ready to read and -X M00H in register A if no console characters are -X ready. - - CONIN MThe next console character is read into -X Mregister A, and the parity bit is set, high- -X Morder bit, to zero. If no console character is -X Mready, wait until a character is typed before -X returning. - - - - - - - - - 6-17 - - - - - -CP/M Operating System Manual 6.6 BIOS Entry Points - - -W Table 6-5. (continued) - - Entry Point Function - - CONOUT MThe character is sent from register C to the -X Mconsole output device. The character is in -X MASCII, with high-order parity bit set to zero. -X MYou might want to include a time-out on a line- -X Mfeed or carriage return, if the console device -X Mrequires some time interval at the end of the -X Mline (such as a TI Silent 700 terminal). You -X Mcan filter out control characters that cause -X Mthe console device to react in a strange way -X M(CTRL-Z causes the Lear-Seigler terminal to -X clear the screen, for example). - - LIST MThe character is sent from register C to the -X Mcurrently assigned listing device. The -X character is in ASCII with zero parity bit. - - PUNCH MThe character is sent from register C to the -X Mcurrently assigned punch device. The character -X is in ASCII with zero parity. - - READER MThe next character is read from the currently -X Massigned reader device into register A with -X Mzero parity (high-order bit must be zero); an -X Mend-of-file condition is reported by returning -X an ASCII CTRL-Z(1AH). - - HOME MThe disk head of the currently selected disk -X M(initially disk A) is moved to the track 00 -X Mposition. If the controller allows access to -X Mthe track 0 flag from the drive, the head is -X Mstepped until the track 0 flag is detected. If -X Mthe controller does not support this feature, -X Mthe HOME call is translated into a call to -X SETTRK with a parameter of 0. - - SELDSK MThe disk drive given by register C is selected -X Mfor further operations, where register C -X Mcontains 0 for drive A, 1 for drive B, and so -X Mon up to 15 for drive P (the standard CP/M -X Mdistribution version supports four drives). On -X Meach disk select, SELDSK must return in HL the -X Mbase address of a 16-byte area, called the Disk -X MParameter Header, described in Section 6.10. -X MFor standard floppy disk drives, the contents -X Mof the header and associated tables do not -X Mchange; thus, the program segment included in -X Mthe sample CBIOS performs this operation -X automatically. - - - - - - 6-18 - - - - - -CP/M Operating System Manual 6.6 BIOS Entry Points - - -W Table 6-5. (continued) - - Entry Point Function - - MIf there is an attempt to select a nonexistent -X Mdrive, SELDSK returns HL=0000H as an error -X Mindicator. Although SELDSK must return the -X Mheader address on each call, it is advisable to -X Mpostpone the physical disk select operation -X Muntil an I/O function (seek, read, or write) is -X Mactually performed, because disk selects often -X Moccur without utimately performing any disk -X MI/O, and many controllers unload the head of -X Mthe current disk before selecting the new -X Mdrive. This causes an excessive amount of -X Mnoise and disk wear. The least significant bit -X Mof register E is zero if this is the first -X Moccurrence of the drive select since the last -X cold or warm start. - - SETTRK MRegister BC contains the track number for -X Msubsequent disk accesses on the currently -X Mselected drive. The sector number in BC is the -X Msame as the number returned from the SECTRAN -X Mentry point. You can choose to seek the -X Mselected track at this time or delay the seek -X Muntil the next read or write actually occurs. -X MRegister BC can take on values in the range 0- -X M76 corresponding to valid track numbers for -X Mstandard floppy disk drives and 0-65535 for -X nonstandard disk subsystems. - - SETSEC MRegister BC contains the sector number, 1 -X Mthrough 26, for subsequent disk accesses on the -X Mcurrently selected drive. The sector number in -X MBC is the same as the number returned from the -X MSECTRAN entry point. You can choose to send -X Mthis information to the controller at this -X Mpoint or delay sector selection until a read or -X write operation occurs. - - SETDMA MRegister BC contains the DMA (Disk Memory -X MAccess) address for subsequent read or write -X Moperations. For example, if B = 00H and C = -X M80H when SETDMA is called, all subsequent read -X Moperations read their data into 80H through -X M0FFH and all subsequent write operations get -X Mtheir data from 80H through 0FFH, until the -X Mnext call to SETDMA occurs. The initial DMA -X Maddress is assumed to be 80H. The controller -X Mneed not actually support Direct Memory Access. -X MIf, for example, all data transfers are through -X MI/O ports, the CBIOS that is constructed uses -X Mthe 128-byte area starting at the selected DMA -X Maddress for the memory buffer during the -X subsequent read or write operations. - - - 6-19 - - - - -CP/M Operating System Manual 6.6 BIOS Entry Points - - -W Table 6-5. (continued) - - Entry Point Function - - READ MAssuming the drive has been selected, the track -X Mhas been set, and the DMA address has been -X Mspecified, the READ subroutine attempts to read -X Mone sector based upon these parameters and -X Mreturns the following error codes in register -X A: - - 0 no errors occurred - - 1 nonrecoverable error condition occurred - - MCurrently, CP/M responds only to a zero or -X Mnonzero value as the return code. That is, if -X Mthe value in register A is 0, CP/M assumes that -X Mthe disk operation was completed properly. IF -X Man error occurs the CBIOS should attempt at -X Mleast 10 retries to see if the error is -X Mrecoverable. When an error is reported the -X MBDOS prints the message BDOS ERR ONx: BAD -X MSECTOR. The operator then has the option of -X Mpressing a carriage return to ignore the error, -X or CTRL-C to abort. - - WRITE MData is written from the currently selected DMA -X Maddress to the currently selected drive, track, -X Mand sector. For floppy disks, the data should -X Mbe marked as nondeleted data to maintain -X Mcompatibility with other CP/M systems. The -X Merror codes given in the READ command are -X Mreturned in register A, with error recovery -X attempts as described above. - - LISTST MYou return the ready status of the list device -X Mused by the DESPOOL program to improve console -X Mresponse during its operation. The value 00 is -X Mreturned in A if the list device is not ready -X Mto accept a character and 0FFH if a character -X Mcan be sent to the printer. A 00 value should -X Mbe returned if LIST status is not implemented. -X - - - - - - - - - - - - - - 6-20 - - - - - -CP/M Operating System Manual 6.6 BIOS Entry Points - - -W Table 6-5. (continued) - - Entry Point Function - - SECTRAN MLogical-to-physical sector translation is -X Mperformed to improve the overall response of -X MCP/M. Standard CP/M systems are shipped with a -X Mskew factor of 6, where six physical sectors -X Mare skipped between each logical read -X Moperation. This skew factor allows enough time -X Mbetween sectors for most programs to load their -X Mbuffers without missing the next sector. In -X Mparticular computer systems that use fast -X Mprocessors, memory, and disk subsystems, the -X Mskew factor might be changed to improve overall -X Mresponse. However, the user should maintain a -X Msingle-density IBM-compatible version of CP/M -X Mfor information transfer into and out of the -X computer system, using a skew factor of 6. - - MIn general, SECTRAN receives a logical sector -X Mnumber relative to zero in BC and a translate -X Mtable address in DE. The sector number is used -X Mas an index into the translate table, with the -X Mresulting physical sector number in HL. For -X Mstandard systems, the table and indexing code -X Mis provided in the CBIOS and need not be -X changed. - 9 K0 - -W6.7 A Sample BIOS - - MT&She program shown in Appendix B can serve as a basis for your -XMfirst BIOS. The simplest functions are assumed in this BIOS, so -XMthat you can enter it through a front panel, if absolutely -XMnecessary. You must alter and insert code into the subroutines for -XMCONST, CONIN, CONOUT, READ, WRITE, and WAITIO subroutines. Storage -XMis reserved for user-supplied code in these regions. The scratch -XMarea reserved in page zero (see Section 6.9) for the BIOS is used in -Xthis program, so that it could be implemented in ROM, if desired. - - MOnce operational, this skeletal version can be enhanced to -XMprint the initial sign-on message and perform better error recovery. -XMThe subroutines for LIST, PUNCH, and READER can be filled out and -Xthe IOBYTE function can be implemented. - - -W6.8 A Sample Cold Start Loader - - MT&She program shown in Appendix E can serve as a basis for a cold -XMstart loader. The disk read function must be supplied by the user, -XMand the program must be loaded somehow starting at location 0000. -XMSpace is reserved for the patch code so that the total amount of -Xstorage required for the cold start loader is 128 bytes. - - - - 6-21 - - - - - -CP/M Operating System Manual 6.8 A Sample Cold Start Loader - - - MEventually, you might want to get this loader onto the first -XMdisk sector (track 0, sector 1) and cause the controller to load it -XMinto memory automatically upon system start up. Alternatively, the -XMcold start loader can be placed into ROM, and above the CP/M system. -XMIn this case, it is necessary to originate the program at a higher -XMaddress and key in a jump instruction at system start up that -XMbranches to the loader. Subsequent warm starts do not require this -XMkey-in operation, because the entry point WBOOT gets control, thus -XMbringing the system in from disk automatically. The skeletal cold -XMstart loader has minimal error recovery, which might be enhanced in -Xlater versions. - - -W6.9 Reserved Locations in Page Zero - - MM&Sain memory page zero, between locations 00H and 0FFH, contains -XMseveral segments of code and data that are used during CP/M -XMprocessing. The code and data areas are given in the following -Xtable. - - -W Table 6-6. Reserved Locations in Page Zero - - Locations Contents - - 9 F0 000H-0002H MContains a jump instruction to the warm -X Mstart entry location 4A03H+b. This -X Mallows a simple programmed restart (JMP -X M0000H) or manual restart from the front -X panel. - - 0003H-0003H MContains the Intel standard IOBYTE is -X Moptionally included in the user's CBIOS -X (refer to Section 6.6). - - 0004H-0004H MCurrent default drive number -X (0=A,...,15=P). - - 0005H-0007H MContains a jump instruction to the BDOS -X Mand serves two purposes: JMP 0005H -X Mprovides the primary entry point to the -X MBDOS, as described in Chapter 5, and -X MLHLD 0006H brings the address field of -X Mthe instruction to the HL register -X Mpair. This value is the lowest address -X Min memory used by CP/M, assuming the -X MCCP is being overlaid. The DDT program -X Mchanges the address field to reflect -X Mthe reduced memory size in debug mode. -X - 0008H-0027H MInterrupt locations 1 through 5 not -X used. - - 0030H-0037H MInterrupt location 6 (not currently -X used) is reserved. - - - 6-22 - - - - - -CP/M Operating System Manual 6.9 Reserved Locations in Page Zero - - -W Table 6-6. (continued) - - Locations Contents - - 0038H-003AH MRestart 7; contains a jump instruction -X Minto the DDT or SID program when -X Mrunning in debug mode for programmed -X Mbreakpoints, but is not otherwise used -X by CP/M. - - 003BH-003FH Not currently used; reserved. - - 0040H-004FH MA 16-byte area reserved for scratch by -X MCBIOS, but is not used for any purpose -X in the distribution version of CP/M. - - 0050H-005BH Not currently used; reserved. - - 005CH-007CH MDefault File Control Block produced for -X a transient program by the CCP. - - 007DH-007FH MOptional default random record position. -X - 0080H-00FFH MDefault 128-byte disk buffer, also -X Mfilled with the command line when a -X transient is loaded under the CCP. - 9 K0 - - MThis information is set up for normal operation under the CP/M -XMsystem, but can be overwritten by a transient program if the BDOS -Xfacilities are not required by the transient. - - MIf, for example, a particular program performs only simple I/O -XMand must begin execution at location 0, it can first be loaded into -XMthe TPA, using normal CP/M facilities, with a small memory move -XMprogram that gets control when loaded. The memory move program must -XMget control from location 0100H, which is the assumed beginning of -XMall transient programs. The move program can then proceed to the -XMentire memory image down to location 0 and pass control to the -Xstarting address of the memory load. - - MIf the BIOS is overwritten or if location 0, containing the -XMwarm start entry point, is overwritten, the operator must bring the -XCP/M system back into memory with a cold start sequence. - - -W6.10 Disk Parameter Tables - - MT&Sables are included in the BIOS that describe the particular -XMcharacteristics of the disk subsystem used with CP/M. These tables -XMcan be either hand-coded, as shown in the sample CBIOS in Appendix -XMB, or automatically generated using the DISKDEF macro library, as -XMshown in Appendix F. The purpose here is to describe the elements -Xof these tables. - - - - - 6-23 - - - - -CP/M Operating System Manual 6.10 Disk Parameter Tables - - - - MIn general, each disk drive has an associated (16-byte) disk -XMparameter header that contains information about the disk drive and -XMprovides a scratch pad area for certain BDOS operations. The format -XMof the disk parameter header for each drive is shown in Figure 6-2, -Xwhere each element is a word (16-bit) value. - - - -XLT 0000 0000 0000 DIRBUF DPB CSV ALV -16b 16b 16b 16b 16b 16b 16b 16b - - -W Figure 6-2. Disk Parameter Header Format - - - - MThe meaning of each Disk Parameter Header (DPH) element is -Xdetailed in Table 6-7. - - -W Table 6-7. Disk Parameter Headers - - Disk Parameter Meaning - Header - 9 F0 - XLT MAddress of the logical-to-physical -X Mtranslation vector, if used for this -X Mparticular drive, or the value 0000H if no -X Msector translation takes place (that is, -X Mthe physical and logical sector numbers -X Mare the same). Disk drives with identical -X Msector skew factors share the same -X translate tables. - - 0000 MScratch pad values for use within the -X BDOS, initial value is unimportant. - - DIRBUF MAddress of a 128-byte scratch pad area for -X Mdirectory operations within BDOS. All -X DPHs address the same scratch pad area. - - DPB MAddress of a disk parameter block for this -X Mdrive. Drives with identical disk -X Mcharacteristics address the same disk -X parameter block. - - CSV MAddress of a scratch pad area used for -X Msoftware check for changed disks. This -X address is different for each DPH. - - ALV MAddress of a scratch pad area used by the -X MBDOS to keep disk storage allocation -X Minformation. This address is different -X for each DPH. - - - 6-24 - - - - 9 K0 - -CP/M Operating System Manual 6.10 Disk Parameter Tables - - - - MGiven n disk drives, the DPHs are arranged in a table whose -XMfirst row of 16 bytes corresponds to drive 0, with the last row -XMcorresponding to drive n-1. In the following figure the lable -XDPBASE defines the base address of the DPH table. - - - - DPBASE: - - 00 XLT 00 0000 0000 0000 DIRBUF DBP 00 CSV 00 ALV 00 - - 01 XLT 01 0000 0000 0000 DIRBUF DBP 01 CSV 01 ALV 01 - . - . - . - n-1 XLTn-1 0000 0000 0000 DIRBUF DBTn-1 CSVn-1 ALVn-1 - - -W Figure 6-3. Disk Parameter Header Table - - - - MA responsibility of the SELDSK subroutine is to return the base -XMaddress of the DPH for the selected drive. The following sequence -XMof operations returns the table address, with a 0000H returned if -Xthe selected drive does not exist. - - - NDISKS EQU 4 ;NUMBER OF DISK DRIVES - ..... - SELDSK: ;SELECT DISK GIVEN BY BC - LSI H,0000H ;ERROR CODE - MOV A,C ;DRIVE OK? - CPI NDISKS ;CY IF SO - RNC ;RET IF ERROR - ;NO ERROR, CONTINUE - MOV L,C ;LOW(DISK) - MOV H,B ;HIGH(DISK) - DAD H ;*2 - DAD H ;*4 - DAD H ;*8 - DAD H ;*16 - LXI D,DPBASE;FIRST DPH - DAD D ;DPH(DISK) - RET - - - MThe translation vectors, XLT 00 through XLTn-1, are located -XMelsewhere in the BIOS, and simply correspond one-for-one with the -XMlogical sector numbers zero through the sector count 1. The Disk -XMParameter Block (DPB) for each drive is more complex. As shown in -XMFigure 6-4, particular DPB, that is addressed by one or more DPHs, -Xtakes the general form: - - - - 6-25 - - - - - -CP/M Operating System Manual 6.10 Disk Parameter Tables - - - SPT BSH BLM EXM DSM DRM AL0 AL1 CKS 0FF - 16b 8b 8b 8b 16b 16b 8b 8b 16b 16b - - -W Figure 6-4. Disk Parameter Block Format - - - -Mwhere each is a byte or word value, as shown by the 8b or 16b -Xindicator below the field. - - The following field abbreviations are used in Figure 6-4: - - - o SPT is the total number of sectors per track. - - o MBSH is the data allocation block shift factor, determined by -X the data block allocation size. - - o BLM is the data allocation block mask (2[BSH-1]). - - o MEXM is the extent mask, determined by the data block allocation -X size and the number of disk blocks. - - o DSM determines the total storage capacity of the disk drive. - - o MDRM determines the total number of directory entries that can -X Mbe stored on this drive. AL0, AL1 determine reserved directory -X blocks. - - o CKS is the size of the directory check vector. - - o M0FF is the number of reserved tracks at the beginning of the -X (logical) disk. - -MThe values of BSH and BLM determine the data allocation size BLS, -XMwhich is not an entry in the DPB. Given that the designer has -XMselected a value for BLS, the values of BSH and BLM are shown Table -X6-8. - - -W Table 6-8. BSH and BLM Values - - BLS BSH BLM - - 1024 3 7 - 2048 4 15 - 4096 5 31 - 8192 6 63 - 16,384 7 127 - - -Mwhere all values are in decimal. The value of EXM depends upon both -XMthe BLS and whether the DSM value is less than 256 or greater than -X255, as shown in Table 6-9. - - - 6-26 - - - - - -CP/M Operating System Manual 6.10 Disk Parameter Tables - - -W Table 6-9. EXM Values - - BLS EXM values - - DSM<256 DSM>255 - - 1024 0 N/A - 2048 1 0 - 4096 3 1 - 8192 7 3 - 16,384 15 7 - - - MThe value of DSM is the maximum data block number supported by -XMthis particular drive, measured in BLS units. The product (DSM+1) -XMis the total number of bytes held by the drive and must be within -XMthe capacity of the physical disk, not counting the reserved -Xoperating system tracks. - - MThe DRM entry is the one less than the total number of -XMdirectory entries that can take on a 16-bit value. The values of -XMAL0 and AL1, however, are determined by DRM. The values AL0 and AL1 -XMcan together be considered a string of 16-bits, as shown in Figure -X6-5. - - - - AL0 AL1 - - 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 - - -W Figure 6-5. AL0 and AL1 - - - - MPosition 00 corresponds to the high-order bit of the byte -XMlabeled AL0 and 15 corresponds to the low-order bit of the byte -XMlabeled AL1. Each bit position reserves a data block for number of -XMdirectory entries, thus allowing a total of 16 data blocks to be -XMassigned for directory entries (bits are assigned starting at 00 and -XMfilled to the right until position 15). Each directory entry -Xoccupies 32 bytes, resulting in the following tabulation: - - -W Table 6-10. BLS Tabulation - - BLS Directory Entries - - 1024 32 times # bits - 2048 64 times # bits - 4096 128 times # bits - 8192 256 times # bits - 16,384 512 times # bits - - - - 6-27 - - - - - -CP/M Operating System Manual 6.10 Disk Parameter Tables - - - - MThus, if DRM = 127 (128 directory entries) and BLS = 1024, -XMthere are 32 directory entries per block, requiring 4 reserved -XMblocks. In this case, the 4 high-order bits of AL0 are set, -Xresulting in the values AL0 = 0F0H and AL1 = 00H. - - MThe CKS value is determined as follows: if the disk drive -XMmedia is removable, then CKS = (DRM+1)/4, where DRM is the last -XMdirectory entry number. If the media are fixed, then set CKS = 0 -X(no directory records are checked in this case). - - MFinally, the 0FF field determines the number of tracks that are -XMskipped at the beginning of the physical disk. This value is -XMautomatically added whenever SETTRK is called and can be used as a -XMmechanism for skipping reserved operating system tracks or for -Xpartitioning a large disk into smaller segmented sections. - - MTo complete the discussion of the DPB, several DPHs can address -XMthe same DPB if their drive characteristics are identical. Further, -XMthe DPB can be dynamically changed when a new drive is addressed by -XMsimply changing the pointer in the DPH; because the BDOS copies the -XMDPB values to a local area whenever the SELDSK function is invoked. -X - MReturning back to DPH for a particular drive, the two address -XMvalues CSV and ALV remain. Both addresses reference an area of -XMuninitialized memory following the BIOS. The areas must be unique -XMfor each drive, and the size of each area is determined by the -Xvalues in the DPB. - - MThe size of the area addressed by CSV is CKS bytes, which is -XMsufficient to hold the directory check information for this -XMparticular drive, If CKS = (DRM+1)/4, you must reserve (DRM+1)/4 -XMbytes for directory check use. If CKS = 0, no storage is reserved. -X - MThe size of the area addressed by ALV is determined by the -XMmaximum number of data blocks allowed for this particular disk and -Xis computed as (DSM/8)+1. - - MThe CBIOS shown in Appendix B demonstrates an instance of these -XMtables for standard 8-inch, single-density drives. It might be -XMuseful to examine this program and compare the tabular values with -Xthe definitions given above. - - -W6.11 The DISKDEF Macro Library - - MA&S macro library called DISKDEF (shown in Appendix F), greatly -XMsimplifies the table construction process. You must have access to -XMthe MAC macro assembler, of course, to use the DISKDEF facility, -XMwhile the macro library is included with all CP.M 2 distribution -Xdisks. - - - - - - - 6-28 - - - - - -CP/M Operating System Manual 6.11 The DISKDEF Macro Library - - - - MA BIOS disk definition consists of the following sequence of -Xmacro statements: - - MACLIB DISKDEF - ..... - DISKS n - DISKDEF 0,... - DISKDEF 1,... - ..... - DISKDEF n-1 - ..... - ENDEF - -Mwhere the MACLIB statement loads the DISKDEF.LIB file, on the same -XMdisk as the BIOS, into MAC's internal tables. The DISKS macro call -XMfollows, which specifies the number of drives to be configured with -XMthe user's system, where n is an integer in the range 1 to 16. A -XMseries of DISKDEF macro calls then follow that define the -XMcharacteristics of each logical disk, 0 through n-1, corresponding -XMto logical drives A through P. The DISKS and DISKDEF macros -XMgenerate the in-line fixed data tables described in the previous -XMsection and thus must be placed in a nonexecutable portion of the -XBIOS, typically directly following the BIOS jump vector. - - MThe remaining portion of the BIOS is defined following the -XMDISKDEF macros, with the ENDEF macro call immediately preceding the -XMEND statement. The ENDEF (End of Diskdef) macro generates the -XMnecessary uninitialized RAM areas that are located in memory above -Xthe BIOS. - - The DISKDEF macro call takes the form: - - DISKDEF dn,fsc,lsc,[skf],bls dks,dir,cks,ofs,[0] - -where - - o dn is the logical disk number, 0 to n-1. - o fsc is the first physical sector number (0 or 1). - o lsc is the last sector number. - o skf is the optional sector skew factor. - o bls is the data allocation block size. - o dks is the number of blocks on the disk. - o dir is the number of directory entries. - o cks is the number of checked directory entries. - o ofs is the track offset to logical track 00. - o [0] is an optional 1.4 compatibility flag. - - - MThe value dn is the drive number being defined with this -XMDISKDEF macro invocation. The fsc parameter accounts for differing -XMsector numbering systems and is usually 0 to 1. The lsc is the last -XMnumbered sector on a track. When present, the skf parameter defines -XMthe sector skew factor, which is used to create a sector translation -Xtable according to the skew. - - - 6-29 - - - - - -CP/M Operating System Manual 6.11 The DISKDEF Macro Library - - - - MIf the number of sectors is less than 256, a single-byte table -XMis created, otherwise each translation table element occupies two -XMbytes. No translation table is created if the skf parameter is -Xomitted, or equal to 0. - - MThe bls parameter specifies the number of bytes allocated to -XMeach data block, and takes on the values 1024, 2048, 4096, 8192, or -XM16384. Generally, performance increases with larger data block -XMsizes because there are fewer directory references, and logically -XMconnected data records are physically close on the disk. Further, -XMeach directory entry addresses more data and the BIOS-resident RAM -Xspace is reduced. - - MThe dks parameter specifies the total disk size in bls units. -XMThat is, if the bls = 2048 and dks = 1000, the total disk capacity -XMis 2,048,000 bytes. If dks is greater than 255, the block size -XMparameter bls must be greater than 1024. The value of dir is the -XMtotal number of directory entries that might exceed 255, if desired. -X - MThe cks parameter determines the number of directory items to -XMcheck on each directory scan and is used internally to detect -XMchanged disks during system operation, where an intervening cold or -XMwarm start has not occurred. When this situation is detected, CP/M -XMautomatically marks the disk Read-Only so that data is not -Xsubsequently destroyed. - - MAs stated in the previous section, the value of cks = dir when -XMthe medium is easily changed, as is the case with a floppy disk -XMsubsystem. If the disk is permanently mounted, the value of cks is -XMtypically 0, because the probability of changing disks without a -Xrestart is low. - - MThe ofs value determines the number of tracks to skip when this -XMparticular drive is addressed, which can be used to reserve -XMadditional operating system space or to simulate several logical -XMdrives on a single large capacity physical drive. Finally, the [0] -XMparameter is included when file compatibility is required with -XMversions of 1.4 that have been modified for higher density disks. -XMThis parameter ensures that only 16K is allocated for each directory -XMrecord, as was the case for previous versions. Normally, this -Xparameter is not included. - - For convenience and economy of table space, the special form: - - DISKDEF i,j - -Mgives disk i the same characteristics as a previously defined drive -XMj. A standard four-drive, single-density system, which is -XMcompatible with version 1.4, is defined using the following macro -Xinvocations: - - DISKS 4 - DISKDEF 0,1,26,6,1024,243,64,2 - DISKDEF 1,0 - - - 6-30 - - - - - -CP/M Operating System Manual 6.11 The DISKDEF Macro Library - - - DISKDEF 2,0 - DISKDEF 3,0 - .... - ENDEF - -Mwith all disks having the same parameter values of 26 sectors per -XMtrack, numbered 1 through 26, with 6 sectors skipped between each -XMaccess, 1024 bytes per data block, 243 data blocks for a total of -XM243K-byte disk capacity, 64 checked directory entries, and two -Xoperating system tracks. - - MThe DISKS macro generates n DPHs, starting at the DPH table -XMaddress DPBASE generated by the macro. Each disk header block -XMcontains sixteen bytes, as described above, and correspond one-for- -XMone to each of the defined drives. In the four-drive standard -Xsystem, for example, the DISKS macro generates a table of the form: - - DPBASE EQU$ - DPE0: DW XLT0,0000H,0000H,0000H,DIRBUF,DPB0,CSV0,ALV0 - DPE1: DW XLT0,0000H,0000H,0000H,DIRBUF,DPB0,CSV1,ALV1 - DPE2: DW XLT0,0000H,0000H,0000H,DIRBUF,DPB0,CSV2,ALV2 - DPE3: DW XLT0,0000H,0000H,0000H,DIRBUF,DPB0,CSV3,ALV3 - -Mwhere the DPH labels are included for reference purposes to show the -XMbeginning table addresses for each drive 0 through 3. The values -XMcontained within the DPH are described in detail in the previous -XMsection. The check and allocation vector addresses are generated by -XMthe ENDEF macro in the ram area following the BIOS code and tables. -X - MNote that if the skf (skew factor) parameter is omitted, or -XMequal to 0, the translation table is omitted and a 0000H value is -XMinserted in the XLT position of the DPH for the disk. In a -XMsubsequent call to perform the logical-to-physical translation, -XMSECTRAN receives a translation table address of DE = 0000H and -XMsimply returns the original logical sector from BC in the HL -Xregister pair. - - MA translate table is constructed when the skf parameter is -XMpresent, and the (nonzero) table address is placed into the -XMcorresponding DPHs. The following for example, is constructed when -XMthe standard skew factor skf = 6 is specified in the DISKDEF macro -Xcall: - - XLT0: DB 1,7,13,19,25,5,11,17,23,3,9,15,21 - DB 2,8,14,20,26,6,12,18,24,4,10,16,22 - - MFollowing the ENDEF macro call, a number of uninitialized data -XMareas are defined. These data areas need not be a part of the BIOS -XMthat is loaded upon cold start, but must be available between the -XMBIOS and the end of memory. The size of the uninitialized RAM area -XMis determined by EQU statements generated by the ENDEF macro. For a -XMstandard four-drive system, the ENDEF macro might produce the -Xfollowing EQU statement: - - - - - 6-31 - - - - - -CP/M Operating System Manual 6.11 The DISKDEF Macro Library - - - 4C72 = BEGDAT EQU $ - (data areas) - - 4DB0 = ENDDAT EQU $ - - 013C = DATSIZ EQU $-BEGDAT - -Mwhich indicates that uninitialized RAM begins at location 4C72H, -XMends at 4DB0H-1, and occupies 013CH bytes. You must ensure that -Xthese addresses are free for use after the system is loaded. - - MAfter modification, you can use the STAT program to check drive -XMcharacteristics, because STAT uses the disk parameter block to -Xdecode the drive information. A STAT command of the form: - - STAT d:DSK: - -Mdecodes the disk parameter block for drive d (d=A,...,P) and -Xdisplays the following values: - - - r: 128-byte record capacity - k: kilobyte drive capacity - d: 32-byte directory entries - c: checked directory entries - e: records/extent - b: records/block - s: sectors/track - t: reserved tracks - - - MThree examples of DISKDEF macro invocations are shown below -XMwith corresponding STAT parameter values. The last example produces -Xa full 8-megabyte system. - - DISKDEF 0,1,58,,2048,256,128,128,2 - r=4096, k=512, d=128, c=128, e=256, b=16, s=58, t=2 - - DISKDEF 0,1,58,,2048,1024,300,0,2 - r=16348, k=2048, d=300, c=0, e=128, b=16, s=58, t=2 - - DISKDEF 0,1,58,,16348,512,128,128,2 - r=65536, k=8192, d=128, c=128, e=1024, b=128, s=58, t=2 - - -W6.12 Sector Blocking and Deblocking - - MU&Spon each call to BIOS WRITE entry point, the CP/M BDOS -XMincludes information that allows effective sector blocking and -XMdeblocking where the host disk subsystem has a sector size that is a -XMmultiple of the basic 128-byte unit. The purpose here is to present -XMa general-purpose algorithm that can be included within the BIOS and -XMthat uses the BDOS information to perform the operations -Xautomatically. - - - - 6-32 - - - - - -CP/M Operating System Manual 6.12 Blocking and Deblocking - - - MOn each call to WRITE, the BDOS provides the following -Xinformation in register C: - - 0 = (normal sector write) - 1 = (write to directory sector) - 2 = (write to the first sector - of a new data block) - - MCondition 0 occurs whenever the next write operation is into a -XMpreviously written area, such as a random mode record update; when -XMthe write is to other than the first sector of an unallocated block; -XMor when the write is not into the directory area. Condition 1 -XMoccurs when a write into the directory area is performed. Condition -XM2 occurs when the first record (only) of a newly allocated data -XMblock is written. In most cases, application programs read or write -XMmultiple 128-byte sectors in sequence; thus, there is little -XMoverhead involved in either operation when blocking and deblocking -XMrecords, because preread operations can be avoided when writing -Xrecords. - - MAppendix G lists the blocking and deblocking algorithms in -XMskeletal form; this file is included on your CP/M disk. Generally, -XMthe algorithms map all CP/M sector read operations onto the host -XMdisk through an intermediate buffer that is the size of the host -XMdisk sector. Throughout the program, values and variables that -XMrelate to the CP/M sector involved in a seek operation are prefixed -XMby sek, while those related to the host disk system are prefixed by -XMhst. The equate statements beginning on line 29 of Appendix G -XMdefine the mapping between CP/M and the host system, and must be -Xchanged if other than the sample host system is involved. - - MThe entry points BOOT and WBOOT must contain the initialization -XMcode starting on line 57, while the SELDSK entry point must be -XMaugmented by the code starting on line 65. Note that although the -XMSELDSK entry point computes and returns the Disk Parameter Header -XMaddress, it does not physically select the host disk at this point -XM(it is selected later at READHST or WRITEHST). Further, SETTRK, -XMSETTRK, and SETMA simply store the values, but do not take any other -XMaction at this point. SECTRAN performs a trivial function of -Xreturning the physical sector number. - - MThe principal entry points are READ and WRITE, starting on -XMlines 110 and 125, respectively. These subroutines take the place -Xof your previous READ and WRITE operations. - - MThe actual physical read or write takes place at either -XMWRITEHST or READHST, where all values have been prepared: hstdsk is -XMthe host disk number, hsttrk is the host track number, and hstsec is -XMthe host sector number, which may require translation to physical -XMsector number. You must insert code at this point that performs the -XMfull sector read or write into or out of the buffer at hstbuf of -XMlength hstsiz. All other mapping functions are performed by the -Xalgorithms. - - - - - 6-33 - - - - - -CP/M Operating System Manual 6.12 Blocking and Deblocking - - - MThis particular algorithm was tested using an 80-megabyte hard -XMdisk unit that was originally configured for 128-byte sectors, -XMproducing approximately 35 megabytes of formatted storage. When -XMconfigured for 512-byte host sectors, usable storage increased to 57 -XMmegabytes, with a corresponding 400% improvement in overall -XMresponse. In this situation, there is no apparent overhead involved -XMin deblocking sectors, with the advantage that user programs still -XMmaintain 128-byte sectors. This is primarily because of the -XMinformation provided by the BDOS, which eliminates the necessity for -Xpreread operations. - - -=End of Section 6 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 6-34 - - - - \ No newline at end of file diff --git a/Source/Doc/CPM 22 Manual - Testing/part1.tex b/Source/Doc/CPM 22 Manual - Testing/part1.tex deleted file mode 100644 index 7e98c4ef..00000000 --- a/Source/Doc/CPM 22 Manual - Testing/part1.tex +++ /dev/null @@ -1,2 +0,0 @@ -.nx front - \ No newline at end of file diff --git a/Source/Doc/CPM 22 Manual - Testing/part1.txt b/Source/Doc/CPM 22 Manual - Testing/part1.txt deleted file mode 100644 index e30fd5c9..00000000 --- a/Source/Doc/CPM 22 Manual - Testing/part1.txt +++ /dev/null @@ -1,13350 +0,0 @@ - N - - - - - - - - - - - - - - - - - - - - - -CP/M - -Operating System - -Manual - - - - - - - - - - -Copyright (c) 1982 - -Digital Research -P.O. Box 579 -160 Central Avenue -Pacific Grove, CA 93950 -(408) 649-3896 -TWX 910 360 5001 - - - - -All Rights Reserved - - - - - - - - - - - - - - - - - -C - - - - - - -COPYRIGHT - -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. - -Thus, readers are granted permission to include the -example programs, either in whole or in part, in -their own programs. - - -DISCLAIMER - -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. - - -TRADEMARKS - -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. - - - -The CP/M Operating System Manual was prepared using -the Digital Research TEX Text Formatter and printed -in the United States of America. - - -********************************* -* First Edition: 1976 * -* Second Edition: July 1982 * -* Third Edition: March 1983 * -* Fourth Edition: March 1984 * -********************************* - - - - - K - - - - - -Table of Contents - - - -1 CP/M Features and Facilities - - 1.1 Introduction . . . . . . . . . . . . . . . . . . . 1-1 - - 1.2 Functional Description . . . . . . . . . . . . . . 1-3 - - 1.2.1 General Command Structure . . . . . . . . . 1-3 - 1.2.2 File References . . . . . . . . . . . . . . 1-3 - - 1.3 Switching Disks . . . . . . . . . . . . . . . . . . 1-5 - 1.4 Built-in Commands . . . . . . . . . . . . . . . . . 1-6 - - 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 - - 1.5 Line Editing and Output Control . . . . . . . . . . 1-10 - - 1.6 Transient Commands . . . . . . . . . . . . . . . . 1-11 - - 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 - - 1.7 BDOS Error Messages . . . . . . . . . . . . . . . . 1-37 - - 1.8 CP/M Operation on the Model 800 . . . . . . . . . . 1-38 - - -2 The CP/M Editor - - 2.1 Introduction to ED . . . . . . . . . . . . . . . . 2-1 - - 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 - - - iii - - - - - - - - -Table of Contents - -(continued) - - - - 2.2 ED Error Conditions . . . . . . . . . . . . . . . . 2-14 - - 2.3 Control Characters and Commands . . . . . . . . . . 2-16 - - -3 CP/M Assembler - - 3.1 Introduction . . . . . . . . . . . . . . . . . . . 3-1 - - 3.2 Program Format . . . . . . . . . . . . . . . . . . 3-3 - - 3.3 Forming the Operand . . . . . . . . . . . . . . . . 3-4 - - 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 - - 3.4 Assembler Directives . . . . . . . . . . . . . . . 3-9 - - 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 - - 3.5 Operation Codes . . . . . . . . . . . . . . . . . . 3-15 - - 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 - - 3.6 Error Messages . . . . . . . . . . . . . . . . . . 3-21 - - 3.7 A Sample Session . . . . . . . . . . . . . . . . . 3-23 - - - - - - - - - iv - - - - - - - - -Table of Contents - -(continued) - - - -4 CP/M Dynamic Debugging Tool - - 4.1 Introduction . . . . . . . . . . . . . . . . . . . 4-1 - - 4.2 DDT Commands . . . . . . . . . . . . . . . . . . . 4-3 - - 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 - - 4.3 Implementation Notes . . . . . . . . . . . . . . . 4-10 - - 4.4 A Sample Program . . . . . . . . . . . . . . . . . 4-11 - - -5 CP/M 2 System Interface - - 5.1 Introduction . . . . . . . . . . . . . . . . . . . 5-1 - - 5.2 Operating System Call Conventions . . . . . . . . . 5-3 - - 5.3 A Sample File-to-File Copy Program . . . . . . . . 5-35 - - 5.4 A Sample File Dump Utility . . . . . . . . . . . . 5-38 - - 5.5 A Sample Random Access Program . . . . . . . . . . 5-42 - - 5.6 System Function Summary . . . . . . . . . . . . . . 5-50 - - -6 CP/M 2 Alteration - - 6.1 Introduction . . . . . . . . . . . . . . . . . . . 6-1 - - 6.2 First-level System Regeneration . . . . . . . . . . 6-2 - - 6.3 Second-level System Generation . . . . . . . . . . 6-5 - - 6.4 Sample GETSYS and PUTSYS Programs . . . . . . . . . 6-9 - - - - v - - - - - - - - -Table of Contents - -(continued) - - - - 6.5 Disk Organization . . . . . . . . . . . . . . . . . 6-11 - - 6.6 The BIOS Entry Points . . . . . . . . . . . . . . . 6-13 - - 6.7 A Sample BIOS . . . . . . . . . . . . . . . . . . . 6-21 - - 6.8 A Sample Cold Start Loader . . . . . . . . . . . . 6-21 - - 6.9 Reserved Locations in Page Zero . . . . . . . . . . 6-22 - - 6.10 Disk Parameter Tables . . . . . . . . . . . . . . 6-23 - - 6.11 The DISKDEF Macro Library . . . . . . . . . . . . 6-28 - - 6.12 Sector Blocking and Deblocking . . . . . . . . . . 6-32 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - vi - - - - - - - - -Appendixes - - - -A Basic Input/Output System (BIOS) . . . . . . . . . . . A-1 - - -B A Skeletal CBIOS . . . . . . . . . . . . . . . . . . . B-1 - - -C A Skeletal GETSYS/PUTSYS Program . . . . . . . . . . . C-1 - - -D The Model 800 Cold Start Loader for CP/M 2 . . . . . . D-1 - - -E A Skeletal Cold Start Loader . . . . . . . . . . . . . E-1 - - -F CP/M Disk Definition Library . . . . . . . . . . . . . F-1 - - -G Blocking and Deblocking Algorithms . . . . . . . . . . G-1 - - -H Glossary . . . . . . . . . . . . . . . . . . . . . . . H-1 - - -I CP/M Error Messages . . . . . . . . . . . . . . . . . . I-1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - vii - - - - - - - - -Tables, Figures, and Listings - - - -Tables - - 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 - - 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 - - 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 - - 4-1. Line-editing Controls . . . . . . . . . . . . . 4-2 - 4-2. DDT Commands . . . . . . . . . . . . . . . . . 4-2 - 4-3. CPU Registers . . . . . . . . . . . . . . . . . 4-9 - - 5-1. CP/M Filetypes . . . . . . . . . . . . . . . . 5-6 - 5-2. File Control Block Fields . . . . . . . . . . . 5-7 - 5-3. Edit Control Characters . . . . . . . . . . . . 5-20 - - 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 - - I-1. CP/M Error Messages . . . . . . . . . . . . . . I-1 - - -Figures - - 2-1. Overall ED Operation . . . . . . . . . . . . . 2-2 - 2-2. Memory Buffer Organization . . . . . . . . . . 2-2 - - - viii - - - - - - - - -Tables, Figures, and Listings - -(continued) - - - -Figures - - 2-3. Logical Organization of Memory Buffer . . . . . 2-4 - - 5-1. CP/M Memory Organization . . . . . . . . . . . 5-1 - 5-2. File Control Block Format . . . . . . . . . . . 5-7 - - 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 - - -Listings - - 6-1. GETSYS Program . . . . . . . . . . . . . . . . 6-9 - 6-2. BIOS Entry Points . . . . . . . . . . . . . . . 6-13 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ix - - - - - - - - -Section 1 - -CP/M Features and Facilities - - - -1.1 Introduction - - 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. - - 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. - - 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. - - 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. - - 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. - - - - 1-1 - - - - - -CP/M Operating System Manual 1.1 Introduction - - - CP/M is logically divided into several distinct parts: - - o BIOS (Basic I/O System), hardware-dependent - o BDOS (Basic Disk Operating System) - o CCP (Console Command Processor) - o TPA (Transient Program Area) - - 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: - - o SEARCH looks for a particular disk file by name. - o OPEN opens a file for further operations. - o CLOSE closes a file after processing. - o RENAME changes the name of a particular file. - o READ reads a record from a particular file. - o WRITE writes a record to a particular file. - o SELECT selects a particular disk drive for further operations. - - 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. - - 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. - - 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. - - 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. - - - 1-2 - - - - - -CP/M Operating System Manual 1.2 Functional Description - - -1.2 Functional Description - - 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: - - CP/M VER x.x - -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. - - -1.2.1 General Command Structure - - 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: - - 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. - -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. - - -1.2.2 File References - - 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. - - 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: - - 1-3 - - - - - -CP/M Operating System Manual 1.2 Functional Description - - - filename.typ - -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 - - filename - -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: - - < > . , ; : = ? * [ ] _ % | ( ) / \textbackslash - -while all alphanumerics and remaining special characters are -allowed. - - 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 - - X?Z.C?M - -matches the following unambiguous filenames - - XYZ.COM - -and - - X3Z.CAM - -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 - - *.* - -equals the ambiguous file reference - - ????????.??? - -while - - filename.* - -and - - *.typ - -are abbreviations for - - filename.??? - - - 1-4 - - - - - -CP/M Operating System Manual 1.2 Functional Description - - - -and - - ????????.typ - -respectively. As an example, - - A>DIR *.* - -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: - - A>DIR X,Y - -Similarly, the command - - A>DIR X?Y.C?M - -causes a search for all unambiguous filenames on the disk that -satisfy this ambiguous reference. - - The following file references are valid unambiguous file -references: - - X - X.Y - XYZ - XYZ.COM - GAMMA - GAMMA.1 - - 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: - - A:X.Y - P:XYZ.COM - B:XYZ - B:X.A?M - C:GAMMA - C:*.ASM - -All alphabetic lower-case letters in file and drive names are -translated to upper-case when they are processed by the CCP. - - -1.3 Switching Disks - - 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: - - 1-5 - - - - - -CP/M Operating System Manual 1.3 Switching Disks - - - - CP/M VER 2.2 - A>DIR List all files on disk A. - A:SAMPLE ASM SAMPLE PRN - A>B: Switch to disk B. - B>DIR *.ASM List all ASM files on B. - B:DUMP ASM FILES ASM - b>A: Switch back to A. - - -1.4 Built-in Commands - - 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: - - ufn unambiguous file reference - afn ambiguous file reference - -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. - - -1.4.1 ERA Command - -Syntax: - - ERA afn - - 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: - - - ERA X.Y The file named X.Y on the currently logged - disk is removed from the disk directory and - the space is returned. - - ERA X.* All files with primary name X are removed - from the current disk. - - ERA *.ASM All files with secondary name ASM are - removed from the current disk. - - ERA X?Y.C?M All files on the current disk that satisfy - the ambiguous reference X?Y.C?M are - deleted. - - - - - - - 1-6 - - - - - -CP/M Operating System Manual 1.4 Built-in Commands - - - ERA *.* Erase all files on the current disk. In - this case, the CCP prompts the console with - the message - - ALL FILES (Y/N)? - - which requires a Y response before files - are actually removed. - - ERA b:*.PRN All files on drive B that satisfy the - ambiguous reference ????????.PRN are - deleted, independently of the currently - logged disk. - - - -1.4.2 DIR Command - -Syntax: - - DIR afn - - 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 - - DIR - -lists the files on the currently logged disk (the command DIR is -equivalent to the command DIR *.*). The following are valid DIR -commands: - - DIR X.Y - DIR X?Z.C?M - DIR ??.Y - - 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: - - DIR B: - DIR B:X.Y - DIR B:*.A?M - - If no files on the selected disk satisfy the directory request, -the message NO FILE appears at the console. - - - - - - - - - - - - 1-7 - - - - - -CP/M Operating System Manual 1.4 Built-in Commands - - -1.4.3 REN Command - -Syntax: - - REN ufn1=ufn2 - - 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: - - - REN X.Y=Q.R The file Q.R is changed to X.Y. - - REN XYZ.COM=XYZ.XXX The file XYZ.XXX is changed to - XYZ.COM. - - - 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: - - - REN A:X.ASM=Y.ASM The file Y.ASM is changed to X.ASM - on drive A. - - REN B:ZAP.BAS=ZOT.BAS The file ZOT.BAS is changed to - ZAP.BAS on drive B. - - REN B:A.ASM=B:A.BAK The file A.BAK is renamed to A.ASM - on drive B. - - - 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. - - -1.4.4 SAVE Command - -Syntax: - - SAVE n ufn - - 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 - - - 1-8 - - - - - -CP/M Operating System Manual 1.4 Built-in Commands - - -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: - - - SAVE 3X.COM Copies 100H through 3FFH to X.COM. - - 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. - - SAVE 4 X.Y Copies 100H through 4FFH to X.Y. - - -The SAVE command can also specify a disk drive in the ufn portion of -the command, as shown in the following example: - - SAVE 10 B:ZOT.COM Copies 10 pages, 100H through 0AFFH, - to the file ZOT.COM on drive B. - - - -1.4.5 TYPE Command - -Syntax: - - TYPE ufn - - 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: - - TYPE X.Y - TYPE X.PLM - TYPE XXX - - 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. - - TYPE B:X.PRN The file X.PRN from drive B is displayed. - - -1.4.6 USER Command - -Syntax: - - USER n - - 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 - - - 1-9 - - - - - -CP/M Operating System Manual 1.4 Built-in Commands - - -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. - - The active user number is maintained until changed by a -subsequent USER command, or until a cold start when user 0 is again -assumed. - - -1.5 Line Editing and Output Control - - 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. - - -Table 1-1. Line-editing Control Characters - - F - Character Meaning - - CTRL-C Reboots CP/M system when pressed at start of - line. - - CTRL-E Physical end of line; carriage is returned, - but line is not sent until the carriage - return key is pressed. - - CTRL-H Backspaces one character position. - - CTRL-J Terminates current input (line feed). - - CTRL-M Terminates current input (carriage return). - - 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. - - CTRL-R Retypes current command line; types a clean - line following character deletion with - rubouts. - - 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. - - - - 1-10 - - - - K - - -CP/M Operating System Manual 1.5 Line Editing and Output Control - - -Table 1-1. (continued) - - F - Character Meaning - - CTRL-U Deletes the entire line typed at the - console. - - CTRL-X Same as CTRL-U. - - CTRL-Z Ends input from the console (used in PIP and - ED). - - RUB/DEL Deletes and echoes the last character typed - at the console. - K - - -1.6 Transient Commands - - 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). - - -Table 1-2. CP/M Transient Commands - - F - Command Function - - 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. - - ASM Loads the CP/M assembler and assembles the - specified program from disk. - - 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. - - DDT Loads the CP/M debugger into TPA and starts - execution. - - PIP Loads the Peripheral Interchange Program for - subsequent disk file and peripheral transfer - operations. - - ED Loads and executes the CP/M text editor - program. - - SYSGEN Creates a new CP/M system disk. - - - - 1-11 - - - - K - - -CP/M Operating System Manual 1.6 Transient Commands - - -Table 1-2. (continued) - - F - Command Function - - SUBMIT Submits a file of commands for batch - processing. - - DUMP Dumps the contents of a file in hex. - - MOVCPM Regenerates the CP/M system for a particular - memory size. - - K - - 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 - - B:STAT - -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. - - -1.6.1 STAT Command - -Syntax: - - STAT - STAT "command line" - - 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. - - - 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: - - d: R/W, SPACE: nnnK - - d: R/O, SPACE: nnnK - - 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 - - - 1-12 - - - - - -CP/M Operating System Manual 1.6 Transient Commands - - - performing a warm start). The space - remaining on the disk in drive d: is given - in kilobytes by nnn. - - 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 - - BYTES REMAINING ON B: nnnK - - 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: - - RECS BYTES EXT D:FILENAME.TYP - rrrr bbbK ee d:filename.typ - - 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. - - 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. - - 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 - - BDOS ERR ON d: Read-Only - - 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. - - - - - - - - - 1-13 - - - - - -CP/M Operating System Manual 1.6 Transient Commands - - - - 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: - - - o CON: is the system console device, used by CCP for - communication with the operator. - - o RDR: is the paper tape reader device. - - o PUN: is the paper tape punch device. - - o LST: is the output list device. - - - 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. - - -Table 1-3. Physical Devices - F - - Device Meaning - - TTY: Teletype device (slow speed console) - - CRT: Cathode ray tube device (high speed console) - - BAT: Batch processing (console is current RDR:, - output goes to current LST: device) - - UC1: User-defined console - - PTR: Paper tape reader (high speed reader) - - UR1: User-defined reader #1 - - UR2: User-defined reader #2 - - PTP: Paper tape punch (high speed punch) - - UP1: User-defined punch #1 - - UP2: User-defined punch #2 - - LPT: Line printer - - UL1: User-defined list device #1 - K - - - - 1-14 - - - - - -CP/M Operating System Manual 1.6 Transient Commands - - - - 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. - - The command, - - STAT VAL: - -produces a summary of the available status commands, resulting in -the output: - - Temp R/O Disk d:$R/O - Set Indicator: filename.typ $R/O $R/W $SYS $DIR - Disk Status: DSK: d:DSK - Iobyte Assign: - -which gives an instant summary of the possible STAT commands and -shows the permissible logical-to-physical device assignments: - - CON: = TTY: CRT: BAT: UC1: - RDR: = TTY: PTR: UR1: UR2: - PUN: = TTY: PTP: UP1: UP2: - LST: = TTY: CRT: LPT: UL1: - -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: - - STAT DEV: - -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: - - CON: = CRT: - RDR: = UR1: - PUN: = PTP: - LST: = TTY: - -The current logical-to-physical device assignment is changed by -typing a STAT command of the form: - - STAT ld1 = pd1, ld2 = pd2, ... , ldn = pdn - -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: - - - - 1-15 - - - - - -CP/M Operating System Manual 1.6 Transient Commands - - - STAT CON:=CRT: - STAT PUN:=TTY:, LST:=LPT:, RDR:=TTY: - - The command form, - - STAT d:filename.typ $S - -where d: is an optional drive name and filename.typ is an -unambiguous or ambiguous filename, produces the following output -display format: - - - Size Recs Bytes Ext Acc - - 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 - - -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. - - 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. - - The Acc field gives the R/O or R/W file indicator, which you -can change using the commands shown. The four command forms, - - STAT d:filename.typ $R/O - STAT d:filename.typ $R/W - STAT d:filename.typ $SYS - STAT d:filename.typ $DIR - -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 - - - 1-16 - - - - - -CP/M Operating System Manual 1.6 Transient Commands - - -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. - - When a file is marked R/O, subsequent attempts to erase or -write into the file produce the following BDOS message at your -screen: - - BDOS Err on d: File R/O - -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: - - 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 - -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. - - 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. - - 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 - - STAT DSK: - -produces a drive characteristics table for all currently active -drives. The final STAT command form is - - - - 1-17 - - - - - -CP/M Operating System Manual 1.6 Transient Commands - - - STAT USR: - -which produces a list of the user numbers that have files on the -currently addressed disk. The display format is - - Active User: 0 - Active Files: 0 1 3 - -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. - - -1.6.2 ASM Command - -Syntax: - - ASM ufn - - 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: - - ASM X - ASM GAMMA - -The two-pass assembler is automatically executed. Assembly errors -that occur during the second pass are printed at the console. - - The assembler produces a file: - - X.PRN - -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 - - - 1-18 - - - - - -CP/M Operating System Manual 1.6 Transient Commands - - - - X.HEX - -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. - - The source file for assembly is taken from an alternate disk by -prefixing the assembly language filename by a disk drive name. The -command - - ASM B:ALPHA - -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. - - -1.6.3 LOAD Command - -Syntax: - - LOAD ufn - - 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: - - X.HEX - -and only the filename X need be specified in the command. The LOAD -command creates a file named - - X.COM - -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. - - 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 - - X.COM - -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, - - 1-19 - - - - - -CP/M Operating System Manual 1.6 Transient Commands - - - - LOAD B:BETA - -brings the LOAD program into the TPA from the currently logged disk -and operates on drive B after execution begins. - -Note: 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. - - -1.6.4 PIP - -Syntax: - - PIP - PIP destination=source#1, source#2, ..., source #n - - 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: - - PIP - PIP command line - -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. - - 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 - - destination = source#1, source#2, ..., source#n - -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. - - 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 - - - 1-20 - - - - - -CP/M Operating System Manual 1.6 Transient Commands - - -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. - - 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: - - - X=Y Copies to file X from file Y, where - X and Y are unambiguous filenames; - Y remains unchanged. - - X=Y,Z Concatenates files Y and z and - copies to file X, with Y and Z - unchanged. - - X.ASM=Y.ASM,Z.ASM Creates the file X.ASM from the - concatenation of the Y and Z.ASM - files. - - NEW.ZOT=B:OLD.ZAP Moves a copy of OLD.ZAPP from drive - B to the currently logged disk; - names the file NEW.ZOT. - - 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. - - - For convenience, PIP allows abbreviated commands for -transferring files between disk drives. The abbreviated PIP forms -are - - PIP d:=afn - PIP d1=d2:afn - PIP ufn = d2: - PIP d1:ufn = d2: - -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 d2, where d2 = A...P. The third form is equivalent to -the command PIP d1:ufn=d2:ufn which copies the file given by ufn - - - 1-21 - - - - - -CP/M Operating System Manual 1.6 Transient Commands - - -from drive d2 to the file ufn on drive d1:. The fourth form is -equivalent to the third, where the source disk is explicitly given -by d2:. - - 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. - - The following PIP commands give examples of valid disk-to-disk -copy operations: - - - B:=*.COM Copies all files that have the secondary - name COM to drive B from the current drive. - - A:=B:ZAP.* Copies all files that have the primary name - ZAP to drive A from drive B. - - ZAP.ASM=B: Same as ZAP.ASM=B:ZAP.ASM - - B:ZOT.COM=A: Same as B:ZOT.COM=A:ZOT.COM - - B:=GAMMA.BAS Same as B:GAMMA.BAS=GAMMA.BAS - - B:=A:GAMMA.BAS Same as B:GAMMA.BAS=A:GAMMA.BAS - - - 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 - - CON: (console) - RDR: (reader) - PUN: (punch) - LST: (list) - -while the physical devices are - - 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) - -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. - - 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; - - - 1-22 - - - - - -CP/M Operating System Manual 1.6 Transient Commands - - -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. - - The following list describes additional device names that can -be used in PIP commands. - - - o NUL: sends 40 nulls (ASCII 0s) to the device. This can be - issued at the end of punched output. - - 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). - - 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). - - 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). - - 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]). - - - 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. - - 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. - - 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. - - - - - 1-23 - - - - - -CP/M Operating System Manual 1.6 Transient Commands - - - 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. - - 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. - - 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. - - The following are valid PIP commands: - - - PIP LST: = X.PRN - - Copies X.PRN to the LST device and - terminates the PIP program. - - PIP - - Starts PIP for a sequence of commands. PIP - prompts with *. - - *CON:=X.ASM,Y.ASM,Z.ASM - - Concatenates three ASM files and copies to - the CON device. - - *X.HEX=CON:,Y.HEX,PTR: - - 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. - - PIP PUN:=NUL:,X.ASM,EOF:,NUL: - - 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. - - (carriage return) - - A single carriage return stops PIP. - - 1-24 - - - - -CP/M Operating System Manual 1.6 Transient Commands - - - - 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. - - -Table 1-4. PIP Parameters - F - - Parameter Meaning - - 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. - - 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. - - E Echoes all transfer operations to the console - as they are being performed. - - 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. - - Gn Gets file from user number n (n in the range - 0-15). - - 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. - - I Ignores :00 records in the transfer of Intel - hex format file. The I parameter - automatically sets the H parameter. - - - - 1-25 - - - - K - - -CP/M Operating System Manual 1.6 Transient Commands - - -Table 1-4. (continued) - F - - Parameter Meaning - - L Translates upper-case alphabetics to lower- - case. - - 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. - - O Transfers non-ASCII object files. The normal - CP/M end-of-file is ignored. - - 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. - - Qs^Z Quits copying from the source device or file - when the string s, terminated by CTRL-Z, is - encountered. - - R Reads system files. - - 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. - - 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. - - Tn Expands tabs, CTRL-I characters, to every nth - column during the transfer of characters to - the destination from the source. - - U Translates lower-case alphabetics to upper- - case during the copy operation. - - - - - - 1-26 - - - - K - - -CP/M Operating System Manual 1.6 Transient Commands - - -Table 1-4. (continued) - F - - Parameter Meaning - - V Verifies that data have been copied correctly - by rereading after the write operation (the - destination must be a disk file). - - W Writes over R/O files without console - interrogation. - - Z Zeros the parity bit on input for each ASCII - character. - K - - - The following examples show valid PIP commands that specify -parameters in the file transfer. - - - PIP X.ASM=B:[v] - - Copies X.ASM from drive B to the current - drive and verifies that the data were - properly copied. - - - PIP LPT:=X.ASM[nt8u] - - Copies X.ASM to the LPT: device; numbers - each line, expands tabs to every eighth - column, and translates lower-case - alphabetics to upper-case. - - - PIP PUN:=X.HEX[i],Y.ZOT[h] - - 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. - - - PIP X.LIB=Y.ASM[sSUBRI:^z qJMP L3^z] - - 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. - - - - - - - - 1-27 - - - - - -CP/M Operating System Manual 1.6 Transient Commands - - - PIP PRN:=X.ASM[p50] - - 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. - - - 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: - - DESTINATION FILE IS R/O, DELETE (Y/N)? - -If you type Y, the file is overwritten. Otherwise, the following -response appears: - - ** NOT DELETED ** - -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: - - PIP A:=B:*.COM[W] - -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: - - PIP A.DAT=B.DAT,F:NEW.DAT,G:OLD.DAT[W] - - 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: - - PIP ED.COM=B:ED.COM[R] - -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. - - 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. - - - - - 1-28 - - - - - -CP/M Operating System Manual 1.6 Transient Commands - - -Note: 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. - - - 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 - - -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. - - -1.6.5 ED Command - -Syntax: - - ED ufn - - 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. - - 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. - - 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, - - - 1-29 - - - - - -CP/M Operating System Manual 1.6 Transient Commands - - -allowing easy access to particular portions of a large file (see the -N command). - - If you type the following command line: - - ED X.ASM - -the ED program creates an intermediate work file with the name - - X.$$$ - -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. - - - 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. - - -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. - - 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 - - ED ufn d: - -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. - - ED X.ASM b: - -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: - - - 1-30 - - - - - -CP/M Operating System Manual 1.6 Transient Commands - - - - FILE EXISTS - -This message is a precaution against accidentally destroying a -source file. You should first erase the existing file and then -restart the edit operation. - - 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: - - - ED A:X.ASM Edits the file X.ASM on drive A, with new - file and back-up on drive A. - - 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. - - -1.6.6 SYSGEN Command - -Syntax: - - SYSGEN - - 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. - - - SYSGEN - - Initiates the SYSGEN program. - - - SYSGEN VERSION x.x - - SYSGEN sign-on message. - - - SOURCE DRIVE NAME - (OR RETURN TO SKIP) - - 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: - - - - 1-31 - - - - - -CP/M Operating System Manual 1.6 Transient Commands - - - SOURCE ON d THEN TYPE RETURN - - 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. - - - FUNCTION COMPLETE - - System is copied to memory. SYSGEN then - prompts with the following: - - - DESTINATION DRIVE NAME - (OR RETURN TO REBOOT) - - 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: - - - DESTINATION ON d - THEN TYPE RETURN - - Place new disk into drive d; press return - when ready. - - - FUNCTION COMPLETE - - New disk is initialized in drive d. - - -The DESTINATION prompt is repeated until a single carriage return is -pressed at the console, so that more than one disk can be -initialized. - - 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. - - You can copy all files from an existing disk by typing the -following PIP command: - - PIP B: = A:*.*[v] - - - - - - 1-32 - - - - - -CP/M Operating System Manual 1.6 Transient Commands - - -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. - - 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. - - -1.6.7 SUBMIT Command - -Syntax: - - SUBMIT ufn parm#1 ... parm#n - - 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. - - The prototype command file is created using the ED program, -with interspersed $ parameters of the form: - - $1 $2 $3 ...$n - -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 - - $$$.SUB - -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. - - - - 1-33 - - - - - -CP/M Operating System Manual 1.6 Transient Commands - - - 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. - - The last command in a SUB file can initiate another SUB file, -allowing chained batch commands: - - Suppose the file ASMBL.SUB exists on disk and contains the -prototype commands - - ASM $1 - DIR $1.* - ERA *.BAK - PIP $2:=$1.PRN - ERA $1.PRN - -then, you issue the following command: - - SUBMIT ASMBL X PRN - -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: - - ASM X - DIR X.* - ERA *.BAK - PIP PRN:=X.PRN - ERA X.PRN - -which are executed in sequence by the CCP. - - 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. - - 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: - - XSUB - DDT - |$1.COM - R - GO - SAVE 1 $2.COM - - - - 1-34 - - - - - -CP/M Operating System Manual 1.6 Transient Commands - - -a subsequent SUBMIT command, such as - - A>SUBMIT SAVER PIP Y - -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. - - The XSUB program remains in memory and prints the message - - (xsub active) - -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. - - -1.6.8 DUMP Command - -Syntax: - - DUMP ufn - - 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. - - -1.6.9 MOVCPM Command - -Syntax: - - MOVCPM - - 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: - - - - - 1-35 - - - - - -CP/M Operating System Manual 1.6 Transient Commands - - - 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. - - 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. - - MOVCPM * * Constructs a relocated memory image for the - current memory configuration, but leaves the - memory image in memory in preparation for a - SYSGEN operation. - - MOVCPM n * Constructs a relocated memory image for an n - kilobyte memory system, and leaves the - memory image in preparation for a SYSGEN - operation. - - - For example, the command, - - MOVCPM * * - -constructs a new version of the CP/M system and leaves it in memory, -ready for a SYSGEN operation. The message - - READY FOR 'SYSGEN' OR - 'SAVE 34 CPMxx.COM' - -appears at the console upon completion, where xx is the current -memory size in kilobytes. You can then type the following sequence: - - - SYSGEN This starts the system - generation. - - 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 as a result of the - previous MOVCPM operation. - - DESTINATION DRIVE NAME Respond with B to write new - (OR RETURN TO REBOOT) system to the disk in drive B. - SYSGEN prompts with the - following message: - - DESTINATION ON B, Place the new disk on drive B - THEN TYPE RETURN and press the RETURN key when - ready. - - 1-36 - - - - - -CP/M Operating System Manual 1.6 Transient Commands - - - - 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: - - DESTINATION DRIVE NAME (OR RETURN TO REBOOT) - -until you respond with a single carriage return, which stops the -SYSGEN program with a system reboot. - - 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: - - SAVE 34 CPMxx.COM - -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. - - The following are valid MOVCPM commands: - - - MOVCPM 48 Constructs a 48K version of CP/M and starts - execution. - - MOVCPM 48 * Constructs a 48K version of CP/M in - preparation for permanent recording; the - response is - - READY FOR 'SYSGEN' OR - 'SAVE 34 CPM48.COM' - - MOVCPM * * Constructs a maximum memory version of CP/M - and starts execution. - - 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. - - -1.7 BDOS Error Messages - - 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: - - BDOS ERR ON d: error - - - - - - - 1-37 - - - - - -CP/M Operating System Manual 1.7 BDOS Error Messages - - -where d is the drive name and error is one of the three error -messages: - - BAD SECTOR - SELECT - READ ONLY - - 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. - - 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. - -Note: pressing a return might destroy disk integrity if the -operation is a directory write. Be sure you have adequate back-ups -in this case. - - 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. - - 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. - - -1.8 CP/M Operation on the Model 800 - - - - - - 1-38 - - - - - -CP/M Operating System Manual 1.8 Operation of CP/M on the Model 800 - - - 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. - - 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. - - 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. - - 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. - - As a result of hardware hang-ups or malfunctions, CP/M might -print the following message: - - BDOS ERR ON d: BAD SECTOR - -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. - - 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. - - 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 - - - 1-39 - - - - - -CP/M Operating System Manual 1.8 Operation of CP/M on the Model 800 - - -can be written under CP/M that causes the Model 800 controller to -reformat with sequential sector numbering (1-26) on each track. - - Generally, IBM-compatible 8-inch disks do not need to be -formatted. However, 5 1/4-inch disks need to be formatted. - - -End of Section 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1-40 - - - - - - - - -Section 2 - -The CP/M Editor - - - -2.1 Introduction to Ed - - Ed is the context editor for CP/M, and is used to create and -alter CP/M source files. To start ED, type a command of the -following form: - - ED filename -or - ED filename.typ - -Generally, ED reads segments of the source file given by filename or -filename.typ into the central memory, where you edit the file and it -is subsequently written back to disk after alterations. If the -source file does not exist before editing, it is created by ED and -initialized to empty. The overall operation of Ed is shown in -Figure 2-1. - - -2.1.1 ED Operation - - Ed operates upon the source file, shown in Figure 2-1 by x.y, -and passes all text through a memory buffer where the text can be -viewed or altered. The number of lines that can be maintained in -the memory buffer varies with the line length, but has a total -capacity of about 5000 characters in a 20K CP/M system. - - Edited text material is written into a temporary work file -under your command. Upon termination of the edit, the memory buffer -is written to the temporary file, followed by any remaining (unread) -text in the source file. The name of the original file is changed -from x.y to x.BAK so that the most recent edited source file can be -reclaimed if necessary. See the CP/M commands ERASE and RENAME. -The temporary file is then changed from x.$$$ to x.y, which becomes -the resulting edited file. - - The memory buffer is logically between the source file and -working file, as shown in Figure 2-2. - - - - - - - - - - - - - - - 2-1 - - - - - -CP/M Operating System Manual 2.1 Introduction to ED - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Figure 2-1. Overall ED Operation - - - - Source File Memory Buffer Temporary File - - 1 First Line 1 First Line 1 First Line - 2 Appended 2 Buffered 2 Processed - 3 Lines 3 Text 3 Text - - - - SP MP TP - - - - Unprocessed Next Free Next Free File - Source Append Memory Write Space - Lines Space - - - - SP = Source Pointer - MP = Memory Pointer - TP = Temporary Pointer - - -Figure 2-2. Memory Buffer Organization - - - 2-2 - - - - - -CP/M Operating System Manual 2.1 Introduction to ED - - -2.1.2 Text Transfer Functions - - Given that n is an integer value in the range 0 through 65535, -several single-letter ED commands transfer lines of text from the -source file through the memory buffer to the temporary (and -eventually final) file. Single letter commands are shown in upper- -case, but can be typed in either upper- or lower-case. - - -Table 2-1. ED Text Transfer Commands - - Command Result - - F - nA Appends the next n unprocessed source lines - from the source file at SP to the end of the - memory buffer at MP. Increment SP and MP by n. - If upper-case translation is set (see the U - command) and the A command is typed in upper- - case, all input lines will automatically be - translated to upper-case. - - nW Writes the first n lines of the memory buffer - to the temporary file free space. Shift the - remaining lines n+1 through MP to the top of - the memory buffer. Increment TP by n. - - E Ends the edit. Copy all buffered text to - temporary file and copy all unprocessed source - lines to temporary file. Rename files. - - H Moves to head of new file by performing - automatic E command. The temporary file - becomes the new source file, the memory buffer - is emptied, and a new temporary file is - created. The effect is equivalent to issuing - an E command, followed by a reinvocation of ED, - using x.y as the file to edit. - - O Returns to original file. The memory buffer is - emptied, the temporary file is deleted, and the - SP is returned to position 1 of the source - file. The effects of the previous editing - commands are thus nullified. - - Q Quits edit with no file alterations, returns to - CP/M. - K - - - There are a number of special cases to consider. If the -integer n is omitted in any ED command where an integer is allowed, -then 1 is assumed. Thus, the commands A and W append one line and -write one line, respectively. In addition, if a pound sign # is -given in the place of n, then the integer 65535 is assumed (the -largest value for n that is allowed). Because most source files can -be contained entirely in the memory buffer, the command #A is often - - - 2-3 - - - - - -CP/M Operating System Manual 2.1 Introduction to ED - - -issued at the beginning of the edit to read the entire source file -to memory. Similarly, the command #W writes the entire buffer to -the temporary file. - - Two special forms of the A and W commands are provided as a -convenience. The command 0A fills the current memory buffer at -least half full, while 0W writes lines until the buffer is at least -half empty. An error is issued if the memory buffer size is -exceeded. You can then enter any command, such as W, that does not -increase memory requirements. The remainder of any partial line -read during the overflow will be brought into memory on the next -successful append. - - -2.1.3 Memory Buffer Organization - - The memory buffer can be considered a sequence of source lines -brought in with the A command from a source file. The memory buffer -has an imaginary character pointer (CP) that moves throughout the -memory buffer under command of the operator. - - The memory buffer appears logically as shown in Figure 2-3, -where the dashes represent characters of the source line of -indefinite length, terminated by carriage return () and line- -feed () characters, and CP represents the imaginary character -pointer. Note that the CP is always located ahead of the first -character of the first line, behind the last character of the last -line, or between two characters. The current line CL is the source -line that contains the CP. - - - - Memory Buffer - - - first line ----------------------- - - - ----------------------- - - - current line CL --------------------------- - - - CP - - last line ----------------------- - - - Figure 2-3. Logical Organization of Memory Buffer - - - - - - - - 2-4 - - - - - -CP/M Operating System Manual 2.1 Introduction to ED - - -2.1.4 Line Numbers and ED Start-up - - ED produces absolute line number prefixes that are used to -reference a line or range of lines. The absolute line number is -displayed at the beginning of each line when ED is in insert mode -(see the I command in Section 2.1.5). Each line number takes the -form - - nnnnn: - -where nnnnn is an absolute line number in the range of 1 to 65535. -If the memory buffer is empty or if the current line is at the end -of the memory buffer, nnnnn appears as 5 blanks. - - You can reference an absolute line number by preceding any -command by a number followed by a colon, in the same format as the -line number display. In this case, the ED program moves the current -line reference to the absolute line number, if the line exists in -the current memory buffer. The line denoted by the absolute line -number must be in the memory buffer (see the A command). Thus, the -command - - 345:T - -is interpreted as move to absolute 345, and type the line. -Absolute line numbers are produced only during the editing process -and are not recorded with the file. In particular, the line numbers -will change following a deleted or expanded section of text. - - You can also reference an absolute line number as a backward or -forward distance from the current line by preceding the absolute -number by a colon. Thus, the command - - :400T - -is interpreted as type from the current line number through the line -whose absolute number is 400. Combining the two line reference -forms, the command - - 345::400T - -is interpreted as move to absolute line 345, then type through -absolute line 400. Absolute line references of this sort can -precede any of the standard ED commands. - - Line numbering is controlled by the V (Verify Line Numbers) -command. Line numbering can be turned off by typing the -V command. - - - - - - - - - - - 2-5 - - - - - -CP/M Operating System Manual 2.1 Introduction to ED - - -If the file to edit does not exist, ED displays the following -message: - - NEW FILE - -To move text into the memory buffer, you must enter an i command -before typing input lines and terminate each line with a carriage -return. A single CTRL-Z character returns ED to command mode. - - -2.1.5 Memory Buffer Operation - - When ED begins, the memory buffer is empty. You can either -append lines from the source file with the A command, or enter the -lines directly from the console with the insert command. The insert -command takes the following form: - - I - -ED then accepts any number of input lines. You must terminate each -line with a (the is supplied automatically). A single -CTRL-Z, denoted by a caret (^)Z, returns ED to command mode. The CP -is positioned after the last character entered. The following -sequence: - - I - NOW IS THE - TIME FOR - ALL GOOD MEN - ^Z - -leaves the memory buffer as - - NOW IS THE - TIME FOR - ALL GOOD MEN - - Generally, ED accepts command letters in upper- or lower-case. -If the command is upper-case, all input values associated with the -command are translated to upper-case. If the I command is typed, -all input lines are automatically translated internally to upper- -case. The lower-case form of the i command is most often used to -allow both upper- and lower-case letters to be entered. - - Various commands can be issued that control the CP or display -source text in the vicinity of the CP. The commands shown below -with a preceding n indicate that an optional unsigned value can be -specified. When preceded by +_, the command can be unsigned, or have -an optional preceding plus or minus sign. As before, the pound sign -# is replaced by 65535. If an integer n is optional, but not -supplied, then n=1 is assumed. Finally, if a plus sign is optional, -but none is specified, then + is assumed. - - - - - - 2-6 - - - - - -CP/M Operating System Manual 2.1 Introduction to ED - - -Table 2-2. Editing Commands - - Command Action - - F - +_B Move CP to beginning of memory buffer if + and - to bottom if -. - - +_nC Move CP by +_n characters (moving ahead if +), - counting the as two characters. - - +_nD Delete n characters ahead of CP if plus and - behind CP if minus. - - +_nK Kill (remove) +_n lines of source text using CP - as the current reference. If CP is not at the - beginning of the current line when K is issued, - the characters before CP remain if + is - specified, while the characters after CP remain - if - is given in the command. - - +_nL If n = 0, move CP to the beginning of the - current line, if it is not already there. If n - =/ 0, first move the CP to the beginning of the - current line and then move it to the beginning - of the line that is n lines down (if +) or up - (if -). The CP will stop at the top or bottom - of the memory buffer if too large a value of n - is specified. - - +_nT If n = 0, type the contents of the current line - up to CP. If n = 1, type the contents of the - current line from CP to the end of the line. - If n>1, type the current line along with n - 1 - lines that follow, if + is specified. - Similarly, if n>1 and - is given, type the - previous n lines up to the CP. Any key can be - depressed to abort long type-outs. - - +_n Equivalent to +_nLT, which moves up or down and - types a single line. - K - - - -2.1.6 Command Strings - - Any number of commands can be typed contiguously (up to the -capacity of the console buffer) and are executed only after you -press the . Table 2-3 summarizes the CP/M console line-editing -commands used to control the input command line. - - - - - - - - - 2-7 - - - - - -CP/M Operating System Manual 2.1 Introduction to ED - - -Table 2-3. Line-editing Controls - - Command Result - - F - CTRL-C Reboots the CP/M system when typed at the - start of a line. - - CTRL-E Physical end of line: carriage is returned, - but line is not sent until the carriage return - key is depressed. - - CTRL-H Backspaces one character position. - - CTRL-J Terminates current input (line-feed). - - CTRL-M Terminates current input (carriage return). - - CTRL-R Retypes current command line: types a clean - line character deletion with rubouts. - - CTRL-U Deletes the entire line typed at the console. - - CTRL-X Same as CTRL-U. - - CTRL-Z Ends input from the console (used in PIP and - ED). - - rub/del Deletes and echos the last character typed at - the console. - K - - - Suppose the memory buffer contains the characters shown in the -previous section, with the CP following the last character of the -buffer. In the following example, the command strings on the left -produce the results shown to the right. Use lower-case command -letters to avoid automatic translation of strings to upper-case. - - - Command String Effect - - F - B2T Move to beginning of the buffer and type - two lines: - - NOW IS THE - TIME FOR - The result in the memory buffer is - - NOW IS THE - TIME FOR - ALL GOOD MEN - - - - - - - - 2-8 - - - - - -CP/M Operating System Manual 2.1 Introduction to ED - - - Command String Effect - - 5C0T Move CP five characters and type the - beginning of the line NOW I. The result - in the memory buffer is - - NOW I S THE - - - 2L-T Move two lines down and type the previous - line TIME FOR. The result in the memory - buffer is - - NOW IS THE - TIME FOR - ALL GOOD MEN - - - -L#K Move up one line, delete 65535 lines that - follow. The result in the memory buffer - is - - NOW IS THE - - - I Insert two lines of text with automatic - TIME TO translation to upper-case. The result in - INSERT the memory buffer is - ^Z - - NOW IS THE - TIME TO - INSERT - - - -2L#T Move up two lines and type 65535 lines - ahead of CP NOW IS THE. The result in the - memory buffer is - - NOW IS THE - TIME TO - INSERT - - - Move down one line and type one line - INSERT. The result in the memory buffer - is - - NOW IS THE - TIME TO - INSERT - K - - - - - - - 2-9 - - - - - -CP/M Operating System Manual 2.1 Introduction to ED - - -2.1.7 Text Search and Alteration - - ED has a command that locates strings within the memory buffer. -The command takes the form - - nF s -or - nF s ^Z - -where s represents the string to match, followed by either a or -CTRL-Z, denoted by ^Z. ED starts at the current position of CP and -attempts to match the string. The match is attempted n times and, -if successful, the CP is moved directly after the string. If the n -matches are not successful, the CP is not moved from its initial -position. Search strings can include CTRL-L, which is replaced by -the pair of symbols . - - The following commands illustrate the use of the F command: - - - Command String Effect - - F - B#T Move to the beginning and type the entire - buffer. The result in the memory buffer - is - - NOW IS THE - TIME FOR - ALL GOOD MEN - - - FS T Find the end of the string S T. The - result in the memory buffer is - - NOW IS T HE - - - FIs^Z0TT Find the next I and type to the CP; then - type the remainder of the current line ME - FOR. The result in the memory buffer is - - NOW IS THE - TI ME FOR - - ALL GOOD MEN - K - - - An abbreviated form of the insert command is also allowed, -which is often used in conjunction with the F command to make simple -textual changes. The form is - - | s ^Z -or - | s - - - - 2-10 - - - - - -CP/M Operating System Manual 2.1 Introduction to ED - - -where s is the string to insert. If the insertion string is -terminated by a CTRL-Z, the string is inserted directly following -the CP, and the CP is positioned directly after the string. The -action is the same if the command is followed by a except that -a is automatically inserted into the text following the -string. The following command sequences are examples of the F and I -commands: - - - Command String Effect - F - - BITHIS IS ^Z - - Insert THIS IS at the beginning of the - text. The result in the memory buffer is - - THIS IS NOW THE - - TIME FOR - ALL GOOD MEN - - - FTIME^Z-4DIPLACE^Z - - Find TIME and delete it; then insert - PLACE. The result in the memory buffer is - - THIS IS NOW THE - PLACE FOR - - ALL GOOD MEN - - - 3FO^Z-3D5D1 - CHANGES^Z Find third occurrence of O (that is, the - second O in GOOD), delete previous 3 - characters and the subsequent 5 - characters; then insert CHANGES. The - result in the memory buffer is - - THIS IS NOW THE - PLACE FOR - ALL CHANGES - - - -8CISOURCE - - Move back 8 characters and insert the line - SOURCE. The result in the memory - buffer is - - THIS IS NOW THE - PLACE FOR - ALL SOURCE - CHANGES - - - 2-11 - - - - K - - -CP/M Operating System Manual 2.1 Introduction to ED - - - - - ED also provides a single command that combines the F and I -commands to perform simple string substitutions. The command takes -the following form: - - nS s1^Zs2 -or - nS s1^Zs2 ^Z - -and has exactly the same effect as applying the following command -string a total of n times: - - F s1^Z-kDIs2 -or - F s1^Z-kDIs2 ^Z - -where k is the length of the string. ED searches the memory buffer -starting at the current position of CP and successively substitutes -the second string for the first string until the end of buffer, or -until the substitution has been performed n times. - - As a convenience, a command similar to F is provided by ED that -automatically appends and writes lines as the search proceeds. The -form is - - n N s -or - n N s ^Z - -which searches the entire source file for the nth occurrence of the -strings (you should recall that F fails if the string cannot be -found in the current buffer). The operation of the N command is -precisely the same as F except in the case that the string cannot be -found within the current memory buffer. In this case, the entire -memory content is written (that is, an automatic #W is issued). -Input lines are then read until the buffer is at least half full, or -the entire source file is exhausted. The search continues in this -manner until the string has been found n times, or until the source -file has been completely transferred to the temporary file. - - A final line editing function, called the juxtaposition -command, takes the form - - n J s1^Zs2^Zs3 -or - n J s1^Zs2^Zs3 ^Z - -with the following action applied n times to the memory buffer: -search from the current CP for the next occurrence of the string s1. -If found, insert the string s2, and move CP to follow s2. Then -delete all characters following CP up to, but not including, the -string s3, leaving CP directly after s2. If s3 cannot be found, -then no deletion is made. If the current line is - - - - 2-12 - - - - - -CP/M Operating System Manual 2.1 Introduction to ED - - - NOW IS THE TIME - -the command - - JW ^ZWHAT^Z^1 - -results in - - NOW WHAT - -You should recall that ^1 (CTRL-L) represents the pair in -search and substitute strings. - - The number of characters ED allows in the F, S, N, and J -commands is limited to 100 symbols. - - -2.1.8 Source Libraries - - ED also allows the inclusion of source libraries during the -editing process with the R command. The form of this command is - - R filename ^Z -or - R filename - -where filename is the primary filename of a source file on the disk -with an assumed filetype of LIB. ED reads the specified file, and -places the characters into the memory buffer after CP, in a manner -similar to the I command. Thus, if the command - - RMACRO - -is issued by the operator, ED reads from the file MACRO.LIB until -the end-of-file and automatically inserts the characters into the -memory buffer. - - ED also includes a block move facility implemented through the -X (Transfer) command. The form - - nX - -transfers the next n lines from the current line to a temporary file -called - - X$$$$$$.LIB - -which is active only during the editing process. You can reposition -the current line reference to any portion of the source file and -transfer lines to the temporary file. The transferred lines -accumulate one after another in this file and can be retrieved by -simply typing - - R - - - - 2-13 - - - - - -CP/M Operating System Manual 2.1 Introduction to ED - - -which is the trivial case of the library read command. In this -case, the entire transferred set of lines is read into the memory -buffer. Note that the X command does not remove the transferred -lines from the memory buffer, although a K command can be used -directly after the X, and the R command does not empty the -transferred LIB file. That is, given that a set of lines has been -transferred with the X command, they can be reread any number of -times back into the source file. The command - - 0X - -is provided to empty the transferred line file. - - Note that upon normal completion of the ED program through Q or -E, the temporary LIB file is removed. If ED is aborted with a CTRL- -C, the LIB file will exist if lines have been transferred, but will -generally be empty (a subsequent ED invocation will erase the -temporary file). - - -2.1.9 Repetitive Command Execution - - The macro command M allows you to group ED commands together -for repeated evaluation. The M command takes the following form: - - n M CS -or - n M CS ^Z - -where CS represents a string of ED commands, not including another M -command. ED executes the command string n times if n>1. If n=0 or -1, the command string is executed repetitively until an error -condition is encountered (for example, the end of the memory buffer -is reached with an F command). - - As an example, the following macro changes all occurrences of -GAMMA to DELTA within the current buffer, and types each line that -is changed: - - MFGAMMA^Z-5DIDELTA^Z0TT - -or equivalently - - MSGAMMA^ZDELTA^Z0TT - - -2.2 ED Error Conditions - - On error conditions, ED prints the message BREAK X AT C where X -is one of the error indicators shown in Table 2-4. - - - - - - - - 2-14 - - - - - -CP/M Operating System Manual 2.2 ED Error Conditions - - -Table 2-4. Error Message Symbols - - Symbol Meaning - - H - ? Unrecognized command. - - > Memory buffer full (use one of the commands D, K, - N, S, or W to remove characters); F, N, or S - strings too long. - - # Cannot apply command the number of times - specified (for example, in F command). - - O Cannot open LIB file in R command. - K - - -If there is a disk error, CP/M displays the following message: - - BDOS ERR on d: BAD SECTOR - -You can choose to ignore the error by pressing RETURN at the console -(in this case, the memory buffer data should be examined to see if -they were incorrectly read), or you can reset the system with a -CTRL-C and reclaim the back-up file if it exists. The file can be -reclaimed by first typing the contents of the BAK file to ensure -that it contains the proper information. For example, type the -following: - - TYPE x.BAK - -where x is the file being edited. Then remove the primary file - - ERA x.y - -and rename the BAK file - - REN x.y=x.BAK - -The file can then be reedited, starting with the previous version. - - ED also takes file attributes into account. If you attempt to -edit a Read-Only file, the message - - ** FILE IS READ/ONLY ** - -appears at the console. The file can be loaded and examined, but -cannot be altered. You must end the edit session and use STAT to -change the file attribute to R/W. If the edited file has the system -attribute set, the following message: - - 'SYSTEM' FILE NOT ACCESSIBLE - -is displayed and the edit session is aborted. Again, the STAT -program can be used to change the system attribute, if desired. - - - - 2-15 - - - - - -CP/M Operating System Manual 2.3 Control Characters and Commands - - -2.3 Control Characters and Commands - - Table 2-5 summarizes the control characters and commands -available in ED. - - -Table 2-5. ED Control Characters - - F - Control Function - Character - - CTRL-C System reboot - - CTRL-E Physical (not actually entered in - command) - - CTRL-H Backspace - - CTRL-J Logical tab (cols 1, 9, 16, ...) - - CTRL-L Logical in search and substitute - strings - - CTRL-R Repeat line - - CTRL-U Line delete - - CTRL-X Line delete - - CTRL-Z String terminator - - rub/del Character delete - - K - - Table 2-6 summarizes the commands used in ED. - - -Table 2-6. ED Commands - - Command Function - F - - nA Append lines - - +_B Begin or bottom of buffer - - +_nC Move character positions - - +_nD Delete characters - - E End edit and close files (normal end) - - nF Find string - - - - - - 2-16 - - - - K - - -CP/M Operating System Manual 2.3 Control Characters and Commands - - -Table 2-6. (continued) - - Command Function - F - - H End edit, close and reopen files - - I Insert characters, use i if both upper and - lower-case characters are to be entered. - - nJ Place strings in juxtaposition - - +_nK Kill lines - - +_nL Move down/up lines - - nM Macro definition - - nN Find next occurrence with autoscan - - O Return to original file - - +_nP Move and print pages - - Q Quit with no file changes - - R Read library file - - nS Substitute strings - - +_nT Type lines - - +_U Translate lower- to upper-case if U, no - translation if -U - - +_V Verify line numbers, or show remaining - free character space - - 0V A special case of the V command, OV, - prints the memory buffer statistics in the - form - - free/total - - where free is the number of free bytes in - the memory buffer (in decimal) and total - is the size of the memory buffer - - nW Write lines - - nZ Wait (sleep) for approximately n seconds - - +_n Move and type (+_nLT). - K - - - - - - 2-17 - - - - - -CP/M Operating System Manual 2.3 Control Characters and Commands - - - Because of common typographical errors, ED requires several -potentially disastrous commands to be typed as single letters, -rather than in composite commands. The following commands: - - o E(end) - o H(head) - o O(original) - o Q(quit) - -must be typed as single letter commands. - - The commands I, J, M, N, R, and S should be typed as i, j, m, -n, r, and s if both upper- and lower-case characters are used in the -operation, otherwise all characters are converted to upper-case. -When a command is entered in upper-case, ED automatically converts -the associated string to upper-case, and vice versa. - - -End of Section 2 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 2-18 - - - - - - - - -Section 3 - -CP/M Assembler - - - -3.1 Introduction - - 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: - - ASM filename - ASM filename.parms - -In both cases, the assembler assumes there is a file on the disk -with the name: - - filename.ASM - -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. - - In either case, the CP/M assembler loads and prints the -message: - - CP/M ASSEMBLER VER n.n - -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 - - filename.HEX - filename.PRN - - 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. - - 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 - - - - - - - - - 3-1 - - - - - -CP/M Operating System Manual 3.1 Introduction - - - filename.p1p2p3 - -where p1, p2, and p3 are single letters. P1 can be - - A,B, ...,P - -which designates the disk name that contains the source file. P2 -can be - - A,B, ...,P - -which designates the disk name that will receive the hex file; or, -P2 can be - - Z - -which skips the generation of the hex file. - - P3 can be - - A,B, ...,P - -which designates the disk name that will receive the print file. P3 -can also be specified as - - X - -which places the listing at the console; or - - Z - -which skips generation of the print file. Thus, the command - - ASM X.AAA - -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 - - ASM X - -The command - - ASM X.ABX - -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 - - ASM X.BZZ - -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. - - - 3-2 - - - - - -CP/M Operating System Manual 3.1 Introduction - - - - 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. - - -3.2 Program Format - - An assembly-language program acceptable as input to the -assembler consists of a sequence of statements of the form - - line# label operation operand ;comment - -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. - - The line# is an optional decimal integer value representing the -source program line number, and ASM ignores this field if present. - - The label field takes either of the following forms: - - identifier - identifier: - -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: - - - x xy long$name - - x: yxl: longer$named$data: - - X1Y2 X1x2 x234$5678$9012$3456: - - - 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. - - - - - 3-3 - - - - - -CP/M Operating System Manual 3.2 Program Format - - - 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. - - 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. - - 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. - - -3.3 Forming the Operand - - 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. - - -3.3.1 Labels - - 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. - - 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. - - - - - - - 3-4 - - - - - -CP/M Operating System Manual 3.3 Forming the Operand - - -3.3.2 Numeric Constants - - 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: - - 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). - - 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. - - 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. - - 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: - - - 1234 1234D 1100B 1111$0000$1111$0000B - - 1234H OFFEH 3377O 33$77$22Q - - 3377o Ofe3h 1234d Offffh - - -3.3.3 Reserved Words - - 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. - - - - - - - - 3-5 - - - - - -CP/M Operating System Manual 3.3 Forming the Operand - - - Table 3-1. Reserved Characters - - Character Value - - A 7 - B 0 - C 1 - D 2 - E 3 - H 4 - L 5 - M 6 - SP 6 - PSW 6 - - - 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. - - 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. - - -3.3.4 String Constants - - 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. - - 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. - - - - - - 3-6 - - - - - -CP/M Operating System Manual 3.3 Forming the Operand - - - 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 - - -3.3.5 Arithmetic and Logical Operators - - 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. - - -Table 3-2. Arithmetic and Logical Operators - F - - Operators Meaning - - a + b unsigned arithmetic sum of a and b - - a - b unsigned arithmetic difference between a - and b - - + b unary plus (produces b) - - - b unary minus (identical to 0 - b) - - a * b unsigned magnitude multiplication of a and - b - - a / b unsigned magnitude division of a by b - - a MOD b remainder after a / b. - - NOT b logical inverse of b (all 0s become 1s, 1s - become 0s), where b is considered a 16-bit - value - - a AND b bit-by-bit logical and of a and b - - a OR b bit-by-bit logical or of a and b - - a XOR b bit-by-bit logical exclusive or of a and b - - a SHL b the value that results from shifting a to - the left by an amount b, with zero fill - - a SHR b the value that results from shifting a to - the right by an amount b, with zero fill - K - - - - - - 3-7 - - - - - -CP/M Operating System Manual 3.3 Forming the Operand - - - 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: - - - 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)) - - - 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. - - -3.3.6 Precedence of Operators - - 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. - - - * / MOD SHL SHR - - - + - - NOT - - AND - - OR XOR - - - Thus, the expressions shown to the left below are interpreted -by the assembler as the fully parenthesized expressions shown to the -right. - - - - 3-8 - - - - - -CP/M Operating System Manual 3.3 Forming the Operand - - - 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)))) - - - 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: - - (a OR b) AND (NOT c)+ d SHL e - -This results in these assumed parentheses: - - (a OR b) AND ((NOT c) + (d SHL e)) - - An unparenthesized expression is well-formed only if the -expression that results from inserting the assumed parentheses is -well-formed. - - -3.4 Assembler Directives - - 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. - - - Table 3-3. Assembler Directives - - Directive Meaning - - ORG set the program or data origin - - END end program, optional start address - - EQU numeric equate - - SET numeric set - - IF begin conditional assembly - - ENDIF end of conditional assembly - - DB define data bytes - - DW define data words - - DS define data storage area - - 3-9 - - - - - -CP/M Operating System Guide 3.4 Assembler Directives - - -3.4.1 The ORG Directive - - The ORG statement takes the form: - - label ORG expression - -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: - - ORG 100H - -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. - - -3.4.2 The END Directive - - 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: - - label END - - label END expression - -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: - - END 100H - -resulting in the default starting address of 100H (beginning of the -transient program area). - - - - - - - - - - - 3-10 - - - - - -CP/M Operating System Guide 3.4 Assembler Directives - - -3.4.3 The EQU Directive - - The EQU (equate) statement is used to set up synonyms for -particular numeric values. The EQU statement takes the form: - - label EQU expression - -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: - - - TTYBASE EQU 10H ;BASE PORT NUMBER FOR TTY - - TTYIN EQU TTYBASE ;TTY DATA IN - - TTYOUT EQU TTYBASE+1 ;TTY DATA OUT - - - At a later point in the program, the statements that access the -teletype can appear as follows: - - - IN TTYIN ;READ TTY DATA TO REG-A - - ... - - OUT TTYOUT ;WRITE DATA TO TTY FROM REG-A - - -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 - - TTYBASE EQU 7FH ;BASE PORT NUMBER FOR TTY - -and the program can be reassembled without changing any other -statements. - - -3.4.4 The SET Directive - - The SET statement is similar to the EQU, taking the form: - - label SET expression - -except that the label can occur on other SET statements within the -program. The expression is evaluated and becomes the current value - - 3-11 - - - - - -CP/M Operating System Guide 3.4 Assembler Directives - - -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. - - -3.4.5 The IF and ENDIF Directives - - 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: - - - IF expression - - statement#1 - - statement#2 - - ... - - statement#n - - ENDIF - - - 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. - - - - - - - - - - - - - - - - - - 3-12 - - - - - -CP/M Operating System Guide 3.4 Assembler Directives - - - 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 - - -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 - - TTY EQU FALSE - -and, in this case, the program assembles for a CRT based at port -20H. - - -3.4.6 The DB Directive - - The DB directive allows the programmer to define initialized -storage areas in single-precision byte format. The DB statement -takes the form: - - label DB e#1, e#2, ..., e#n - -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. - - - - - 3-13 - - - - - -CP/M Operating System Guide 3.4 Assembler Directives - - -Note: 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: - - - 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 - - - -3.4.7 The DW Directive - - 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: - - label DW e#1, e#2, ..., e#n - -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: - - - doub: DW 0ffefh,doub+4,signon-$,255+255 - DW 'a', 5, 'ab', 'CD', 6 shl 8 or llb. - - - -3.4.8 The DS Directive - - The DS statement is used to reserve an area of uninitialized -memory, and takes the form: - - label DS expression - -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: - - label: EQU $ ;LABEL VALUE IS CURRENT CODE LOCATION - ORG $+expression ;MOVE PAST RESERVED AREA - - - - - - - 3-14 - - - - - -CP/M Operating System Manual 3.5 Operation Codes - - -3.5 Operation Codes - - 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 Intel -8080 Assembly Language Programming Manual. 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: - - - 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. - - o e8 represents an 8-bit value in the range 0-255. - - o e16 represents a 16-bit value in the range 0-65535. - - - 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. - - 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. - - -3.5.1 Jumps, Calls, and Returns - - 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. - - -Table 3-4. Jumps, Calls, and Returns - I - - 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 - - - 3-15 - - - - K - - -CP/M Operating System Manual 3.5 Operation Codes - - -Table 3-4. (continued) - I - - 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 - K - - - - - - 3-16 - - - - - -CP/M Operating System Manual 3.5 Operation Codes - - -3.5.2 Immediate Operand Instructions - - 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. - - -Table 3-5. Immediate Operand Instructions - - F - Form with Example Meaning - Bit Values - - MVI e3,e8 MVI B,255 Move immediate data to - register A, B, C, D, E, H, - L, or M (memory) - - ADI e8 ADI 1 Add immediate operand to A - without carry - - ACI e8 ACI 0FFH Add immediate operand to A - with carry - - SUI e8 SUI L + 3 Subtract from A without - borrow (carry) - - SBI e8 SBI L AND 11B Subtract from A with borrow - (carry) - - ANI e8 ANI $ AND 7FH Logical and A with - immediate data - - XRI e8 XRI 1111$0000B Exclusive or A with - immediate data - - ORI e8 ORI L AND 1+1 Logical or A with immediate - data - - CPI e8 CPI 'a' Compare A with immediate - data, same as SUI except - register A not changed. - - LXI e3,e16 LXI B,100H Load extended immediate to - register pair. e3 must be - equivalent to B, D, H, or - SP. - K - - -3.5.3 Increment and Decrement Instructions - - The 8080 provides instructions for incrementing or decrementing -single- and double-precision registers. The instructions are -described in Table 3-6. - - - - 3-17 - - - - - -CP/M Operating System Manual 3.5 Operation Codes - - -Table 3-6. Increment and Decrement Instructions - F - - Form with Example Meaning - Bit Value - - INR e3 INR E Single-precision increment - register. e3 produces one - of A, B, C, D, E, H, L, M. - - DCR e3 DCR A Single-precision decrement - register. e3 produces one - of A, B, C, D, E, H, L, M. - - INX e3 INX SP Double-precision increment - register pair. e3 must be - equivalent to B, D, H, or - SP. - - DCX e3 DCX B Double-precision decrement - register pair. e3 must be - equivalent to B, D, H, or - SP. - K - - - -3.5.4 Data Movement Instructions - - Instructions that move data from memory to the CPU and from CPU -to memory are given in the following table. - - -Table 3-7. Data Movement Instructions - F - - Form with Example Meaning - Bit Value - - 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. - - LDAX e3 LDAX B Load register A from - computed address. e3 must - produce either B or D. - - STAX e3 STAX D Store register A to - computed address. e3 must - produce either B or D. - - LHLD e16 LHLD L1 Load HL direct from - location e16. Double- - precision load to H and L. - - - - - 3-18 - - - - K - - -CP/M Operating System Manual 3.5 Operation Codes - - -Table 3-7. (continued) - F - - Form with Example Meaning - Bit Value - - SHLD e16 SHLD L5+x Store HL direct to - location e16. Double- - precision store from H and - L to memory. - - LDA e16 LDA Gamma Load register A from - address e16. - - STA e16 STA X3-5 Store register A into - memory at e16. - - POP e3 POP PSW Load register pair from - stack, set SP. e3 must - produce one of B, D, H, or - PSW. - - PUSH e3 PUSH B Store register pair into - stack, set SP. e3 must - produce on of B, D, H, or - PSW. - - IN e8 IN 0 Load register A with data - from port e8. - - OUT e8 OUT 255 Send data from register A - to port e8. - - XTHL Exchange data from top of - stack with HL. - - PCHL Fill program counter with - data from HL. - - SPHL Fill stack pointer with - data from HL. - - XCHG Exchange DE pair with HL - pair. - K - - - -3.5.5 Arithmetic Logic Unit Operations - - Instructions that act upon the single-precision accumulator to -perform arithmetic and logic operations are given in the following -table. - - - - - - - 3-19 - - - - - -CP/M Operating System Manual 3.5 Operation Codes - - -Table 3-8. Arithmetic Logic Unit Operations - F - - Form with Example Meaning - Bit Value - - 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. - - ADC e3 ADC L Add register to A with - carry, e3 as above. - - SUB e3 SUB H Subtract reg e3 from A - without carry, e3 is - defined as above. - - SBB e3 SBB 2 Subtract register e3 from A - with carry, e3 defined as - above. - - ANA e3 ANA 1+1 Logical and reg with A, e3 - as above. - - XRA e3 XRA A Exclusive or with A, e3 as - above. - - ORA e3 ORA B Logical or with A, e3 - defined as above. - - CMP e3 CMP H Compare register with A, e3 - as above. - - DAA Decimal adjust register A - based upon last arithmetic - logic unit operation. - - CMA Complement the bits in - register A. - - STC Set the carry flag to 1. - - CMC Complement the carry flag. - - RLC Rotate bits left, (re)set - carry as a side effect. - High-order A bit becomes - carry. - - RRC Rotate bits right, (re)set - carry as side effect. - Low-order A bit becomes - carry. - - - - - 3-20 - - - - K - - -CP/M Operating System Manual 3.5 Operation Codes - - -Table 3-8. (continued) - F - - Form with Example Meaning - Bit Value - - RAL Rotate carry/A register to - left. Carry is involved - in the rotate. - - RAR Rotate carry/A register to - right. Carry is involved - in the rotate. - - DAD e3 DAD B Double-precision add - register pair e3 to HL. - e3 must produce B, D, H, - or SP. - K - - -3.5.6 Control Instructions - - The four remaining instructions, categorized as control -instructions, are the following: - - o HLT halts the 8080 processor. - o DI disables the interrupt system. - o EI enables the interrupt system. - o NOP means no operation. - - -3.6 Error Messages - - 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. - - -Table 3-9. Error Codes - - F - Error Code Meaning - - D Data error: element in data statement cannot - be placed in the specified data area. - - E Expression error: expression is ill-formed - and cannot be computed at assembly time. - - L Label error: label cannot appear in this - context; might be duplicate label. - - N Not implemented: features that will appear in - future ASM versions. For example, macros are - recognized, but flagged in this version. - - - 3-21 - - - - K - - -CP/M Operating System Manual 3.6 Error Messages - - -Table 3-9. (continued) - - F - Error Code Meaning - - O Overflow: expression is too complicated (too - many pending operators) to be computed and - should be simplified. - - P Phase error: label does not have the same - value on two subsequent passes through the - program. - - R Register error: the value specified as a - register is not compatible with the operation - code. - - S Syntax error: statement is not properly - formed. - - V Value error: operand encountered in - expression is improperly formed. - K - - - Table 3-10 lists the error messages that are due to terminal -error conditions. - - -Table 3-10. Error Messages - - F - Message Meaning - - NO SOURCE FILE PRESENT - - The file specified in the ASM command does - not exist on disk. - - - NO DIRECTORY SPACE - - The disk directory is full; erase files - that are not needed and retry. - - - SOURCE FILE NAME ERROR - - Improperly formed ASM filename, for - example, it is specified with ? fields. - - - SOURCE FILE READ ERROR - - Source file cannot be read properly by the - assembler; execute a TYPE to determine the - point of error. - - - - 3-22 - - - - K - - -CP/M Operating System Manual 3.6 Error Messages - - -Table 3-10. (continued) - - F - Message Meaning - - OUTPUT FILE WRITE ERROR - - Output files cannot be written properly; - most likely cause is a full disk, erase and - retry. - - - CANNOT CLOSE FILE - - Output file cannot be closed; check to see - if disk is write protected. - K - - - -3.7 A Sample Session - - 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. - - - d -A>ASM SORT Assemble SORT.ASM - -CP/M ASSEMBLER - VER 1.0 - -0015C Next free address -003H USE FACTOR Percent of table used 00 to ff (hexadecimal) -END OF ASSEMBLY - -A>DIR SORT.* - -SORT ASM Source file -SORT BAK Back-up from last edit -SORT PRN Print file (contains tab characters) -SORT HEX Machine code file - -A>TYPE SORT.PRN - Source line - - ; SORT PROGRAM IN CP/M ASSEMBLY LANGUAGE - ; START AT THE BEGINNING OF THE TRANSIENT - PROGRAM AREA - -Machine code location -0100 ORG 100H - -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 - - - 3-23 - - - - - -CP/M Operating System Manual 3.7 A Sample Session - - - ; - ; 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>TYPE SORT.HEX Equate value - -:10010000214601360121470136007EFE09D2190140 -:100110002146017EB7C20001FF5F16002148011988 Machine code in -:10012000194E79234623965778239EDA3F01B2CAA7 HEX format - -:100130003F0156702B5E712B722B732146013421C7 -:07014000470134C30A01006E Machine code in -:10014800050064001E00320014000700E8032C01BB HEX format -:0401580064000180BE -:0000000000 - - 3-24 - - - - - -CP/M Operating System Manual 3.7 A Sample Session - - -A>DDT SORT.HEX Start debug run - -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 1016 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 - - - 3-25 - - - - - -CP/M Operating System Manual 3.7 A Sample Session - - -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>DDT SORT.HEX 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 - - - 3-26 - - - - - -CP/M Operating System Manual 3.7 A Sample Session - - - - 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>DDT SORT.COM 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>ED SORT.ASM 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 - - - - - 3-27 - - - - - -CP/M Operating System Manual 3.7 A Sample Session - - -*- 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>ASM SORT.AAZ Skip PRN file - -CP/M ASSEMBLER - VER 1.0 - -015C Next address to assemble -003H USE FACTOR -END OF ASSEMBLY - -A>DDT SORT.HEX 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. - K - - -End of Section 3 - - - - - - - - - 3-28 - - - - - - - - - Section 4 - - CP/M Dynamic Debugging Tool - - - -4.1 Introduction - - 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: - - DDT - DDT filename.HEX - DDT filename.COM - -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. - - 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: - - DDT - Ifilename.HEX or Ifilename.COM - R - -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. - - Upon initiation, DDT prints a sign-on message in the form: - - DDT VER m.m - -where m.m is the revision number. - - 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: - - - - - - - - - 4-1 - - - - - -CP/M Operating System Manual 4.1 Introduction - - -Table 4-1. Line-editing Controls - F - - Control Result - - rubout removes the last character typed - - CTRL-U removes the entire line, ready for retyping - - CTRL-C reboots system - K - - - 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. - - - Table 4-2. DDT Commands - - Command Result - Character - - C - A enters assembly-language mnemonics with - operands. - - D displays memory in hexadecimal and ASCII. - - F fills memory with constant data. - - G begins execution with optional breakpoints. - - I sets up a standard input File Control - Block. - - L lists memory using assembler mnemonics. - - M moves a memory segment from source to - destination. - - R reads a program for subsequent testing. - - S substitutes memory values. - - T traces program execution. - - U untraced program monitoring. - - X examines and optionally alters the CPU - state. - K - - -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. - - - 4-2 - - - - -CP/M Operating System Manual 4.1 Introduction - - - 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: - - SAVE n filename. COM - -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 - - SAVE 18 X.COM - -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 - - DDT X.COM - -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. - - -4.2 DDT Commands - - 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. - - 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. - - -4.2.1 The A (Assembly) Command - - DDT allows in-line assembly language to be inserted into the -current memory image using the A command, which takes the form: - - - - 4-3 - - - - - -CP/M Operating System Manual 4.2 DDT Commands - - - As - -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 Intel 8080 Assembly Language -Reference Card 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. - - Upon completion of assembly language input, you can review the -memory segment using the DDT disassembler (see the L command). - - 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. - - -4.2.2 The D (Display) Command - - The D command allows you to view the contents of memory in -hexadecimal and ASCII formats. The D command takes the forms: - - D - Ds - Ds,f - - 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: - -aaaa bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb cccccccccccccccc - -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. - - The second form of the D command is similar to the first, -except that the display address is first set to address s. - - 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. - - - - - 4-4 - - - - - -CP/M Operating System Manual 4.2 DDT Commands - - - Excessively long displays can be aborted by pressing the return -key. - - -4.2.3 The F (Fill) Command - - The F command takes the form: - - Fs,f,c, - -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. - - -4.2.4 The G (Go) Command - - A program is executed using the G command, with up to two -optional breakpoint addresses. The G command takes the forms: - - - G - Gs - Gs,b - Gs,b,c - G,b - G,b,c - - - 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. - - 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. - - 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. - - 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. - - - - - 4-5 - - - - - -CP/M Operating System Manual 4.2 DDT Commands - - - 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 - - *d - -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: - - G,1234 - G400,400 - -both produce an immediate breakpoint without executing any -instructions. - - -4.2.5 The I (Input) Command - - 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: - - Ifilename - Ifilename.typ - - 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. - - -4.2.6 The L (List) Command - - The L command is used to list assembly-language mnemonics in a -particular program region. The L command takes the forms: - - L - Ls - Ls,f - - 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 - - - 4-6 - - - - - -CP/M Operating System Manual 4.2 DDT Commands - - -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. - - -4.2.7 The M (Move) Command - - The M command allows block movement of program or data areas -from one location to another in memory. The M command takes the -form: - - Ms,f,d - -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. - - -4.2.8 The R (Read) Command - - 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: - - R - RB - -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). - - Recall that the command, - - DDT filename.filetype - -which initiates the DDT program, equals to the following commands: - - DDT - -Ifilename.filetype - -R - - - - - - 4-7 - - - - - -CP/M Operating System Manual 4.2 DDT Commands - - - - 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: - - NEXT PC - nnnn pppp - -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). - - -4.2.9 The S (Set) Command - - The S command allows memory locations to be examined and -optionally altered. The S command takes the form: - - Ss - -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. - - -4.2.10 The T (Trace) Command - - The T command allows selective tracing of program execution for -1 to 65535 program steps. The T command takes the forms: - - T - Tn - - 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 - - *hhhh - -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. - - 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. - - - 4-8 - - - - -CP/M Operating System Manual 4.2 DDT Commands - - - 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. - - 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. - - -4.2.11 The U (Untrace) Command - - 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. - - -4.2.12 The X (Examine) Command - - The X command allows selective display and alteration of the -current CPU state for the program under test. The X command takes -the forms: - - X - Xr - -where r is one of the 8080 CPU registers listed in the following -table. - - - Table 4-3. CPU Registers - - Register Meaning Value - - 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) - - - - 4-9 - - - - - -CP/M Operating System Manual 4.2 DDT Commands - - - Table 4-3. (continued) - - Register Meaning Value - - H HL register pair (0-FFFF) - S Stack pointer (0-FFFF) - P Program counter (0-FFFF) - - -In the first case, the CPU register state is displayed in the -format: - - CfZfMfEflf A=bb B=dddd D=dddd H=dddd S=dddd P=dddd inst - -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. - - 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. - - -4.3 Implementation Notes - - 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. - - 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. - - 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 - - - 4-10 - - - - - -CP/M Operating System Manual 4.3 Implementation Notes - - -display (T and X) commands list the inst field of the display in -hexadecimal, rather than as a decoded instruction. - - -4.4 A Sample Program - - 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. - U - - -A>ED SCAN.ASM 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 - - - - - - - - - - - - - - - - - - 4-11 - - - - - -CP/M Operating System Manual 4.4 A Sample Program - - -^-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>ASM SCAN Start Assembler - -CP/M ASSEMBLER - VER 1.0 - -0122 -002H USE FACTOR -END OF ASSEMBLY Assembly complete; lock at program listing - -A>TYPE SCAN.PRN - 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 - - - - - - - - - - 4-12 - - - - - -CP/M Operating System Manual 4.4 A Sample Program - - - 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>DDT SCAN.HEX 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 - - - - - - - - - - - 4-13 - - - - - -CP/M Operating System Manual 4.4 A Sample Program - - - 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 .................. - - - 4-14 - - - - - -CP/M Operating System Manual 4.4 A Sample Program - - -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 - - - 4-15 - - - - - -CP/M Operating System Manual 4.4 A Sample Program - - -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>SAVE 1 SCAN.COM Program resides on first - page, so save 1 page. -A>DDT SCAN.COM - 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 - - - 4-16 - - - - - -CP/M Operating System Manual 4.4 A Sample Program - - -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 _. 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 - - - 4-17 - - - - - -CP/M Operating System Manual 4.4 A Sample Program - - - 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 - - - 4-18 - - - - - -CP/M Operating System Manual 4.4 A Sample Program - - - 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>SAVE 1 SCAN.COM Save memory image - -A>DDT SCAN.COM Restart DDT - -DDT VER 1.0 -NEXT PC -0200 0100 --XP - -P=0100 - --L116 - - 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 - - - 4-19 - - - - - -CP/M Operating System Manual 4.4 A Sample Program - - -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>ED SCAN.ASM Re-edit the source program, and make both changes - -*NSUB -*0LT - CTRL-Z SUB C ;LARGER VALUE IN C? -*SSUB^|ZCMP^|Z0LT - CMP D ;LARGER VALUE IN C? -* - JNC NFOUND ;JUMP IF LARGER VALUE NOT FOUND -*SNC^|ZC^|Z0LT - JC NFOUND ;JUMP IF LARGER VALUE NOT FOUND -*E - Reassemble, selecting source from disk A -A>ASM SCAN.AAZ <--- 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>DDT SCAN.HEX 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 .'...)........ - - - 4-20 - - - - - -CP/M Operating System Manual 4.4 A Sample Program - - -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. - K - - -End of Section 4 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 4-21 - - - - - - - - -Section 5 - -CP/M 2 System Interface - - -5.1 Introduction - - 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. - - 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. - - 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. - - - - High - Memory FDOS (BDOS+BIOS) - FBASE: - - CCP - CBASE: - - TPA - TBASE: - - System Parameters - BOOT: - - -Figure 5-1. CP/M Memory Organization - - - - 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 - - - 5-1 - - - - - -CP/M Operating System Manual 5.1 Introduction - - -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. - - 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: - - command - command file1 - command file1 file2 - -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 - - command.COM - - 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. - - 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. - - 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. - - 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 - - - 5-2 - - - - - -CP/M Operating System Manual 5.1 Introduction - - -disk read was unsuccessful. - - -5.2 Operating System Call Conventions - - 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, Programmer's -Utilities Guide for the CP/M Family of Operating Systems. - - 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 - - o read a console character - o write a console character - o read a sequential character - o write a sequential character - o get or set I/O status - o print console buffer - o interrogate console ready - - The following FDOS operations perform disk I/O: - - o disk system reset - o drive selection - o file creation - o file close - o directory search - o file delete - o file rename - o random or sequential read - o random or sequential write - o interrogate available disks - o interrogate selected disk - o set DMA address - o set/reset file indicators. - - 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. - - - - - - - 5-3 - - - - - -CP/M Operating System Manual 5.2 Call Conventions - - - 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 - - - Functions 28 and 32 should be avoided in application programs -to maintain upward compatibility with CP/M. - - 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. - - - 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 - CPI '*' ;END OF PROCESSING? - JNZ NEXTC ;LOOP IF NOT - RET ;RETURN TO CCP - END - - - 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 - - - 5-4 - - - - - -CP/M Operating System Manual 5.2 Call Conventions - - -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. - - - Table 5-1. CP/M Filetypes - - Filetype Meaning - - ASM Assembler Source - PRN Printer Listing - HEX Hex Machine Code - BAS Basic Source File - INT Intermediate Code - COM Command File - PLI PL/I Source File - REL Relocatable Module - TEX TEX Formatter Source - BAK ED Source Backup - SYM SID Symbol File - $$$ Temporary File - - - 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. - - 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. - - 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. - - - 5-5 - - - - - -CP/M Operating System Manual 5.2 Call Conventions - - - - 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. - - 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. - - - - 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 - - - Figure 5-2. File Control Block Format - - - -The following table lists and describes each of the fields in the -File Control Block figure. - - - Table 5-2. File Control Block Fields - - Field Definition - - 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. - - f1...f8 contain the filename in ASCII - upper-case, with high bit = 0 - - 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 - - ex contains the current extent - number, normally set to 00 by - the user, but in range 0-31 - during file I/O - - - - 5-6 - - - - - -CP/M Operating System Manual 5.2 Call Conventions - - - Table 5-2. (continued) - - Field Definition - - s1 reserved for internal system use - - s2 reserved for internal system use, - set to zero on call to OPEN, MAKE, - SEARCH - - rc record count for extent ex; - takes on values from 0-127 - - d0...dn filled in by CP/M; reserved for - system use - - cr current record to read or write in - a sequential file operation; - normally set to zero by user - - 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 - - - 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. - - 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). - - 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: - - PROGNAME B:X.ZOT Y.ZAP - - - - - 5-7 - - - - - -CP/M Operating System Manual 5.2 Call Conventions - - -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. - - 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. - - 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: - - - BOOT+0080H: - - +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' - - -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. - - Individual functions are described in detail in the pages that -follow. - - - - - - - - - - - - - - - - - - - - 5-8 - - - - - -CP/M Operating System Manual 5.2 Call Conventions - - - - - - - FUNCTION 0: SYSTEM RESET - - Entry Parameters: - Register C: 00H - - - - 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. - - - - - - - FUNCTION 1: CONSOLE INPUT - - Entry Parameters: - Register C: 01H - - Returned Value: - Register A: ASCII Character - - - - 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. - - - - - - - - - - - - - - - - - - - 5-9 - - - - - -CP/M Operating System Manual 5.2 Call Conventions - - - - - - - FUNCTION 2: CONSOLE OUTPUT - - Entry Parameters - Register C: 02H - Register E: ASCII Character - - - - 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. - - - - - - - FUNCTION 3: READER INPUT - - Entry Parameters: - Register C: 03H - - Returned Value: - Register A: ASCII Character - - - - 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. - - - - - - - - - - - - - - - - - - - - - - - 5-10 - - - - - -CP/M Operating System Manual 5.2 Call Conventions - - - - - - - FUNCTION 4: PUNCH OUTPUT - - Entry Parameters: - Register C: 04H - register E: ASCII Character - - - - The Punch Output function sends the character from register E -to the logical punch device. - - - - - - - FUNCTION 5: LIST OUTPUT - - Entry Parameters: - Register C: 05H - Register E: ASCII Character - - - - The List Output function sends the ASCII character in register -E to the logical listing device. - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5-11 - - - - - -CP/M Operating System Manual 5.2 Call Conventions - - - - - - - FUNCTION 6: DIRECT CONSOLE I/O - - Entry Parameters: - Register C: 06H - Register E: 0FFH (input) or - char (output) - - Returned Value: - Register A: char or status - - - - 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. - - 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. - - 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. - - Function 6 must not be used in conjunction with other console -I/O functions. - - - - - - - FUNCTION 7: GET I/O BYTE - - Entry Parameters: - Register C: 07H - - Returned Value: - Register A: I/O Byte Value - - - - The Get I/O Byte function returns the current value of IOBYTE -in register A. See Chapter 6 for IOBYTE definition. - - - - 5-12 - - - - - -CP/M Operating System Manual 5.2 Call Conventions - - - - - - - FUNCTION 8: SET I/O BYTE - - Entry Parameters: - Register C: 08H - Register E: I/O Byte Value - - - - The SET I/O Byte function changes the IOBYTE value to that -given in register E. - - - - - - - FUNCTION 9: PRINT STRING - - Entry Parameters: - Register C: 09H - Registers DE: String Address - - - - 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. - - - - - - - - - - - - - - - - - - - - - - - - - - 5-13 - - - - - -CP/M Operating System Manual 5.2 Call Conventions - - - - - - - FUNCTION 10: READ CONSOLE BUFFER - - Entry Parameters: - Register C: 0AH - Registers DE: Buffer Address - - Returned Value: - Console Characters in Buffer - - - - 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: - - DE:+0 +1 +2 +3 +4 +5 +6 +7 +8 . . .+n - - mx nc c1 c2 c3 c4 c5 c6 c7 ... ?? - -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. - - - Table 5-3. Edit Control Characters - - Character Edit Control Function - - rub/del removes and echoes the last character - - CTRL-C reboots when at the beginning of line - - CTRL-E causes physical end of line - - CTRL-H backspaces one character position - - CTRL-J (line feed) terminates input line - - CTRL-M (return) terminates input line - - CTRL-R retypes the current line after new line - - CTRL-U removes current line - - CTRL-X same as CTRL-U - - - - - 5-14 - - - - - -CP/M Operating System Manual 5.2 Call Conventions - - -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. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5-15 - - - - - -CP/M Operating System Manual 5.2 Call Conventions - - - - - - - FUNCTION 11: GET CONSOLE STATUS - - Entry Parameters: - Register C: 0BH - - Returned Value: - Register A: Console Status - - - - 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. - - - - - - - FUNCTION 12: RETURN VERSION NUMBER - - Entry Parameters: - Register C: 0CH - - Returned Value: - Registers HL: Version Number - - - - 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. - - - - - - - - - - - - - - - - - 5-16 - - - - - -CP/M Operating System Manual 5.2 Call Conventions - - - - - - - FUNCTION 13: RESET DISK SYSTEM - - Entry Parameters: - Register C: 0DH - - - - 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. - - - - - - - FUNCTION 14: SELECT DISK - - Entry Parameters: - Register C: 0EH - Register E: Selected Disk - - - - 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. - - - - - - - - - - - - - - - 5-17 - - - - - -CP/M Operating System Manual 5.2 Call Conventions - - - - - - - FUNCTION 15: OPEN FILE - - Entry Parameters: - Register C: 0FH - Registers DE: FCB Address - - Returned Value: - Register A: Directory Code - - - - 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. - - 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. - - - - - - - - - - - - - - - - - - - - - - - 5-18 - - - - - -CP/M Operating System Manual 5.2 Call Conventions - - - - - - - FUNCTION 16: CLOSE FILE - - Entry Parameters: - Register C: 10H - Registers DE: FCB Address - - Returned Value: - Register A: Directory Code - - - - 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. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5-19 - - - - - -CP/M Operating System Manual 5.2 Call Conventions - - - - - - - FUNCTION 17: SEARCH FOR FIRST - - Entry Parameters: - Register C: 11H - Registers DE: FCB Address - - Returned Value: - Register A: Directory Code - - - - 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. - - 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. - - - - - - - - - - - - - - - - - - - - - - 5-20 - - - - - -CP/M Operating System Manual 5.2 Call Conventions - - - - - - - FUNCTION 18: SEARCH FOR NEXT - - Entry Parameters: - Register C: 12H - - Returned Value: - Register A: Directory Code - - - - 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. - - - - - - - FUNCTION 19: DELETE FILE - - Entry Parameters: - Register C: 13H - Registers DE: FCB Address - - Returned Value: - Register A: Directory Code - - - - 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. - - 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. - - - - - - - - - - - - - - 5-21 - - - - - -CP/M Operating System Manual 5.2 Call Conventions - - - - - - - FUNCTION 20: READ SEQUENTIAL - - Entry Parameters: - Register C: 14H - Registers DE: FCB Address - - Returned Value: - Register A: Directory Code - - - - 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). - - - - - - - FUNCTION 21: WRITE SEQUENTAIL - - Entry Parameters: - Register C: 15H - Registers DE: FCB Address - - Returned Value: - Register A: Directory Code - - - - 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. - - - 5-22 - - - - - -CP/M Operating System Manual 5.2 Call Conventions - - - - - - - FUNCTION 22: MAKE FILE - - Entry Parameters: - Register C: 16H - Registers DE: FCB Address - - Returned Value: - Register A: Directory Code - - - - 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. - - - - - - - FUNCTION 23: RENAME FILE - - Entry Parameters: - Register C: 17H - Registers DE: FCB Address - - Returned Value: - Register A: Directory Code - - - - 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. - - - - - - 5-23 - - - - - -CP/M Operating System Manual 5.2 Call Conventions - - - - - - - FUNCTION 24: RETURN LOG-IN VECTOR - - Entry Parameters: - Register C: 18H - - Returned Value: - Registers HL: Log-in Vector - - - - 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. - - - - - - - FUNCTION 25: RETURN CURRENT DISK - - Entry Parameters: - Register C: 19H - - Returned Value: - Register A: Current Disk - - - - 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. - - - - - - - - - - - - - - - - 5-24 - - - - - -CP/M Operating System Manual 5.2 Call Conventions - - - - - - - FUNCTION 26: SET DMA ADDRESS - - Entry Parameters: - Register C: 1AH - Registers DE: DMA Address - - - - 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. - - - - - - - FUNCTION 27: GET ADDR (ALLOC) - - Entry Parameters: - Register C: 1BH - - Returned Value: - Registers HL: ALLOC Address - - - - 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. - - - - - - - 5-25 - - - - - -CP/M Operating System Manual 5.2 Call Conventions - - - - - - - FUNCTION 28: WRITE PROTECT DISK - - Entry Parameters: - Register C: 1CH - - - - 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: - - BDOS ERR on d:R/O - - - - - - - FUNCTION 29: GET READ-ONLY VECTOR - - Entry Parameters: - Register C: 1DH - - Returned Value: - Registers HL: R/O Vector Value - - - - 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. - - - - - - - - - - - - - - - - - - - 5-26 - - - - - -CP/M Operating System Manual 5.2 Call Conventions - - - - - - - FUNCTION 30: SET FILE ATTRIBUTES - - Entry Parameters: - Register C: 1EH - Registers DE: FCB Address - - Returned Value: - Register A: Directory Code - - - - 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. - - - - - - - FUNCTION 31: GET ADDR (DISK PARMS) - - Entry Parameters: - Register C: 1FH - - Returned Value: - Registers HL: DPB Address - - - - 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. - - - - - - - - - 5-27 - - - - - -CP/M Operating System Manual 5.2 Call Conventions - - - - - - - FUNCTION 32: SET/GET USER CODE - - Entry Parameters: - Register C: 20H - Register E: OFFH (get) or - User Code (set) - - Returned Value: - Register A: Current Code or - (no value) - - - - 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. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5-28 - - - - - -CP/M Operating System Manual 5.2 Call Conventions - - - - - - - FUNCTION 33: READ RANDOM - - Entry Parameters: - Register C: 21H - - Returned Value: - Register A: Return Code - - - - 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. - - 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. - - 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. - - 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. - - - - - - - 5-29 - - - - - -CP/M Operating System Manual 5.2 Call Conventions - - - - Error codes returned in register A following a random read are -listed below. - - - 01 reading unwritten data - - 02 (not returned in random mode) - - 03 cannot close current extent - - 04 seek to unwritten extent - - 05 (not returned in read mode) - - 06 seek past physical end of disk - - - 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. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5-30 - - - - - -CP/M Operating System Manual 5.2 Call Conventions - - - - - - - FUNCTION 34: WRITE RANDOM - - Entry Parameters: - Register C: 22H - Registers DE: FCB Address - - Returned Value: - Register A: Return Code - - - - 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. - - 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. - - - - - - - - - - - - - - - - - - - - - - 5-31 - - - - - -CP/M Operating System Manual 5.2 Call Conventions - - - - - - - FUNCTION 35: COMPUTE FILE SIZE - - Entry Parameters: - Register C: 23H - Registers DE: FCB Address - - Returned Value: - Random Record Field Set - - - - 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. - - 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. - - 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. - - - - - - - - - - - - - - - - - - - - 5-32 - - - - - -CP/M Operating System Manual 5.2 Call Conventions - - - - - - - FUNCTION 36: SET RANDOM RECORD - - Entry Parameters: - Register C: 24H - Registers DE: FCB Address - - Returned Value: - Random Record Field Set - - - - 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. - - 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. - - 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. - - - - - - - - - - - - - - - - - - - 5-33 - - - - - -CP/M Operating System Manual 5.2 Call Conventions - - - - - - - FUNCTION 37: RESET DRIVE - - Entry Parameters: - Register C: 25H - Registers DE: Drive Vector - - Returned Value: - Register A: 00H - - - - 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:. - - To maintain compatibility with MP/M, CP/M returns a zero value. - - - - - - - FUNCTION 40: WRITE RANDOM WITH ZERO FILL - - Entry Parameters: - Register C: 28H - Registers DE: FCB Address - - Returned Value: - Register A: Return Code - - - - 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. - - - - - - - - - - - - - - - - - - 5-34 - - - - - -CP/M Operating System Manual 5.3 A Sample Copy Program - - -5.3 A Sample File-to-File Copy Program - - 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. - U - - - - ; 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 - - - 5-35 - - - - - -CP/M Operating System Manual 5.3 A Sample Copy Program - - -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 - - - 5-36 - - - - - -CP/M Operating System Manual 5.3 A Sample Copy Program - - -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 - K - - - - 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 - - - 5-37 - - - - - -CP/M Operating System Manual 5.3 A Sample Copy Program - - -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. - - -5.4 A Sample File Dump Utility - - 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. - U - - - -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 - - - 5-38 - - - - - -CP/M Operating System Manual 5.4 A Sample File Dump Utility - - - ;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 - - - 5-39 - - - - - -CP/M Operating System Manual 5.4 A Sample File Dump Utility - - - 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 - ; - - - 5-40 - - - - - -CP/M Operating System Manual 5.4 A Sample File Dump Utility - - - ; 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 - - - 5-41 - - - - - -CP/M Operating System Manual 5.4 A Sample File Dump Utility - - - ; 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 - K - - - -5.5 A Sample Random Access Program - - 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 - - RANDOM X.DAT - -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 - - next command? - -and is followed by operator input, followed by a carriage return. -The input commands take the form - - - - 5-42 - - - - - -CP/M Operating System Manual 5.5 Sample Random Access Program - - - nW nR Q - -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 - - type data: - -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 - - error, try again. - - 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. - U - - - - Sample Random Access Program for CP/M 2.0 - -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 - ; - - - 5-43 - - - - - -CP/M Operating System Manual 5.5 Sample Random Access Program - - -000d = cr equ 0dh ;carriage return -000a = lf equ 0ah ;line feed - ; - - - Load SP, Set-Up File for Random Access - -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 - - - Loop Back to Ready After Each Command - - ; - 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 - - - 5-44 - - - - - -CP/M Operating System Manual 5.5 Sample Random Access Program - - -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 - ; - - - End of Quit Command, Process Write - - 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 - ; - - - End of Write Command, Process Read - - notw: - ; not a write command, read record? -0189 fe52 cpi 'R' -018b c2b900 jnz error ;skip if not - ; - ; read random record - - - 5-45 - - - - - -CP/M Operating System Manual 5.5 Sample Random Access Program - - -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 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5-46 - - - - - -CP/M Operating System Manual 5.5 Sample Random Access Program - - - End of Read Command, All Errors End Up Here - - ; - error: -01b9 115900 lxi d,errmsg -01bc cdda00 call print -01bf c33700 jmp ready - ; - - - Utility Subroutines for Console I/O - - 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 - - - 5-47 - - - - - -CP/M Operating System Manual 5.5 Sample Random Access Program - - - ;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 - ; - - - String Data Area for Console Messages - - 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? $' - ; - - - Fixed and Variable Data Area - -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 - - 5-48 - - - - K - - -CP/M Operating System Manual 5.5 Sample Random Access Program - - - - 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 - - GETKEY NAMES.DAT LASTNAME 10 20 - -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. - - 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 - - QUERY NAMES.DAT LASTNAME.KEY - -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. - - 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. - - 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. - - - - - - 5-49 - - - - - -CP/M Operating System Manual 5.6 System Function Summary - - -5.6 System Function Summary - -Function Function Input Output -Number Name - -Decimal Hex - - 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 - - - 5-50 - - - - - -CP/M Operating System Manual 5.6 System Function Summary - - - 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 - - - - -*Note that A = L, and B = H upon return. - - -End of Section 5 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5-51 - - - - - - - - -Section 6 - -CP/M 2 Alteration - - - -6.1 Introduction - - 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. - - 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. - - To achieve device independence, CP/M is separated into three -distinct modules: - - o BIOS is the Basic I/O System, which is environment dependent. - - o BDOS is the Basic Disk Operating System, which is not dependent - upon the hardware configuration. - - o CCP is the Console Command Processor, which uses the BDOS. - - 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. - - 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. - - - 6-1 - - - - -CP/M Operating System Manual 6.1 Introduction - - - 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. - - 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. - - 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. - - 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. - - -6.2 First-level System Regeneration - - 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. - - - Table 6-1. Standard Memory Size Values - - Memory Size Value - - 24K: b = 24K - 20K = 4K = 1000H - - 32K: b = 32K - 20K = 12K = 3000H - - 40K: b = 40K - 20K = 20K = 5000H - - 48K: b = 48K - 20K = 28K = 7000H - - 56K: b = 56K - 20K = 36K = 9000H - - 62K: b = 62K - 20K = 42K = A800H - - 64K: b = 64K - 20K = 44K = B000H - - - 6-2 - - - - -CP/M Operating System Manual 6.2 First-level Regeneration - - - 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). - - Follow these steps to patch your CP/M system: - - - 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. - - 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. - - 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). - - 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. - - 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. - - 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. - - 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. - - 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. - - - 6-3 - - - - -CP/M Operating System Manual 6.2 First-level Regeneration - - - 9) Use PUTSYS to place the patched memory image of CP/M onto - the first two tracks of a blank disk for testing. - - 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. - - If difficulties are encountered, use whatever debug - facilities are available to trace and breakpoint the CBIOS. - - 11) Upon completion of step 10, CP/M has prompted the console - for a command input. To test the disk write operation, - type - - SAVE 1 X.COM - - All commands must be followed by a carriage return. CP/M - responds with another prompt after several disk accesses: - - A> - - If it does not, debug the disk write functions and retry. - - 12) Test the directory command by typing - - DIR - - CP/M responds with - - A:X COM - - 13) Test the erase command by typing - - ERA X.COM - - CP/M responds with the A prompt. This is now an - operational system that only requires a bootstrap loader to - function completely. - - 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. - - 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. - - - - 6-4 - - - - - -CP/M Operating System Manual 6.2 First-level Regeneration - - - 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. - - 17) Load the modified CP/M system and test it by typing - - DIR - - 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. - - 18) Load and test the debugger by typing - - DDT - - See Chapter 4 for operating procedures. - - 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: - - Copyright (c), 1983 - Digital Research - - on each copy that is made with the COPY program. - - 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. - - - 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. - - 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. - - - 6-5 - - - - - -CP/M Operating System Manual 6.3 Second-level System Generation - - -6.3 Second-level System Generation - - 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). - - 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. - - To get the memory image of CP/M into the TPA configured for the -desired memory size, type the command: - - MOVCPM xx* - -where xx is the memory size in decimal K bytes, for example, 32 for -32K. The response is as follows: - - CONSTRUCTING xxK CP/M VERS 2.0 - - READY FOR "SYSGEN" OR - - "SAVE 34 CPMxx.COM" - - 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: - - SAVE 34 CPMxx.COM - - 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: - - DDT CPMxx.COM Loads DDT, then reads the CP/M image. - -DDT should respond with the following: - - NEXT PC - 2300 0100 - - The DDT prompt - -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 - - - 6-6 - - - - - -CP/M Operating System Manual 6.3 Second-level System Generation - - -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 - - 3400H + n = 980H, or n =980H - 3400H - -Assuming two's complement arithmetic, n = D580H, which can be -checked by - - 3400H + D580H = 10980H = 0980H (ignoring high-order - overflow). - - Note that for larger systems, n satisfies - - (3400H+b) + n = 980H, or - n = 980H - (3400H + b), or - n = D580H - b - -The value of n for common CP/M systems is given below. - - - Table 6-2. Common Values for CP/M Systems - - Memory Size BIAS b Negative Offset n - - 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 - - - If you want to locate the address x within the memory image -loaded under DDT in a 20K system, first type - - Hx,n Hexadecimal sum and difference - -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: - - H3400,D580 - -produces 980H as the sum, which is where the CCP is located in the -memory image under DDT. - - - - 6-7 - - - - - -CP/M Operating System Manual 6.3 Second-level System Generation - - - 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: - - L1F80 - -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: - - H900,n Subtract load address from target address. - - 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 - - H900,80 - -produces - - 0980 0880 Sum and difference in hex. - -Therefore, the bias m would be 0880H. To read-in the BOOT, give the -command: - - ICBOOT.HEX Input file CBOOT.HEX - -Then - - Rm Read CBOOT with a bias of m (=900H-n). - -Examine the CBOOT with - - L900 - -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 - - ICBIOS.HEX Ready the hex file for loading. - - 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 - - RD580 Read the file with bias D580H. - -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. - - - - 6-8 - - - - - -CP/M Operating System Manual 6.3 Second-level System Generation - - - 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: - - - SYSGEN Start the SYSGEN program. - - SYSGEN VERSION 2.0 Sign-on message from SYSGEN. - - 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. - - DESTINATION DRIVE NAME Respond with B to write the new - (OR RETURN TO REBOOT) system to the disk in drive B. - - - DESTINATION ON B, Place a scratch disk in drive - THEN TYPE RETURN B, then press RETURN. - - FUNCTION COMPLETE - DESTINATION DRIVE NAME - (OR RETURN TO REBOOT) - - - Place the scratch disk in drive A, then perform a cold start to -bring up the newly-configured CP/M system. - - 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: - - Copyright (c), 1979 - Digital Research - - -6.4 Sample GETSYS and PUTSYS Programs - - 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. - - - - - - - - - - - - - - - 6-9 - - - - - -CP/M Operating System Manual 6.4 Sample GETSYS and PUTSYS - - -; GETSYS PROGRAM -- READ TRACKS 0 AND 1 TO MEMORY AT 3380H -; REGISTER USE - -; A (SCRATCH REGISTER) - -; B TRACK COUNT (0, 1) - -; C SECTOR COUNT (1,2,...,26) - -; DE (SCRATCH REGISTER PAIR) - -; HL LOAD ADDRESS - -; SP SET TO STACK ADDRESS - -; -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 - -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 - -; -; 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 - -; -; USER-SUPPLIED SUBROUTINE TO READ THE DISK -READSEC: -; ENTER WITH TRACK NUMBER IN REGISTER B, - SECTOR NUMBER IN REGISTER C, AND - -; ADDRESS TO FILL IN HL - -; - PUSH B ;SAVE B AND C REGISTERS - PUSH H ;SAVE HL REGISTERS - - - Listing 6-1. GETSYS Program - - - - 6-10 - - - - - -CP/M Operating System Manual 6.4 Sample GETSYS and PUTSYS - - - ................................................. - 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 - - END START - - - Listing 6-1. (continued) - - - - 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. - - 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. - - -6.5 Disk Organization - - 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. - - 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. - - - 6-11 - - - - - -CP/M Operating System Manual 6.5 Disk Organization - - - Table 6-3. CP/M Disk Sector Allocation - -Track # Sector Page# Memory Address CP/M Module name - - 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 ' - 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) - - 6-12 - - - - -CP/M Operating System Manual 6.6 BIOS Entry Points - - -6.6 The BIOS Entry Points - - The entry points into the BIOS from the cold start loader and -BDOS are detailed below. Entry to the BIOS is through a jump vector -located at 4A00H+b, as shown below. See Appendixes A and B. The -jump vector is a sequence of 17 jump instructions that send program -control to the individual BIOS subroutines. The BIOS subroutines -might be empty for certain functions (they might contain a single -RET operation) during reconfiguration of CP/M, but the entries must -be present in the jump vector. - - The jump vector at 4A00H+b takes the form shown below, where -the individual jump addresses are given to the left: - - - 4A00H+b JMP BOOT ;ARRIVE HERE FROM COLD - START LOAD - - 4A03H+b JMP WBOOT ;ARRIVE HERE FOR WARM START - - 4A06H+b JMP CONST ;CHECK FOR CONSOLE CHAR - READY - - 4A09H+b JMP CONIN ;READ CONSOLE CHARACTER IN - - 4A0CH+b JMP CONOUT ;WRITE CONSOLE CHARACTER - OUT - - 4A0FH+b JMP LIST ;WRITE LISTING CHARACTER OUT - - 4A12H+b JMP PUNCH ;WRITE CHARACTER TO PUNCH - DEVICE - - 4A15H+b JMP READER ;READ READER DEVICE - - 4A18H+b JMP HOME ;MOVE TO TRACK 00 ON - SELECTED DISK - - 4A1BH+b JMP SELDSK ;SELECT DISK DRIVE - - 4A1EH+b JMP SETTRK ;SET TRACK NUMBER - - 4A21H+b JMP SETSEC ;SET SECTOR NUMBER - - 4A24H+b JMP SETDMA ;SET DMA ADDRESS - - 4A27H+b JMP READ ;READ SELECTED SECTOR - - 4A2AH+b JMP WRITE ;WRITE SELECTED SECTOR - - 4A2DH+b JMP LISTST ;RETURN LIST STATUS - - 4A30H+b JMP SECTRAN ;SECTOR TRANSLATE - SUBROUTINE - - - Listing 6-2. BIOS Entry Points - - 6-13 - - - - -CP/M Operating System Manual 6.6 BIOS Entry Points - - - Each jump address corresponds to a particular subroutine that -performs the specific function, as outlined below. There are three -major divisions in the jump table: the system reinitialization, -which results from calls on BOOT and WBOOT; simple character I/O, -performed by calls on CONST, CONIN, CONOUT, LIST, PUNCH, READER, and -LISTST; and disk I/O, performed by calls on HOME, SELDSK, SETTRK, -SETSEC, SETDMA, READ, WRITE, and SECTRAN. - - All simple character I/O operations are assumed to be performed -in ASCII, upper- and lower-case, with high-order (parity bit) set to -zero. An end-of-file condition for an input device is given by an -ASCII CTRL-Z (1AH). Peripheral devices are seen by CP/M as logical -devices and are assigned to physical devices within the BIOS. - - To operate, the BDOS needs only the CONST, CONIN, and CONOUT -subroutines. LIST, PUNCH, and READER can be used by PIP, but not -the BDOS. Further, the LISTST entry is currently used only by -DESPOOL, the print spooling utility. Thus, the initial version of -CBIOS can have empty subroutines for the remaining ASCII devices. - - The following list describes the characteristics of each -device. - - - o CONSOLE is the principal interactive console that communicates - with the operator and it is accessed through CONST, CONIN, and - CONOUT. Typically, the CONSOLE is a device such as a CRT or - teletype. - - o LIST is the principal listing device. If it exists on the - user's system, it is usually a hard-copy device, such as a - printer or teletype. - - o PUNCH is the principal tape punching device. If it exists, it - is normally a high-speed paper tape punch or teletype. - - o READER is the principal tape reading device, such as a simple - optical reader or teletype. - - - A single peripheral can be assigned as the LIST, PUNCH, and -READER device simultaneously. If no peripheral device is assigned -as the LIST, PUNCH, or READER device, the CBIOS gives an appropriate -error message so that the system does not hang if the device is -accessed by PIP or some other user program. Alternately, the PUNCH -and LIST routines can just simply return, and the READER routine can -return with a 1AH (CTRL-Z) in register A to indicate immediate end- -of-file. - - For added flexibility, you can optionally implement the IOBYTE -function, which allows reassignment of physical devices. The IOBYTE -function creates a mapping of logical-to-physical devices that can -be altered during CP/M processing, see the STAT command in Section -1.6.1. - - - - - 6-14 - - - - -CP/M Operating System Manual 6.6 BIOS Entry Points - - The definition of the IOBYTE function corresponds to the Intel -standard as follows: a single location in memory, currently -location 0003H, is maintained, called IOBYTE, which defines the -logical-to-physical device mapping that is in effect at a particular -time. The mapping is performed by splitting the IOBYTE into four -distinct fields of two bits each, called the CONSOLE, READER, PUNCH, -and LIST fields, as shown in the following figure. - - - most significant least significant - - IOBYTE AT 003H LIST PUNCH READER CONSOLE - - bits 6,7 bits 4,5 bits 2,3 bits 0,1 - - - Figure 6-1. IOBYTE Fields - - - - The value in each field can be in the range 0-3, defining the -assigned source or destination of each logical device. Table 6-4 -gives the values that can be assigned to each field. - - - Table 6-4. IOBYTE Field Values - - Value Meaning - - CONSOLE field (bits 0,1) - - 0 console is assigned to the console printer - device (TTY:) - 1 console is assigned to the CRT device (CRT:) - 2 batch mode: use the READER as the CONSOLE input, - and the LIST device as the CONSOLE output (BAT:) - 3 user-defined console device (UC1:) - - READER field (bits 2,3) - - 0 READER is the teletype device (TTY:) - 1 READER is the high speed reader device (PTR:) - 2 user-defined reader #1 (UR1:) - 3 user-defined reader #2 (UR2:) - - PUNCH field (bits 4,5) - - 0 PUNCH is the teletype device (TTY:) - 1 PUNCH is the high speed punch device (PTP:) - 2 user-defined punch #1 (UP1:) - 3 user-defined punch #2 (UP2:) - - LIST field (bits 6,7) - - 0 LIST is the teletype device (TTY:) - 1 LIST is the CRT device (CRT:) - 2 LIST is the line printer device (LPT:) - 3 user-defined list device (UL1:) - - 6-15 - - - - -CP/M Operating System Manual 6.6 BIOS Entry Points - - - The implementation of the IOBYTE is optional and effects only -the organization of the CBIOS. No CP/M systems use the IOBYTE -(although they tolerate the existence of the IOBYTE at location -0003H) except for PIP, which allows access to the physical devices, -and STAT, which allows logical-physical assignments to be make or -displayed. For more information see Section 1. In any case the -IOBYTE implementation should be omitted until the basic CBIOS is -fully implemented and tested; then you should add the IOBYTE to -increase the facilities. - - Disk I/O is always performed through a sequence of calls on the -various disk access subroutines that set up the disk number to -access, the track and sector on a particular disk, and the Direct -Memory Access (DMA) address involved in the I/O operation. After -all these parameters have been set up, a call is made to the READ or -WRITE function to perform the actual I/O operation. - - There is often a single call to SELDSK to select a disk drive, -followed by a number of read or write operations to the selected -disk before selecting another drive for subsequent operations. -Similarly, there might be a single call to set the DMA address, -followed by several calls that read or write from the selected DMA -address before the DMA address is changed. The track and sector -subroutines are always called before the READ or WRITE operations -are performed. - - The READ and WRITE routines should perform several retries (10 -is standard) before reporting the error condition to the BDOS. If -the error condition is returned to the BDOS, it reports the error to -the user. The HOME subroutine might or might not actually perform -the track 00 seek, depending upon controller characteristics; the -important point is that track 00 has been selected for the next -operation and is often treated in exactly the same manner as SETTRK -with a parameter of 00. - - The following table describes the exact responsibilities of -each BIOS entry point subroutine. - - - Table 6-5. BIOS Entry Points - - Entry Point Function - - F - BOOT The BOOT entry point gets control from the cold - start loader and is responsible for basic - system initialization, including sending a - sign-on message, which can be omitted in the - first version. If the IOBYTE function is - implemented, it must be set at this point. The - various system parameters that are set by the - WBOOT entry point must be initialized, and - control is transferred to the CCP at 3400+b for - further processing. Note that register C must - be set to zero to select drive A. - - - - 6-16 - - - - - -CP/M Operating System Manual 6.6 BIOS Entry Points - - - Table 6-5. (continued) - - Entry Point Function - - WBOOT The WBOOT entry point gets control when a warm - start occurs. A warm start is performed - whenever a user program branches to location - 0000H, or when the CPU is reset from the front - panel. The CP/M system must be loaded from the - first two tracks of drive A up to, but not - including, the BIOS, or CBIOS, if the user has - completed the patch. System parameters must be - initialized as follows: - - location 0,1,2 Set to JMP WBOOT for warm - starts (000H: JMP 4A03H+b) - - location 3 Set initial value of IOBYTE, - if implemented in the CBIOS - - location 4 High nibble = current user no; - low nibble = current drive - - location 5,6,7 Set to JMP BDOS, which is the - primary entry point to CP/M - for transient programs. - (0005H: JMP 3C06H+b) - - Refer to Section 6.9 for complete details of - page zero use. Upon completion of the - initialization, the WBOOT program must branch - to the CCP at 3400H+b to restart the system. - Upon entry to the CCP, register C is set to the - drive to select after system initialization. - The WBOOT routine should read location 4 in - memory, verify that is a legal drive, and pass - it to the CCP in register C. - - CONST You should sample the status of the currently - assigned console device and return 0FFH in - register A if a character is ready to read and - 00H in register A if no console characters are - ready. - - CONIN The next console character is read into - register A, and the parity bit is set, high- - order bit, to zero. If no console character is - ready, wait until a character is typed before - returning. - - - - - - - - - 6-17 - - - - - -CP/M Operating System Manual 6.6 BIOS Entry Points - - - Table 6-5. (continued) - - Entry Point Function - - CONOUT The character is sent from register C to the - console output device. The character is in - ASCII, with high-order parity bit set to zero. - You might want to include a time-out on a line- - feed or carriage return, if the console device - requires some time interval at the end of the - line (such as a TI Silent 700 terminal). You - can filter out control characters that cause - the console device to react in a strange way - (CTRL-Z causes the Lear-Seigler terminal to - clear the screen, for example). - - LIST The character is sent from register C to the - currently assigned listing device. The - character is in ASCII with zero parity bit. - - PUNCH The character is sent from register C to the - currently assigned punch device. The character - is in ASCII with zero parity. - - READER The next character is read from the currently - assigned reader device into register A with - zero parity (high-order bit must be zero); an - end-of-file condition is reported by returning - an ASCII CTRL-Z(1AH). - - HOME The disk head of the currently selected disk - (initially disk A) is moved to the track 00 - position. If the controller allows access to - the track 0 flag from the drive, the head is - stepped until the track 0 flag is detected. If - the controller does not support this feature, - the HOME call is translated into a call to - SETTRK with a parameter of 0. - - SELDSK The disk drive given by register C is selected - for further operations, where register C - contains 0 for drive A, 1 for drive B, and so - on up to 15 for drive P (the standard CP/M - distribution version supports four drives). On - each disk select, SELDSK must return in HL the - base address of a 16-byte area, called the Disk - Parameter Header, described in Section 6.10. - For standard floppy disk drives, the contents - of the header and associated tables do not - change; thus, the program segment included in - the sample CBIOS performs this operation - automatically. - - - - - - 6-18 - - - - - -CP/M Operating System Manual 6.6 BIOS Entry Points - - - Table 6-5. (continued) - - Entry Point Function - - If there is an attempt to select a nonexistent - drive, SELDSK returns HL=0000H as an error - indicator. Although SELDSK must return the - header address on each call, it is advisable to - postpone the physical disk select operation - until an I/O function (seek, read, or write) is - actually performed, because disk selects often - occur without utimately performing any disk - I/O, and many controllers unload the head of - the current disk before selecting the new - drive. This causes an excessive amount of - noise and disk wear. The least significant bit - of register E is zero if this is the first - occurrence of the drive select since the last - cold or warm start. - - SETTRK Register BC contains the track number for - subsequent disk accesses on the currently - selected drive. The sector number in BC is the - same as the number returned from the SECTRAN - entry point. You can choose to seek the - selected track at this time or delay the seek - until the next read or write actually occurs. - Register BC can take on values in the range 0- - 76 corresponding to valid track numbers for - standard floppy disk drives and 0-65535 for - nonstandard disk subsystems. - - SETSEC Register BC contains the sector number, 1 - through 26, for subsequent disk accesses on the - currently selected drive. The sector number in - BC is the same as the number returned from the - SECTRAN entry point. You can choose to send - this information to the controller at this - point or delay sector selection until a read or - write operation occurs. - - SETDMA Register BC contains the DMA (Disk Memory - Access) address for subsequent read or write - operations. For example, if B = 00H and C = - 80H when SETDMA is called, all subsequent read - operations read their data into 80H through - 0FFH and all subsequent write operations get - their data from 80H through 0FFH, until the - next call to SETDMA occurs. The initial DMA - address is assumed to be 80H. The controller - need not actually support Direct Memory Access. - If, for example, all data transfers are through - I/O ports, the CBIOS that is constructed uses - the 128-byte area starting at the selected DMA - address for the memory buffer during the - subsequent read or write operations. - - - 6-19 - - - - -CP/M Operating System Manual 6.6 BIOS Entry Points - - - Table 6-5. (continued) - - Entry Point Function - - READ Assuming the drive has been selected, the track - has been set, and the DMA address has been - specified, the READ subroutine attempts to read - one sector based upon these parameters and - returns the following error codes in register - A: - - 0 no errors occurred - - 1 nonrecoverable error condition occurred - - Currently, CP/M responds only to a zero or - nonzero value as the return code. That is, if - the value in register A is 0, CP/M assumes that - the disk operation was completed properly. IF - an error occurs the CBIOS should attempt at - least 10 retries to see if the error is - recoverable. When an error is reported the - BDOS prints the message BDOS ERR ONx: BAD - SECTOR. The operator then has the option of - pressing a carriage return to ignore the error, - or CTRL-C to abort. - - WRITE Data is written from the currently selected DMA - address to the currently selected drive, track, - and sector. For floppy disks, the data should - be marked as nondeleted data to maintain - compatibility with other CP/M systems. The - error codes given in the READ command are - returned in register A, with error recovery - attempts as described above. - - LISTST You return the ready status of the list device - used by the DESPOOL program to improve console - response during its operation. The value 00 is - returned in A if the list device is not ready - to accept a character and 0FFH if a character - can be sent to the printer. A 00 value should - be returned if LIST status is not implemented. - - - - - - - - - - - - - - - 6-20 - - - - - -CP/M Operating System Manual 6.6 BIOS Entry Points - - - Table 6-5. (continued) - - Entry Point Function - - SECTRAN Logical-to-physical sector translation is - performed to improve the overall response of - CP/M. Standard CP/M systems are shipped with a - skew factor of 6, where six physical sectors - are skipped between each logical read - operation. This skew factor allows enough time - between sectors for most programs to load their - buffers without missing the next sector. In - particular computer systems that use fast - processors, memory, and disk subsystems, the - skew factor might be changed to improve overall - response. However, the user should maintain a - single-density IBM-compatible version of CP/M - for information transfer into and out of the - computer system, using a skew factor of 6. - - In general, SECTRAN receives a logical sector - number relative to zero in BC and a translate - table address in DE. The sector number is used - as an index into the translate table, with the - resulting physical sector number in HL. For - standard systems, the table and indexing code - is provided in the CBIOS and need not be - changed. - K - - -6.7 A Sample BIOS - - The program shown in Appendix B can serve as a basis for your -first BIOS. The simplest functions are assumed in this BIOS, so -that you can enter it through a front panel, if absolutely -necessary. You must alter and insert code into the subroutines for -CONST, CONIN, CONOUT, READ, WRITE, and WAITIO subroutines. Storage -is reserved for user-supplied code in these regions. The scratch -area reserved in page zero (see Section 6.9) for the BIOS is used in -this program, so that it could be implemented in ROM, if desired. - - Once operational, this skeletal version can be enhanced to -print the initial sign-on message and perform better error recovery. -The subroutines for LIST, PUNCH, and READER can be filled out and -the IOBYTE function can be implemented. - - -6.8 A Sample Cold Start Loader - - The program shown in Appendix E can serve as a basis for a cold -start loader. The disk read function must be supplied by the user, -and the program must be loaded somehow starting at location 0000. -Space is reserved for the patch code so that the total amount of -storage required for the cold start loader is 128 bytes. - - - - 6-21 - - - - - -CP/M Operating System Manual 6.8 A Sample Cold Start Loader - - - Eventually, you might want to get this loader onto the first -disk sector (track 0, sector 1) and cause the controller to load it -into memory automatically upon system start up. Alternatively, the -cold start loader can be placed into ROM, and above the CP/M system. -In this case, it is necessary to originate the program at a higher -address and key in a jump instruction at system start up that -branches to the loader. Subsequent warm starts do not require this -key-in operation, because the entry point WBOOT gets control, thus -bringing the system in from disk automatically. The skeletal cold -start loader has minimal error recovery, which might be enhanced in -later versions. - - -6.9 Reserved Locations in Page Zero - - Main memory page zero, between locations 00H and 0FFH, contains -several segments of code and data that are used during CP/M -processing. The code and data areas are given in the following -table. - - - Table 6-6. Reserved Locations in Page Zero - - Locations Contents - - F - 000H-0002H Contains a jump instruction to the warm - start entry location 4A03H+b. This - allows a simple programmed restart (JMP - 0000H) or manual restart from the front - panel. - - 0003H-0003H Contains the Intel standard IOBYTE is - optionally included in the user's CBIOS - (refer to Section 6.6). - - 0004H-0004H Current default drive number - (0=A,...,15=P). - - 0005H-0007H Contains a jump instruction to the BDOS - and serves two purposes: JMP 0005H - provides the primary entry point to the - BDOS, as described in Chapter 5, and - LHLD 0006H brings the address field of - the instruction to the HL register - pair. This value is the lowest address - in memory used by CP/M, assuming the - CCP is being overlaid. The DDT program - changes the address field to reflect - the reduced memory size in debug mode. - - 0008H-0027H Interrupt locations 1 through 5 not - used. - - 0030H-0037H Interrupt location 6 (not currently - used) is reserved. - - - 6-22 - - - - - -CP/M Operating System Manual 6.9 Reserved Locations in Page Zero - - - Table 6-6. (continued) - - Locations Contents - - 0038H-003AH Restart 7; contains a jump instruction - into the DDT or SID program when - running in debug mode for programmed - breakpoints, but is not otherwise used - by CP/M. - - 003BH-003FH Not currently used; reserved. - - 0040H-004FH A 16-byte area reserved for scratch by - CBIOS, but is not used for any purpose - in the distribution version of CP/M. - - 0050H-005BH Not currently used; reserved. - - 005CH-007CH Default File Control Block produced for - a transient program by the CCP. - - 007DH-007FH Optional default random record position. - - 0080H-00FFH Default 128-byte disk buffer, also - filled with the command line when a - transient is loaded under the CCP. - K - - - This information is set up for normal operation under the CP/M -system, but can be overwritten by a transient program if the BDOS -facilities are not required by the transient. - - If, for example, a particular program performs only simple I/O -and must begin execution at location 0, it can first be loaded into -the TPA, using normal CP/M facilities, with a small memory move -program that gets control when loaded. The memory move program must -get control from location 0100H, which is the assumed beginning of -all transient programs. The move program can then proceed to the -entire memory image down to location 0 and pass control to the -starting address of the memory load. - - If the BIOS is overwritten or if location 0, containing the -warm start entry point, is overwritten, the operator must bring the -CP/M system back into memory with a cold start sequence. - - -6.10 Disk Parameter Tables - - Tables are included in the BIOS that describe the particular -characteristics of the disk subsystem used with CP/M. These tables -can be either hand-coded, as shown in the sample CBIOS in Appendix -B, or automatically generated using the DISKDEF macro library, as -shown in Appendix F. The purpose here is to describe the elements -of these tables. - - - - - 6-23 - - - - -CP/M Operating System Manual 6.10 Disk Parameter Tables - - - - In general, each disk drive has an associated (16-byte) disk -parameter header that contains information about the disk drive and -provides a scratch pad area for certain BDOS operations. The format -of the disk parameter header for each drive is shown in Figure 6-2, -where each element is a word (16-bit) value. - - - -XLT 0000 0000 0000 DIRBUF DPB CSV ALV -16b 16b 16b 16b 16b 16b 16b 16b - - - Figure 6-2. Disk Parameter Header Format - - - - The meaning of each Disk Parameter Header (DPH) element is -detailed in Table 6-7. - - - Table 6-7. Disk Parameter Headers - - Disk Parameter Meaning - Header - F - - XLT Address of the logical-to-physical - translation vector, if used for this - particular drive, or the value 0000H if no - sector translation takes place (that is, - the physical and logical sector numbers - are the same). Disk drives with identical - sector skew factors share the same - translate tables. - - 0000 Scratch pad values for use within the - BDOS, initial value is unimportant. - - DIRBUF Address of a 128-byte scratch pad area for - directory operations within BDOS. All - DPHs address the same scratch pad area. - - DPB Address of a disk parameter block for this - drive. Drives with identical disk - characteristics address the same disk - parameter block. - - CSV Address of a scratch pad area used for - software check for changed disks. This - address is different for each DPH. - - ALV Address of a scratch pad area used by the - BDOS to keep disk storage allocation - information. This address is different - for each DPH. - - - 6-24 - - - - K - - -CP/M Operating System Manual 6.10 Disk Parameter Tables - - - - Given n disk drives, the DPHs are arranged in a table whose -first row of 16 bytes corresponds to drive 0, with the last row -corresponding to drive n-1. In the following figure the lable -DPBASE defines the base address of the DPH table. - - - - DPBASE: - - 00 XLT 00 0000 0000 0000 DIRBUF DBP 00 CSV 00 ALV 00 - - 01 XLT 01 0000 0000 0000 DIRBUF DBP 01 CSV 01 ALV 01 - . - . - . - n-1 XLTn-1 0000 0000 0000 DIRBUF DBTn-1 CSVn-1 ALVn-1 - - - Figure 6-3. Disk Parameter Header Table - - - - A responsibility of the SELDSK subroutine is to return the base -address of the DPH for the selected drive. The following sequence -of operations returns the table address, with a 0000H returned if -the selected drive does not exist. - - - NDISKS EQU 4 ;NUMBER OF DISK DRIVES - ..... - SELDSK: ;SELECT DISK GIVEN BY BC - LSI H,0000H ;ERROR CODE - MOV A,C ;DRIVE OK? - CPI NDISKS ;CY IF SO - RNC ;RET IF ERROR - ;NO ERROR, CONTINUE - MOV L,C ;LOW(DISK) - MOV H,B ;HIGH(DISK) - DAD H ;*2 - DAD H ;*4 - DAD H ;*8 - DAD H ;*16 - LXI D,DPBASE;FIRST DPH - DAD D ;DPH(DISK) - RET - - - The translation vectors, XLT 00 through XLTn-1, are located -elsewhere in the BIOS, and simply correspond one-for-one with the -logical sector numbers zero through the sector count 1. The Disk -Parameter Block (DPB) for each drive is more complex. As shown in -Figure 6-4, particular DPB, that is addressed by one or more DPHs, -takes the general form: - - - - 6-25 - - - - - -CP/M Operating System Manual 6.10 Disk Parameter Tables - - - SPT BSH BLM EXM DSM DRM AL0 AL1 CKS 0FF - 16b 8b 8b 8b 16b 16b 8b 8b 16b 16b - - - Figure 6-4. Disk Parameter Block Format - - - -where each is a byte or word value, as shown by the 8b or 16b -indicator below the field. - - The following field abbreviations are used in Figure 6-4: - - - o SPT is the total number of sectors per track. - - o BSH is the data allocation block shift factor, determined by - the data block allocation size. - - o BLM is the data allocation block mask (2[BSH-1]). - - o EXM is the extent mask, determined by the data block allocation - size and the number of disk blocks. - - o DSM determines the total storage capacity of the disk drive. - - o DRM determines the total number of directory entries that can - be stored on this drive. AL0, AL1 determine reserved directory - blocks. - - o CKS is the size of the directory check vector. - - o 0FF is the number of reserved tracks at the beginning of the - (logical) disk. - -The values of BSH and BLM determine the data allocation size BLS, -which is not an entry in the DPB. Given that the designer has -selected a value for BLS, the values of BSH and BLM are shown Table -6-8. - - - Table 6-8. BSH and BLM Values - - BLS BSH BLM - - 1024 3 7 - 2048 4 15 - 4096 5 31 - 8192 6 63 - 16,384 7 127 - - -where all values are in decimal. The value of EXM depends upon both -the BLS and whether the DSM value is less than 256 or greater than -255, as shown in Table 6-9. - - - 6-26 - - - - - -CP/M Operating System Manual 6.10 Disk Parameter Tables - - - Table 6-9. EXM Values - - BLS EXM values - - DSM<256 DSM>255 - - 1024 0 N/A - 2048 1 0 - 4096 3 1 - 8192 7 3 - 16,384 15 7 - - - The value of DSM is the maximum data block number supported by -this particular drive, measured in BLS units. The product (DSM+1) -is the total number of bytes held by the drive and must be within -the capacity of the physical disk, not counting the reserved -operating system tracks. - - The DRM entry is the one less than the total number of -directory entries that can take on a 16-bit value. The values of -AL0 and AL1, however, are determined by DRM. The values AL0 and AL1 -can together be considered a string of 16-bits, as shown in Figure -6-5. - - - - AL0 AL1 - - 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 - - - Figure 6-5. AL0 and AL1 - - - - Position 00 corresponds to the high-order bit of the byte -labeled AL0 and 15 corresponds to the low-order bit of the byte -labeled AL1. Each bit position reserves a data block for number of -directory entries, thus allowing a total of 16 data blocks to be -assigned for directory entries (bits are assigned starting at 00 and -filled to the right until position 15). Each directory entry -occupies 32 bytes, resulting in the following tabulation: - - - Table 6-10. BLS Tabulation - - BLS Directory Entries - - 1024 32 times # bits - 2048 64 times # bits - 4096 128 times # bits - 8192 256 times # bits - 16,384 512 times # bits - - - - 6-27 - - - - - -CP/M Operating System Manual 6.10 Disk Parameter Tables - - - - Thus, if DRM = 127 (128 directory entries) and BLS = 1024, -there are 32 directory entries per block, requiring 4 reserved -blocks. In this case, the 4 high-order bits of AL0 are set, -resulting in the values AL0 = 0F0H and AL1 = 00H. - - The CKS value is determined as follows: if the disk drive -media is removable, then CKS = (DRM+1)/4, where DRM is the last -directory entry number. If the media are fixed, then set CKS = 0 -(no directory records are checked in this case). - - Finally, the 0FF field determines the number of tracks that are -skipped at the beginning of the physical disk. This value is -automatically added whenever SETTRK is called and can be used as a -mechanism for skipping reserved operating system tracks or for -partitioning a large disk into smaller segmented sections. - - To complete the discussion of the DPB, several DPHs can address -the same DPB if their drive characteristics are identical. Further, -the DPB can be dynamically changed when a new drive is addressed by -simply changing the pointer in the DPH; because the BDOS copies the -DPB values to a local area whenever the SELDSK function is invoked. - - Returning back to DPH for a particular drive, the two address -values CSV and ALV remain. Both addresses reference an area of -uninitialized memory following the BIOS. The areas must be unique -for each drive, and the size of each area is determined by the -values in the DPB. - - The size of the area addressed by CSV is CKS bytes, which is -sufficient to hold the directory check information for this -particular drive, If CKS = (DRM+1)/4, you must reserve (DRM+1)/4 -bytes for directory check use. If CKS = 0, no storage is reserved. - - The size of the area addressed by ALV is determined by the -maximum number of data blocks allowed for this particular disk and -is computed as (DSM/8)+1. - - The CBIOS shown in Appendix B demonstrates an instance of these -tables for standard 8-inch, single-density drives. It might be -useful to examine this program and compare the tabular values with -the definitions given above. - - -6.11 The DISKDEF Macro Library - - A macro library called DISKDEF (shown in Appendix F), greatly -simplifies the table construction process. You must have access to -the MAC macro assembler, of course, to use the DISKDEF facility, -while the macro library is included with all CP.M 2 distribution -disks. - - - - - - - 6-28 - - - - - -CP/M Operating System Manual 6.11 The DISKDEF Macro Library - - - - A BIOS disk definition consists of the following sequence of -macro statements: - - MACLIB DISKDEF - ..... - DISKS n - DISKDEF 0,... - DISKDEF 1,... - ..... - DISKDEF n-1 - ..... - ENDEF - -where the MACLIB statement loads the DISKDEF.LIB file, on the same -disk as the BIOS, into MAC's internal tables. The DISKS macro call -follows, which specifies the number of drives to be configured with -the user's system, where n is an integer in the range 1 to 16. A -series of DISKDEF macro calls then follow that define the -characteristics of each logical disk, 0 through n-1, corresponding -to logical drives A through P. The DISKS and DISKDEF macros -generate the in-line fixed data tables described in the previous -section and thus must be placed in a nonexecutable portion of the -BIOS, typically directly following the BIOS jump vector. - - The remaining portion of the BIOS is defined following the -DISKDEF macros, with the ENDEF macro call immediately preceding the -END statement. The ENDEF (End of Diskdef) macro generates the -necessary uninitialized RAM areas that are located in memory above -the BIOS. - - The DISKDEF macro call takes the form: - - DISKDEF dn,fsc,lsc,[skf],bls dks,dir,cks,ofs,[0] - -where - - o dn is the logical disk number, 0 to n-1. - o fsc is the first physical sector number (0 or 1). - o lsc is the last sector number. - o skf is the optional sector skew factor. - o bls is the data allocation block size. - o dks is the number of blocks on the disk. - o dir is the number of directory entries. - o cks is the number of checked directory entries. - o ofs is the track offset to logical track 00. - o [0] is an optional 1.4 compatibility flag. - - - The value dn is the drive number being defined with this -DISKDEF macro invocation. The fsc parameter accounts for differing -sector numbering systems and is usually 0 to 1. The lsc is the last -numbered sector on a track. When present, the skf parameter defines -the sector skew factor, which is used to create a sector translation -table according to the skew. - - - 6-29 - - - - - -CP/M Operating System Manual 6.11 The DISKDEF Macro Library - - - - If the number of sectors is less than 256, a single-byte table -is created, otherwise each translation table element occupies two -bytes. No translation table is created if the skf parameter is -omitted, or equal to 0. - - The bls parameter specifies the number of bytes allocated to -each data block, and takes on the values 1024, 2048, 4096, 8192, or -16384. Generally, performance increases with larger data block -sizes because there are fewer directory references, and logically -connected data records are physically close on the disk. Further, -each directory entry addresses more data and the BIOS-resident RAM -space is reduced. - - The dks parameter specifies the total disk size in bls units. -That is, if the bls = 2048 and dks = 1000, the total disk capacity -is 2,048,000 bytes. If dks is greater than 255, the block size -parameter bls must be greater than 1024. The value of dir is the -total number of directory entries that might exceed 255, if desired. - - The cks parameter determines the number of directory items to -check on each directory scan and is used internally to detect -changed disks during system operation, where an intervening cold or -warm start has not occurred. When this situation is detected, CP/M -automatically marks the disk Read-Only so that data is not -subsequently destroyed. - - As stated in the previous section, the value of cks = dir when -the medium is easily changed, as is the case with a floppy disk -subsystem. If the disk is permanently mounted, the value of cks is -typically 0, because the probability of changing disks without a -restart is low. - - The ofs value determines the number of tracks to skip when this -particular drive is addressed, which can be used to reserve -additional operating system space or to simulate several logical -drives on a single large capacity physical drive. Finally, the [0] -parameter is included when file compatibility is required with -versions of 1.4 that have been modified for higher density disks. -This parameter ensures that only 16K is allocated for each directory -record, as was the case for previous versions. Normally, this -parameter is not included. - - For convenience and economy of table space, the special form: - - DISKDEF i,j - -gives disk i the same characteristics as a previously defined drive -j. A standard four-drive, single-density system, which is -compatible with version 1.4, is defined using the following macro -invocations: - - DISKS 4 - DISKDEF 0,1,26,6,1024,243,64,2 - DISKDEF 1,0 - - - 6-30 - - - - - -CP/M Operating System Manual 6.11 The DISKDEF Macro Library - - - DISKDEF 2,0 - DISKDEF 3,0 - .... - ENDEF - -with all disks having the same parameter values of 26 sectors per -track, numbered 1 through 26, with 6 sectors skipped between each -access, 1024 bytes per data block, 243 data blocks for a total of -243K-byte disk capacity, 64 checked directory entries, and two -operating system tracks. - - The DISKS macro generates n DPHs, starting at the DPH table -address DPBASE generated by the macro. Each disk header block -contains sixteen bytes, as described above, and correspond one-for- -one to each of the defined drives. In the four-drive standard -system, for example, the DISKS macro generates a table of the form: - - DPBASE EQU$ - DPE0: DW XLT0,0000H,0000H,0000H,DIRBUF,DPB0,CSV0,ALV0 - DPE1: DW XLT0,0000H,0000H,0000H,DIRBUF,DPB0,CSV1,ALV1 - DPE2: DW XLT0,0000H,0000H,0000H,DIRBUF,DPB0,CSV2,ALV2 - DPE3: DW XLT0,0000H,0000H,0000H,DIRBUF,DPB0,CSV3,ALV3 - -where the DPH labels are included for reference purposes to show the -beginning table addresses for each drive 0 through 3. The values -contained within the DPH are described in detail in the previous -section. The check and allocation vector addresses are generated by -the ENDEF macro in the ram area following the BIOS code and tables. - - Note that if the skf (skew factor) parameter is omitted, or -equal to 0, the translation table is omitted and a 0000H value is -inserted in the XLT position of the DPH for the disk. In a -subsequent call to perform the logical-to-physical translation, -SECTRAN receives a translation table address of DE = 0000H and -simply returns the original logical sector from BC in the HL -register pair. - - A translate table is constructed when the skf parameter is -present, and the (nonzero) table address is placed into the -corresponding DPHs. The following for example, is constructed when -the standard skew factor skf = 6 is specified in the DISKDEF macro -call: - - XLT0: DB 1,7,13,19,25,5,11,17,23,3,9,15,21 - DB 2,8,14,20,26,6,12,18,24,4,10,16,22 - - Following the ENDEF macro call, a number of uninitialized data -areas are defined. These data areas need not be a part of the BIOS -that is loaded upon cold start, but must be available between the -BIOS and the end of memory. The size of the uninitialized RAM area -is determined by EQU statements generated by the ENDEF macro. For a -standard four-drive system, the ENDEF macro might produce the -following EQU statement: - - - - - 6-31 - - - - - -CP/M Operating System Manual 6.11 The DISKDEF Macro Library - - - 4C72 = BEGDAT EQU $ - (data areas) - - 4DB0 = ENDDAT EQU $ - - 013C = DATSIZ EQU $-BEGDAT - -which indicates that uninitialized RAM begins at location 4C72H, -ends at 4DB0H-1, and occupies 013CH bytes. You must ensure that -these addresses are free for use after the system is loaded. - - After modification, you can use the STAT program to check drive -characteristics, because STAT uses the disk parameter block to -decode the drive information. A STAT command of the form: - - STAT d:DSK: - -decodes the disk parameter block for drive d (d=A,...,P) and -displays the following values: - - - r: 128-byte record capacity - k: kilobyte drive capacity - d: 32-byte directory entries - c: checked directory entries - e: records/extent - b: records/block - s: sectors/track - t: reserved tracks - - - Three examples of DISKDEF macro invocations are shown below -with corresponding STAT parameter values. The last example produces -a full 8-megabyte system. - - DISKDEF 0,1,58,,2048,256,128,128,2 - r=4096, k=512, d=128, c=128, e=256, b=16, s=58, t=2 - - DISKDEF 0,1,58,,2048,1024,300,0,2 - r=16348, k=2048, d=300, c=0, e=128, b=16, s=58, t=2 - - DISKDEF 0,1,58,,16348,512,128,128,2 - r=65536, k=8192, d=128, c=128, e=1024, b=128, s=58, t=2 - - -6.12 Sector Blocking and Deblocking - - Upon each call to BIOS WRITE entry point, the CP/M BDOS -includes information that allows effective sector blocking and -deblocking where the host disk subsystem has a sector size that is a -multiple of the basic 128-byte unit. The purpose here is to present -a general-purpose algorithm that can be included within the BIOS and -that uses the BDOS information to perform the operations -automatically. - - - - 6-32 - - - - - -CP/M Operating System Manual 6.12 Blocking and Deblocking - - - On each call to WRITE, the BDOS provides the following -information in register C: - - 0 = (normal sector write) - 1 = (write to directory sector) - 2 = (write to the first sector - of a new data block) - - Condition 0 occurs whenever the next write operation is into a -previously written area, such as a random mode record update; when -the write is to other than the first sector of an unallocated block; -or when the write is not into the directory area. Condition 1 -occurs when a write into the directory area is performed. Condition -2 occurs when the first record (only) of a newly allocated data -block is written. In most cases, application programs read or write -multiple 128-byte sectors in sequence; thus, there is little -overhead involved in either operation when blocking and deblocking -records, because preread operations can be avoided when writing -records. - - Appendix G lists the blocking and deblocking algorithms in -skeletal form; this file is included on your CP/M disk. Generally, -the algorithms map all CP/M sector read operations onto the host -disk through an intermediate buffer that is the size of the host -disk sector. Throughout the program, values and variables that -relate to the CP/M sector involved in a seek operation are prefixed -by sek, while those related to the host disk system are prefixed by -hst. The equate statements beginning on line 29 of Appendix G -define the mapping between CP/M and the host system, and must be -changed if other than the sample host system is involved. - - The entry points BOOT and WBOOT must contain the initialization -code starting on line 57, while the SELDSK entry point must be -augmented by the code starting on line 65. Note that although the -SELDSK entry point computes and returns the Disk Parameter Header -address, it does not physically select the host disk at this point -(it is selected later at READHST or WRITEHST). Further, SETTRK, -SETTRK, and SETMA simply store the values, but do not take any other -action at this point. SECTRAN performs a trivial function of -returning the physical sector number. - - The principal entry points are READ and WRITE, starting on -lines 110 and 125, respectively. These subroutines take the place -of your previous READ and WRITE operations. - - The actual physical read or write takes place at either -WRITEHST or READHST, where all values have been prepared: hstdsk is -the host disk number, hsttrk is the host track number, and hstsec is -the host sector number, which may require translation to physical -sector number. You must insert code at this point that performs the -full sector read or write into or out of the buffer at hstbuf of -length hstsiz. All other mapping functions are performed by the -algorithms. - - - - - 6-33 - - - - - -CP/M Operating System Manual 6.12 Blocking and Deblocking - - - This particular algorithm was tested using an 80-megabyte hard -disk unit that was originally configured for 128-byte sectors, -producing approximately 35 megabytes of formatted storage. When -configured for 512-byte host sectors, usable storage increased to 57 -megabytes, with a corresponding 400% improvement in overall -response. In this situation, there is no apparent overhead involved -in deblocking sectors, with the advantage that user programs still -maintain 128-byte sectors. This is primarily because of the -information provided by the BDOS, which eliminates the necessity for -preread operations. - - -End of Section 6 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 6-34 - - diff --git a/Source/Doc/CPM 22 Manual - Testing/part2.prn b/Source/Doc/CPM 22 Manual - Testing/part2.prn deleted file mode 100644 index 4d83d7d6..00000000 --- a/Source/Doc/CPM 22 Manual - Testing/part2.prn +++ /dev/null @@ -1,3010 +0,0 @@ -XS 9 N0 - - - - - - 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 - - A-1 - - - - - - - - - - 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 - - A-2 - - - - - - - - - - 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 - - A-3 - - - - - - - - - -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 - - A-4 - - - - - - - - - -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 ; - - A-5 - - - - - - - - - -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 ; - - A-6 - - - - - - - - - -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 - - A-7 - - - - - - - - - -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 - - A-8 - - - - - - - - - -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 - - A-9 - - - - - - - - - -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: - - A-10 - - - - - - - - - -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 - - A-11 - - - - - - - - - -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 - - A-12 - - - - - - - - - -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 - - A-13 - - - - - - - - - -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 ; - - A-14 - - - - - - - - - -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 - - A-15 - - - - - - - - - -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# - - A-16 - - - - - - - - - -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 - - A-17 - - - - - - - - - -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# - - - - - - - - - - - - - A-18 - - - - - - - - - - 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 - - B-1 - - - - - - - - - - 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 - - B-2 - - - - - - - - - - 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 - - B-3 - - - - - - - - - -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 - - B-4 - - - - - - - - - -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 - - B-5 - - - - - - - - - -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 ; - - B-6 - - - - - - - - - -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 - - B-7 - - - - - - - - - -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 - - B-8 - - - - - - - - - -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# - - B-9 - - - - - - - - - -wboot 4aa6 20 90# 115 -wboote 4a03 20# 150 -write 4bd6 33 268# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - B-10 - - - - - - - - - - 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: - - C-1 - - - - - - - - - -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 ;= + 128 -0211 0c inr 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 - - C-2 - - - - - - - - - - - ;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 , - ;sector in - ;dmaaddr in - -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: - - C-3 - - - - - - - - - - - ;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 - - - - - - - - - - - - - - - - - - - - - - - - - - C-4 - - - - - - - - - - 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 - - D-1 - - - - - - - - - - 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 - - D-2 - - - - - - - - - - 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 - - D-3 - - - - - - - - - -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 - - D-4 - - - - - - - - - -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 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - D-5 - - - - - - - - - - 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 - - E-1 - - - - - - - - - -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 - ;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 - ; - - E-2 - - - - - - - - - - ;we aren't using a stack, so use as scratch - ;register - ; to hold the load address increment - -006f 318000 lxi sp,128 ;128 bytes per - ;sector -0072 39 dad sp ; = + - 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 - - - - - - - - - - - - - - - - - - - - - E-3 - - - - - - - - - - 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) - - F-1 - - - - - - - - - - 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 - - F-2 - - - - - - - - - - 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 - - F-3 - - - - - - - - - -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 - - F-4 - - - - - - - - - -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, -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 - - F-5 - - - - - - - - - -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:; - - F-6 - - - - - - - - - -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 - - - - - - - - - - - - - - - - - - - - - - - - - - - - F-7 - - - - - - - - - - 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 - - G-1 - - - - - - - - - - 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 ; - - G-2 - - - - - - - - - - 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 - - G-3 - - - - - - - - - -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 - - G-4 - - - - - - - - - -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 - - G-5 - - - - - - - - - -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? - - G-6 - - - - - - - - - -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: - - G-7 - - - - - - - - - -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 - - G-8 - - - - - - - - - -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 ; - - G-9 - - - - - - - - - -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 - - G-10 - - - - - - - - - -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# - - G-11 - - - - - - - - - -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 - - - - - - - - - - - - G-12 - - - - \ No newline at end of file diff --git a/Source/Doc/CPM 22 Manual - Testing/part2.tex b/Source/Doc/CPM 22 Manual - Testing/part2.tex deleted file mode 100644 index 75330cc4..00000000 --- a/Source/Doc/CPM 22 Manual - Testing/part2.tex +++ /dev/null @@ -1,2 +0,0 @@ -.nx appa.tex - \ No newline at end of file diff --git a/Source/Doc/CPM 22 Manual - Testing/part2.txt b/Source/Doc/CPM 22 Manual - Testing/part2.txt deleted file mode 100644 index 0d8c02cf..00000000 --- a/Source/Doc/CPM 22 Manual - Testing/part2.txt +++ /dev/null @@ -1,3009 +0,0 @@ - N - - - - - - - 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 - - A-1 - - - - - - - - - - 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 - - A-2 - - - - - - - - - - 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 - - A-3 - - - - - - - - - -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 - - A-4 - - - - - - - - - -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 ; - - A-5 - - - - - - - - - -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 ; - - A-6 - - - - - - - - - -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 - - A-7 - - - - - - - - - -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 - - A-8 - - - - - - - - - -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 - - A-9 - - - - - - - - - -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: - - A-10 - - - - - - - - - -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 - - A-11 - - - - - - - - - -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 - - A-12 - - - - - - - - - -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 - - A-13 - - - - - - - - - -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 ; - - A-14 - - - - - - - - - -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 - - A-15 - - - - - - - - - -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# - - A-16 - - - - - - - - - -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 - - A-17 - - - - - - - - - -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# - - - - - - - - - - - - - A-18 - - - - - - - - - - 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 - - B-1 - - - - - - - - - - 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 - - B-2 - - - - - - - - - - 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 - - B-3 - - - - - - - - - -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 - - B-4 - - - - - - - - - -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 - - B-5 - - - - - - - - - -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 ; - - B-6 - - - - - - - - - -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 - - B-7 - - - - - - - - - -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 - - B-8 - - - - - - - - - -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# - - B-9 - - - - - - - - - -wboot 4aa6 20 90# 115 -wboote 4a03 20# 150 -write 4bd6 33 268# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - B-10 - - - - - - - - - - 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: - - C-1 - - - - - - - - - -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 ;= + 128 -0211 0c inr 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 - - C-2 - - - - - - - - - - - ;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 , - ;sector in - ;dmaaddr in - -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: - - C-3 - - - - - - - - - - - ;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 - - - - - - - - - - - - - - - - - - - - - - - - - - C-4 - - - - - - - - - - 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 - - D-1 - - - - - - - - - - 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 - - D-2 - - - - - - - - - - 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 - - D-3 - - - - - - - - - -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 - - D-4 - - - - - - - - - -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 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - D-5 - - - - - - - - - - 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 - - E-1 - - - - - - - - - -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 - ;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 - ; - - E-2 - - - - - - - - - - ;we aren't using a stack, so use as scratch - ;register - ; to hold the load address increment - -006f 318000 lxi sp,128 ;128 bytes per - ;sector -0072 39 dad sp ; = + - 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 - - - - - - - - - - - - - - - - - - - - - E-3 - - - - - - - - - - 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) - - F-1 - - - - - - - - - - 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 - - F-2 - - - - - - - - - - 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 - - F-3 - - - - - - - - - -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 - - F-4 - - - - - - - - - -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, -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 - - F-5 - - - - - - - - - -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:; - - F-6 - - - - - - - - - -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 - - - - - - - - - - - - - - - - - - - - - - - - - - - - F-7 - - - - - - - - - - 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 - - G-1 - - - - - - - - - - 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 ; - - G-2 - - - - - - - - - - 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 - - G-3 - - - - - - - - - -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 - - G-4 - - - - - - - - - -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 - - G-5 - - - - - - - - - -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? - - G-6 - - - - - - - - - -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: - - G-7 - - - - - - - - - -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 - - G-8 - - - - - - - - - -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 ; - - G-9 - - - - - - - - - -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 - - G-10 - - - - - - - - - -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# - - G-11 - - - - - - - - - -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 - - - - - - - - - - - - G-12 - - diff --git a/Source/Doc/CPM 22 Manual - Testing/part3.ix b/Source/Doc/CPM 22 Manual - Testing/part3.ix deleted file mode 100644 index 2039f723..00000000 Binary files a/Source/Doc/CPM 22 Manual - Testing/part3.ix and /dev/null differ diff --git a/Source/Doc/CPM 22 Manual - Testing/part3.prn b/Source/Doc/CPM 22 Manual - Testing/part3.prn deleted file mode 100644 index c4880949..00000000 Binary files a/Source/Doc/CPM 22 Manual - Testing/part3.prn and /dev/null differ diff --git a/Source/Doc/CPM 22 Manual - Testing/part3.tex b/Source/Doc/CPM 22 Manual - Testing/part3.tex deleted file mode 100644 index e8e80d7e..00000000 --- a/Source/Doc/CPM 22 Manual - Testing/part3.tex +++ /dev/null @@ -1,2 +0,0 @@ -.nx apph.tex - \ No newline at end of file diff --git a/Source/Doc/CPM 22 Manual - Testing/part3.txt b/Source/Doc/CPM 22 Manual - Testing/part3.txt deleted file mode 100644 index 4b87d790..00000000 --- a/Source/Doc/CPM 22 Manual - Testing/part3.txt +++ /dev/null @@ -1,2511 +0,0 @@ - N - K - - - - - -Appendix H - -Glossary - - - -address: 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. - -allocation vector (ALV): 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. - -AL0, AL1: 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 -allocation vector. - -ALV: See allocation vector. - -ambiguous filename: 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. - -American Standard Code for Information Interchange: See ASCII. - -applications program: Program designed to solve a specific problem. -Typical applications programs are business accounting packages, word -processing (editing) programs and mailing list programs. - -archive attribute: 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. - -argument: 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. - -ASCII: 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 - - - H-1 - - - - - -CP/M Operating System Manual H Glossary - - -be numbers, letters, and symbols. An ASCII file can be intelligibly -displayed on the video screen or printed on paper. - -assembler: 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 ASM in -Section 3 of this manual. - -back-up: Copy of a disk or file made for safekeeping, or the -creation of the duplicate disk or file. - -Basic Disk Operating System: See BDOS. - -BDOS: 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. - -bias: 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. - -binary: 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. - -Basic Input/Output System: See BIOS. - -BIOS: 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. - -BIOS base: Lowest address of the BIOS module in memory, that by -definition must be the first entry point in the BIOS jump table. - - - - - - - H-2 - - - - - -CP/M Operating System Manual H Glossary - - -bit: 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. - -BLM: See block mask. - -block: 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. - -block mask (BLM): 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. - -block shift (BSH): 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. - -blocking & deblocking algorithm: 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. - -BLS: Block size in bytes. See block. - -boot: 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, - - - H-3 - - - - - -CP/M Operating System Manual H Glossary - - -the boot program should be placed at 900H in the SYSGEN image. -Alternatively, the boot program may be located in ROM. - -bootstrap: See boot. - -BSH: See block shift. - -BTREE: 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. - -buffer: Area of memory that temporarily stores data during the -transfer of information. - -built-in commands: Commands that permanently reside in memory. -They respond quickly because they are not accessed from a disk. - -byte: 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. - -CCP: 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. - -CCP base: 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. - -checksum vector (CSV): Contiguous data area in the BIOS, with one -byte for each directory sector to be checked, that is, CKS bytes. -See CKS. 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. - -CKS: 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. - - H-4 - - - - - -CP/M Operating System Manual H Glossary - - - -cold boot: See boot. Cold boot also refers to a jump to the boot -entry point in the BIOS jump table. - -COM: Filetype for a CP/M command file. See command file. - -command: 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. - -command file: 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. - -command keyword: 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. - -command syntax: 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. - -command tail: 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. - -CON: 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. See console. - -concatenate: Name of the PIP operation that copies two or more -separate files into one new file in the the specified sequence. - -concurrency: Execution of two processes or operations -simultaneously. - -CONIN: BIOS entry point to a routine that reads a character from -the console device. - -CONOUT: BIOS entry point to a routine that sends a character to the -console device. - - - - - - - H-5 - - - - - -CP/M Operating System Manual H Glossary - - -console: 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. - -Console Command Processor: See CCP. - -CONST: BIOS entry point to a routine that returns the status of the -console device. - -control character: 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. - -Control Program for Microcomputers: See CP/M. - -CP/M: 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. - -CP/M 1.4l compatibility: 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. - -CP/M prompt: 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. - -CP/NET: 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. - -CSV: See checksum vector. - -cursor: 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. - - H-6 - - - - - -CP/M Operating System Manual H Glossary - - - -data file: File containing information that will be processed by a -program. - -deblocking: See blocking & deblocking algorithm. - -default: 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. - -default buffer: 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. - -default FCB: 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. - -delimiter: 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. - -DIR: Parameter in the diskdef macro library that specifies the -number of directory elements on the drive. - -DIR attribute: 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. - -DIRBUF: 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. - -directory: 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. - - - H-7 - - - - - -CP/M Operating System Manual H Glossary - - -directory element: 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. - -directory entry: File entry displayed by the DIR command. -Sometimes this term refers to a physical directory element. - -disk, diskette: 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. - -diskdef macro library: Library of code that when used with MAC, the -Digital Research macro assembler, creates disk definition tables -such as the DPB and DPH automatically. - -disk drive: 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. - -disk parameter block (DPB): Data structure referenced by one or -more disk parameter headers. The disk parameter block defines disk -characteristics in the fields listed below: - - 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. - -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. - -disk parameter header (DPH): 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: - - - H-8 - - - - - -CP/M Operating System Manual H Glossary - - - - 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. - -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. - -DKS: Parameter in the diskdef macro library specifying the number -of data blocks on the drive. - -DMA: 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. - -DN: Parameter in the diskdef macro library specifying the logical -drive number. - -DPB: See disk parameter block. - -DPH: See disk parameter header. - -DRM: 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. - -DSM: 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. - -editor: 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. - -EX: Extent number field in an FCB. See extent. - -executable: 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. - -execute a program: Start the processing of executable code. - - - H-9 - - - - - -CP/M Operating System Manual H Glossary - - - -EXM: See extent mask. - -extent: 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 CP/M 1.4 compatibility. - -extent mask (EXM): 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. - -FCB: See File Control Block. - -file: 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 block, directory, extent, record, and sector. - -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. - -filename: 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. - -file specification: 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. - - H-10 - - - - - -CP/M Operating System Manual H Glossary - - - -filetype: 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. - -floppy disk: Flexible magnetic disk used to store information. -Floppy disks come in 5 1/4- and 8-inch diameters. - -FSC: Parameter in the diskdef macro library specifying the first -physical sector number. This parameter is used to determine SPT and -build XLT. - -hard disk: Rigid, platter-like, magnetic disk sealed in a -container. A hard disk stores more information than a floppy disk. - -hardware: Physical components of a computer. - -hexadecimal notation: 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. - -hex file: ASCII-printable representation of a command, machine -language, file. - -hex file format: 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. - -HOME: BIOS entry point which sets the disk head of the currently -selected drive to the track zero position. - -host: 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. - -input: Data going into the computer, usually from an operator -typing at the terminal or by a program reading from the disk. - -input/output: See I/O. - -interface: Object that allows two independent systems to -communicate with each other, as an interface between hardware and -software in a microcomputer. - -I/O: Abbreviation for input/output. Usually refers to input/output -operations or routines handling the input and output of data in the -computer system. - - - H-11 - - - - - -CP/M Operating System Manual H Glossary - - - -IOBYTE: 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: - - STAT = - -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. - -K: Abbreviation for kilobyte. See kilobyte. - -keyword: See command keyword. - -kilobyte (K): 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. - -linker: 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 . - -LIST: A BIOS entry point to a routine that sends a character to the -list device, usually a printer. - -list device: Device such as a printer onto which data can be listed -or printed. - -LISTST: BIOS entry point to a routine that returns the ready status -of the list device. - -loader: 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. - -logged in: 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. - -logical: Representation of something that might or might not be the - - - H-12 - - - - - -CP/M Operating System Manual H Glossary - - -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. - -logical sector: See sector. - -logical-to-physical sector translation table: See XLT. - -LSC: Diskdef macro library parameter specifying the last physical -sector number. - -LST: 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. - -macro assembler: 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. - -megabyte: Over one million bytes; 1024 kilobytes. See byte, and -kilobyte. - -microprocessor: 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. - -MOVCPM image: 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. - -MP/M: Multi-Programming Monitor control program. A microcomputer -operating system supporting multi-terminal access with multi- -programming at each terminal. - -multi-programming: 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 concurrency. - - - H-13 - - - - -CP/M Operating System Manual H Glossary - - -nibble: One half of a byte, usually the high-order or low-order 4 -bits in a byte. - -OFF: 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. - -OFS: Diskdef macro library parameter specifying the number of -reserved system tracks. See OFF. - -operating system: 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. - -option: One of many parameters that can be part of a command tail. -Use options to specify additional conditions for a command's -execution. - -output: Data that is sent to the console, disk, or printer. - -page: 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. - -page relocatable program: See PRL. - -page zero: 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. - -parameter: Value in the command tail that provides additional -information for the command. Technically, a parameter is a required -element of a command. - -peripheral devices: 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. - -physical: Characteristic of computer components, generally -hardware, that actually exist. In programs, physical components can -be represented by logical components. - -primary filename: 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 - - - H-14 - - - - - -CP/M Operating System Manual H Glossary - - -primary filename follows the optional drive specification and -precedes the optional filetype. - -PRL: 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. - -program: 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. - -prompt: 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 CP/M prompt. - -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. - -PUNCH: BIOS entry point to a routine that sends a character to the -punch device. - -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:. - -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. - -READER: Entry point to a routine in the BIOS that reads the next -character from the currently assigned reader device. - -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 ROM. - -Read-Write (R/W): 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. - - - H-15 - - - - - -CP/M Operating System Manual H Glossary - - -record: 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. - -recursive procedure: Code that can call itself during execution. - -reentrant procedure: 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. - -restart (RST): 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. - -R/O: See Read-Only. - -ROM: Read-Only memory. This memory can be read but not written and -so is suitable for code and preinitialized data areas only. - -RST: See restart. - -R/W: See Read-Write. - -sector: 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. - -sectors per track (SPT): 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. - -SECTRAN: Entry point to a routine in the BIOS that performs -logical-to-physical sector translation for the BDOS. - - - - H-16 - - - - - -CP/M Operating System Manual H Glossary - - -SELDSK: Entry point to a routine in the BIOS that sets the -currently selected drive. - -SETDMA: 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. - -SETSEC: Entry point to a routine in the BIOS that sets the -currently selected sector. - -SETTRK: Entry point to a routine in the BIOS that sets the -currently selected track. - -skew factor: 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: - - Logical: 0 1 2 3 4 5 6 ... 25 - Physical: 1 7 13 19 25 5 11 ... 22 - -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 sector, SKF, and XLT. - -SKF: 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. - -software: Programs that contain machine-readable instructions, as -opposed to hardware, which is the actual physical components of a -computer. - -source file: 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: Stack pointer. See stack. - - - - - - - - H-17 - - - - - -CP/M Operating System Manual H Glossary - - -spooling: 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. - -SPT: See sectors per track. - -stack: 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. - -syntax: Format for entering a given command. - -SYS: See system attribute. - -SYSGEN image: 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 MOVCPM image. - -system attribute (SYS): 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. - -system prompt: Symbol displayed by the operating system indicating -that the system is ready to receive input. See prompt and CP/M -prompt. - -system tracks: 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. - -terminal: See console. - -TPA: 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 - - - H-18 - - - - - -CP/M Operating System Manual H Glossary - - -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. - -track: 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. - -Transient Program Area: See TPA. - -upward compatible: 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. - -USER: Term used in CP/M and MP/M systems to distinguish distinct -regions of the directory. - -user number: 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. - -utility: 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. - -vector: Location in memory. An entry point into the operating -system used for making system calls or interrupt handling. - -warm start: 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. - -WBOOT: 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. - -wildcard characters: 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. - - - - - H-19 - - - - - -CP/M Operating System Manual H Glossary - - -word: 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. - -WRITE: 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. - -XLT: 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. - -ZERO PAGE: See page zero. - - -End of Appendix H - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - H-20 - - - - - - - - -Appendix I - -CP/M Error Messages - - - - 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. - - - Table I-1. CP/M Error Messages - - F - Message Meaning - - ? - - DDT. This message has four possible - meanings: - - o DDT does not understand the assembly - language instruction. - o The file cannot be opened. - o A checksum error occurred in a HEX - file. - o The assembler/disassembler was - overlayed. - - - ABORTED - - PIP. You stopped a PIP operation by - pressing a key. - - - ASM Error Messages - - D Data error: data statement element - cannot be placed in specified data - area. - - E Expression error: expression cannot - be evaluated during assembly. - - L Label error: label cannot appear in - this context (might be duplicate - label). - - - - - - I-1 - - - - - -CP/M Operating System Manual I CP/M Error Messages - - - Table I-1. (continued) - - Message Meaning - - ASM Error Messages (continued) - - N Not implemented: unimplemented - features, such as macros, are - trapped. - - O Overflow: expression is too complex - to evaluate. - - P Phase error: label value changes on - two passes through assembly. - - R Register error: the value specified - as a register is incompatible with - the code. - - S Syntax error: improperly formed - expression. - - U Undefined label: label used does not - exist. - - V Value error: improperly formed - operand encountered in an expression. - - - BAD DELIMITER - - STAT. Check command line for typing - errors. - - - Bad Load - - CCP error message, or SAVE error message. - - - Bdos Err On d: - - 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. - - - - - - - - - I-2 - - - - - -CP/M Operating System Manual I CP/M Error Messages - - - Table I-1. (continued) - - Message Meaning - - Bdos Err On d: Bad Sector - - 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. - - - Bdos Err On d: File R/O - - 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. - - - Bdos Err On d: R/O - - 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. - - - Bdos Err on d: Select - - 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. - - - Break "x" at c - - ED. "x" is one of the symbols described - below and c is the command letter being - executed when the error occurred. - - # Search failure. ED cannot find the - string specified in an F, S, or N - command. - - - - - I-3 - - - - - -CP/M Operating System Manual I CP/M Error Messages - - - Table I-1. (continued) - - Message Meaning - - ? 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. - - O The file specified in an R command - cannot be found. - - > 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. - - E Command aborted. A keystroke at the - console aborted command execution. - - Break "x" at c (continued) - - 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. - - - CANNOT CLOSE DESTINATION FILE--\{filespec\} - - 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. - - - Cannot close, R/O - CANNOT CLOSE FILES - - CP/M cannot write to the file. This - usually occurs because the disk is write- - protected. - - 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. - - - - - - - I-4 - - - - - -CP/M Operating System Manual I CP/M Error Messages - - - Table I-1. (continued) - - Message Meaning - - 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. - - 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. - - - CANNOT READ - - PIP. PIP cannot read the specified - source. Reader cannot be implemented. - - - CANNOT WRITE - - PIP. The destination specified in the PIP - command is illegal. You probably - specified an input device as a - destination. - - - Checksum error - - PIP. A HEX record checksum error was - encountered. The HEX record that produced - the error must be corrected, probably by - recreating the HEX file. - - - CHECKSUM ERROR - LOAD ADDRESS hhhh - ERROR ADDRESS hhhh - BYTES READ: - hhhh: - - LOAD. File contains incorrect data. - Regenerate HEX file from the source. - - - Command Buffer Overflow - - SUBMIT. The SUBMIT buffer allows up to - 2048 characters in the input file. - - - - I-5 - - - - - -CP/M Operating System Manual I CP/M Error Messages - - - Table I-1. (continued) - - Message Meaning - - Command too long - - SUBMIT. A command in the SUBMIT file - cannot exceed 125 characters. - - - CORRECT ERROR, TYPE RETURN OR CTRL-Z - - 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. - - - DESTINATION IS R/O, DELETE (Y/N)? - - 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. - - - Directory full - - 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. - - 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. - - - Disk full - - 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. - - - - - - - - I-6 - - - - - -CP/M Operating System Manual I CP/M Error Messages - - - Table I-1. (continued) - - Message Meaning - - DISK READ ERROR--\{filespec\} - - 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. - - - DISK WRITE ERROR--\{filespec\} - - 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. - - 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. - - SUBMIT. The SUBMIT program cannot write - the $$$.SUB file to the disk. Erase some - files, or select a new disk and try again. - - - ERROR: BAD PARAMETER - - PIP. You entered an illegal parameter in - a PIP command. Retype the entry - correctly. - - - ERROR: CANNOT OPEN SOURCE, LOAD ADDRESS hhhh - - LOAD. Displayed if LOAD cannot find the - specified file or if no filename is - specified. - - - ERROR: CANNOT CLOSE FILE, LOAD ADDRESS hhhh - - LOAD. Caused by an error code returned by - a BDOS function call. Disk might be - write-protected. - - - - - - I-7 - - - - - -CP/M Operating System Manual I CP/M Error Messages - - - Table I-1. (continued) - - Message Meaning - - ERROR: CANNOT OPEN SOURCE, LOAD ADDRESS hhhh - - LOAD. Cannot find source file. Check - disk directory. - - - ERROR: DISK READ, LOAD ADDRESS hhhh - - LOAD. Caused by an error code returned by - a BDOS function call. - - - ERROR: DISK WRITE, LOAD ADDRESS hhhh - - LOAD. Destination disk is full. - - - ERROR: INVERTED LOAD ADDRESS, LOAD ADDRESS hhhh - - 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. - - - ERROR: NO MORE DIRECTORY SPACE, LOAD ADDRESS hhhh - - LOAD. Disk directory is full. - - - Error on line nnn message - - 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. - - - FILE ERROR - - 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. - - - - I-8 - - - - - -CP/M Operating System Manual I CP/M Error Messages - - - Table I-1. (continued) - - Message Meaning - - FILE EXISTS - - 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. - - 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. - - - File exists, erase it - - 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. - - - ** FILE IS READ/ONLY ** - - 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. - - - File Not Found - - 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. - - 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. - - 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. - - - I-9 - - - - -CP/M Operating System Manual I CP/M Error Messages - - - Table I-1. (continued) - - Message Meaning - - FILE NOT FOUND--\{filespec\} - - PIP. An input file that you have - specified does not exist. - - - Filename required - - 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. - - - hhhh??=dd - - 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. - - - Insufficient memory - - DDT. There is not enough memory to load - the file specified in an R or E command. - - - Invalid Assignment - - 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. - - - - - - - - - - - - - - I-10 - - - - - -CP/M Operating System Manual I CP/M Error Messages - - - Table I-1. (continued) - - Message Meaning - - Invalid control character - - 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. - - - INVALID DIGIT--\{filespec\} - - 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. - - - Invalid Disk Assignment - - STAT. Might appear if you follow the - drive specification with anything except - =R/O. - - - INVALID DISK SELECT - - 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. - - - INVALID DRIVE NAME (Use A, B, C, or D) - - SYSGEN. SYSGEN recognizes only drives A, - B, C, and D as valid destinations for - system generation. - - - Invalid File Indicator - - STAT. Appears if you do not specify RO, - RW, DIR, or SYS. - - - - - - - - I-11 - - - - - -CP/M Operating System Manual I CP/M Error Messages - - - Table I-1. (continued) - - Message Meaning - - INVALID FORMAT - - PIP. The format of your PIP command is - illegal. See the description of the PIP - command. - - - INVALID HEX DIGIT - LOAD ADDRESS hhhh - ERROR ADDRESS hhhh - BYTES READ: - hhhh - - LOAD. File contains incorrect HEX digit. - - - INVALID MEMORY SIZE - - MOVCPM. Specify a value less than 64K or - your computer's actual memory size. - - - INVALID SEPARATOR - - PIP. You have placed an invalid character - for a separator between two input - filenames. - - - INVALID USER NUMBER - - PIP. You have specified a user number - greater than 15. User numbers are in the - range 0 to 15. - - - n? - - USER. You specified a number greater than - fifteen for a user area number. For - example, if you type USER 18, the - screen displays 18?. - - - - - - - - - - - - I-12 - - - - - -CP/M Operating System Manual I CP/M Error Messages - - - Table I-1. (continued) - - Message Meaning - - NO DIRECTORY SPACE - - 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. - - - NO DIRECTORY SPACE--\{filespec\} - - 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. - - - NO FILE--\{filespec\} - - DIR, ERA, REN, PIP. CP/M cannot find the - specified file, or no files exist. - - ASM. The indicated source or include file - cannot be found on the indicated drive. - - DDT. The file specified in an R or E - command cannot be found on the disk. - - - NO INPUT FILE PRESENT ON DISK - - DUMP. The file you requested does not - exist. - - - No memory - - There is not enough (buffer?) memory - available for loading the program - specified. - - - NO SOURCE FILE ON DISK - - SYSGEN. SYSGEN cannot find CP/M either in - CPMxx.com form or on the system tracks of - the source disk. - - - - - - - I-13 - - - - - -CP/M Operating System Manual I CP/M Error Messages - - - Table I-1. (continued) - - Message Meaning - - NO SOURCE FILE PRESENT - - 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. - - - NO SPACE - - SAVE. Too many files are already on the - disk, or no room is left on the disk to - save the information. - - - No SUB file present - - 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. - - - NOT A CHARACTER SOURCE - - PIP. The source specified in your PIP - command is illegal. You have probably - specified an output device as a source. - - - ** NOT DELETED ** - - PIP. PIP did not delete the file, which - might have had the R/O attribute. - - - NOT FOUND - - PIP. PIP cannot find the specified file. - - - OUTPUT FILE WRITE ERROR - - 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. - - - - - - I-14 - - - - - -CP/M Operating System Manual I CP/M Error Messages - - - Table I-1. (continued) - - Message Meaning - - Parameter error - - SUBMIT. Within the SUBMIT file of type - sub, valid parameters are $0 through $9. - - - PARAMETER ERROR, TYPE RETURN TO IGNORE - - SYSGEN. If you press RETURN, SYSGEN - proceeds without processing the invalid - parameter. - - - QUIT NOT FOUND - - PIP. The string argument to a Q parameter - was not found in your input file. - - - Read error - - 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. - - - READER STOPPING - - PIP. Reader operation interrupted. - - - Record Too Long - - PIP. PIP cannot process a record longer - than 128 bytes. - - - Requires CP/M 2.0 or later - - XSUB. XSUB requires the facilities of - CP/M 2.0 or newer version. - - - - - - - - - - - - I-15 - - - - - -CP/M Operating System Manual I CP/M Error Messages - - - Table I-1. (continued) - - Message Meaning - - Requires CP/M 2.0 or new for operation - - PIP. This version of PIP requires the - facilities of CP/M 2.0 or newer version. - - - START NOT FOUND - - PIP. The string argument to an S - parameter cannot be found in the source - file. - - - SOURCE FILE INCOMPLETE - - SYSGEN. SYSGEN cannot use your CP/M - source file. - - - SOURCE FILE NAME ERROR - - 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. - - - SOURCE FILE READ ERROR - - 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. - - - SYNCHRONIZATION ERROR - - MOVCPM. The MOVCPM utility is being used - with the wrong CP/M system. - - - - - - I-16 - - - - - -CP/M Operating System Manual I CP/M Error Messages - - - Table I-1. (continued) - - Message Meaning - - "SYSTEM" FILE NOT ACCESSIBLE - - You tried to access a file set to SYS with - the STAT command. - - - ** TOO MANY FILES ** - - STAT. There is not enough memory for STAT - to sort the files specified, or more than - 512 files were specified. - - - UNEXPECTED END OF HEX FILE--\{filespec\} - - 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. - - - Unrecognized Destination - - PIP. Check command line for valid - destination. - - - Use: STAT d:=RO - - STAT. An invalid STAT drive command was - given. The only valid drive assignment in - STAT is STAT d:=RO. - - - VERIFY ERROR:--\{filespec\} - - 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. - - - WRONG CP/M VERSION (REQUIRES 2.0) - - - XSUB ACTIVE - - SUBMIT. XSUB has been invoked. - - - I-17 - - - - - -CP/M Operating System Manual I CP/M Error Messages - - - Table I-1. (continued) - - Message Meaning - - XSUB ALREADY PRESENT - - SUBMIT. XSUB is already active in memory. - - Your input? - - 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. - K - - -End of Appendix I - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - I-18 - - diff --git a/Source/Doc/CPM 22 Manual - Testing/sixa.tex b/Source/Doc/CPM 22 Manual - Testing/sixa.tex deleted file mode 100644 index 3b594928..00000000 --- a/Source/Doc/CPM 22 Manual - Testing/sixa.tex +++ /dev/null @@ -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 - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Source/Doc/CPM 22 Manual - Testing/sixb.tex b/Source/Doc/CPM 22 Manual - Testing/sixb.tex deleted file mode 100644 index 5ab5e7e7..00000000 --- a/Source/Doc/CPM 22 Manual - Testing/sixb.tex +++ /dev/null @@ -1,1311 +0,0 @@ -.bp 13 -.tc 6.6 The BIOS Entry Points -.he CP/M Operating System Manual 6.6 BIOS Entry Points -.sh -6.6 The BIOS Entry Points -.qs -.pp 5 -The entry points into the BIOS from the cold start loader and -BDOS are detailed below. Entry to the BIOS is through a jump -vector located at 4A00H+b, as shown below. See Appendixes A and -B. The jump vector is a sequence of 17 jump -instructions that send program control to the individual BIOS -subroutines. The BIOS subroutines might be empty for certain -functions (they might contain a single RET operation) -during reconfiguration of CP/M, but the entries must be present -in the jump vector. -.pp -The jump vector at 4A00H+b takes the form shown below, where the -individual jump addresses are given to the left: -.mb 4 -.fm 1 -.mt 4 -.hm 1 -.sp 2 -.nf -.in 5 -4A00H+b JMP BOOT ;ARRIVE HERE FROM COLD - START LOAD -.sp -4A03H+b JMP WBOOT ;ARRIVE HERE FOR WARM START - -4A06H+b JMP CONST ;CHECK FOR CONSOLE CHAR - READY - -4A09H+b JMP CONIN ;READ CONSOLE CHARACTER IN - -4A0CH+b JMP CONOUT ;WRITE CONSOLE CHARACTER - OUT - -4A0FH+b JMP LIST ;WRITE LISTING CHARACTER OUT - -4A12H+b JMP PUNCH ;WRITE CHARACTER TO PUNCH - DEVICE - -4A15H+b JMP READER ;READ READER DEVICE - -4A18H+b JMP HOME ;MOVE TO TRACK 00 ON - SELECTED DISK - -4A1BH+b JMP SELDSK ;SELECT DISK DRIVE - -4A1EH+b JMP SETTRK ;SET TRACK NUMBER - -4A21H+b JMP SETSEC ;SET SECTOR NUMBER - -4A24H+b JMP SETDMA ;SET DMA ADDRESS - -4A27H+b JMP READ ;READ SELECTED SECTOR - -4A2AH+b JMP WRITE ;WRITE SELECTED SECTOR - -4A2DH+b JMP LISTST ;RETURN LIST STATUS - -4A30H+b JMP SECTRAN ;SECTOR TRANSLATE - SUBROUTINE -.fi -.in 0 -.sp 2 -.sh - Listing 6-2. BIOS Entry Points -.pp -Each jump address corresponds to a particular subroutine that performs the -specific function, as outlined below. There are three major -divisions in the jump table: the system reinitialization, -which results from calls on BOOT and WBOOT; simple character I/O, -performed by calls on CONST, CONIN, CONOUT, LIST, PUNCH, READER, -and LISTST; and disk I/O, performed by calls on HOME, SELDSK, -SETTRK, SETSEC, SETDMA, READ, WRITE, and SECTRAN. -.pp -All simple character I/O operations are assumed to be performed -in ASCII, upper- and lower-case, with high-order (parity bit) set -to zero. An end-of-file condition for an input device is given -by an ASCII CTRL-Z (1AH). Peripheral devices are seen by CP/M as -logical devices and are assigned to physical devices within the -BIOS. -.pp -To operate, the BDOS needs only the CONST, CONIN, and CONOUT -subroutines. LIST, PUNCH, and READER can be used by PIP, but not -the BDOS. Further, the LISTST entry is currently used only by -DESPOOL, the print spooling utility. Thus, the initial version -of CBIOS can have empty subroutines for the remaining ASCII -devices. -.pp -The following list describes the characteristics of each device. -.sp 2 -.in 5 -.ti -2 -o CONSOLE is the principal interactive console that communicates with the -operator and it is accessed through CONST, CONIN, and CONOUT. Typically, the -CONSOLE is a device such as a CRT or teletype. -.sp -.ti -2 -o LIST is the principal listing device. If it exists on the user's system, -it is usually a hard-copy device, such as a printer or teletype. -.sp -.ti -2 -o PUNCH is the principal tape punching device. If it exists, it is normally a -high-speed paper tape punch or teletype. -.sp -.ti -2 -o READER is the principal tape reading device, such as a simple optical -reader or teletype. -.fi -.in 0 -.sp -.pp -A single peripheral can be assigned as the LIST, PUNCH, and -READER device simultaneously. If no peripheral device is -assigned as the LIST, PUNCH, or READER device, the CBIOS -gives an appropriate error message so that the -system does not hang if the device is accessed by PIP or some -other user program. Alternately, the PUNCH and LIST routines can -just simply return, and the READER routine can return with a 1AH -(CTRL-Z) in register A to indicate immediate end-of-file. -.pp -For added flexibility, you can optionally implement the -IOBYTE function, which allows reassignment of physical devices. -The IOBYTE function creates a mapping of logical-to-physical -devices that can be altered during CP/M processing, -see the STAT command in Section 1.6.1. -.pp -The definition of the IOBYTE function corresponds to the Intel -standard as follows: a single location in memory, currently -location 0003H, is maintained, called IOBYTE, which defines the -logical-to-physical device mapping that is in effect at a -particular time. The mapping is performed by splitting the -IOBYTE into four distinct fields of two bits each, called the -CONSOLE, READER, PUNCH, and LIST fields, as shown in the -following figure. -.sp 2 -.nf - most significant least significant -.sp - IOBYTE AT 003H LIST PUNCH READER CONSOLE -.sp - bits 6,7 bits 4,5 bits 2,3 bits 0,1 -.fi -.sp 2 -.sh - Figure 6-1. IOBYTE Fields -.sp 2 -.pp -The value in each field can be in the range 0-3, defining the -assigned source or destination of each logical device. Table 6-4 -gives the values that can be assigned to each field. -.sp 2 -.sh -.nf - Table 6-4. IOBYTE Field Values -.sp - Value Meaning -.sp - CONSOLE field (bits 0,1) -.sp - 0 console is assigned to the console printer - device (TTY:) - 1 console is assigned to the CRT device (CRT:) - 2 batch mode: use the READER as the CONSOLE input, - and the LIST device as the CONSOLE output (BAT:) - 3 user-defined console device (UC1:) -.sp -.mb 4 -.fm 1 -.mt 4 -.hm 1 - READER field (bits 2,3) -.sp - 0 READER is the teletype device (TTY:) - 1 READER is the high speed reader device (PTR:) - 2 user-defined reader #1 (UR1:) - 3 user-defined reader #2 (UR2:) -.sp - PUNCH field (bits 4,5) -.sp - 0 PUNCH is the teletype device (TTY:) - 1 PUNCH is the high speed punch device (PTP:) - 2 user-defined punch #1 (UP1:) - 3 user-defined punch #2 (UP2:) -.sp - LIST field (bits 6,7) -.sp - 0 LIST is the teletype device (TTY:) - 1 LIST is the CRT device (CRT:) - 2 LIST is the line printer device (LPT:) - 3 user-defined list device (UL1:) -.fi -.bp -.pp -The implementation of the IOBYTE is optional and effects only the -organization of the CBIOS. No CP/M systems use the IOBYTE -(although they tolerate the existence of the IOBYTE at location -0003H) except for PIP, which allows access to the physical -devices, and STAT, which allows logical-physical assignments to -be make or displayed. For more information see Section 1. In -any case the IOBYTE implementation should be omitted until the -basic CBIOS is fully implemented and tested; then you should -add the IOBYTE to increase the facilities. -.mb 6 -.fm 2 -.mt 5 -.hm 2 -.pp -Disk I/O is always performed through a sequence of calls on the -various disk access subroutines that set up the disk number to -access, the track and sector on a particular disk, and the Direct -Memory Access (DMA) address involved in the I/O operation. After -all these parameters have been set up, a call is made to the READ -or WRITE function to perform the actual I/O operation. -.pp -There is often a single call to SELDSK to select a disk drive, -followed by a number of read or write operations to the selected -disk before selecting another drive for subsequent operations. -Similarly, there might be a single call to set the DMA address, -followed by several calls that read or write from the selected -DMA address before the DMA address is changed. The track and -sector subroutines are always called before the READ or WRITE -operations are performed. -.pp -The READ and WRITE routines should perform several retries (10 is -standard) before reporting the error condition to the BDOS. If -the error condition is returned to the BDOS, it reports the -error to the user. The HOME subroutine might or might not actually -perform the track 00 seek, depending upon controller -characteristics; the important point is that track 00 has been -selected for the next operation and is often treated in exactly -the same manner as SETTRK with a parameter of 00. -.pp -The following table describes the exact responsibilities of each -BIOS entry point subroutine. -.sp 2 -.sh - Table 6-5. BIOS Entry Points -.sp - Entry Point Function -.sp -.ll 60 -.in 15 -.ti -9 -BOOT The BOOT entry point gets control from the cold start loader and is -responsible for basic system initialization, including sending a sign-on -message, which can be omitted in the first version. If the IOBYTE function -is implemented, it must be set at this point. The various system parameters -that are set by the WBOOT entry point must be initialized, and control is -transferred to the CCP at 3400+b for further processing. Note that register -C must be set to zero to select drive A. -.in 0 -.bp -.sh - Table 6-5. (continued) -.sp - Entry Point Function -.sp -.in 15 -.ti -9 -WBOOT The WBOOT entry point gets control when a warm start occurs. A warm -start is performed whenever a user program branches to location 0000H, or -when the CPU is reset from the front panel. The CP/M system must be loaded -from the first two tracks of drive A up to, but not including, the BIOS, or -CBIOS, if the user has completed the patch. System parameters must be -initialized as follows: -.sp -.in 32 -.ti -17 -location 0,1,2 Set to JMP WBOOT for warm starts (000H: JMP 4A03H+b) -.sp -.ti -17 -location 3 Set initial value of IOBYTE, if implemented in the CBIOS -.sp -.ti -17 -location 4 High nibble = current user no; low nibble = current drive -.sp -.ti -17 -location 5,6,7 Set to JMP BDOS, which is the primary entry point to CP/M for -transient programs. (0005H: JMP 3C06H+b) -.sp -.in 15 -Refer to Section 6.9 for complete details of page zero use. -Upon completion of the initialization, the WBOOT program must branch to the -CCP at 3400H+b to restart the system. Upon entry to the CCP, register C is -set to the drive to select after system initialization. The WBOOT routine -should read location 4 in memory, verify that is a legal drive, and pass it -to the CCP in register C. -.sp -.ti -9 -CONST You should sample the status of the currently assigned console -device and return 0FFH in register A if a character is ready to read and 00H -in register A if no console characters are ready. -.sp -.ti -9 -CONIN The next console character is read into register A, and the parity -bit is set, high-order bit, to zero. If no console character is ready, -wait until a character is typed before returning. -.in 0 -.bp -.sh - Table 6-5. (continued) -.sp - Entry Point Function -.sp -.in 15 -.ti -9 -CONOUT The character is sent from register C to the console -output device. The character is in ASCII, with high-order parity -bit set to zero. You might want to include a time-out on a -line-feed or carriage return, if the console device requires some -time interval at the end of the line (such as a TI Silent 700 -terminal). You can filter out control characters that cause -the console device to react in a strange way (CTRL-Z causes the -Lear-Seigler terminal to clear the screen, for example). -.sp -.ti -9 -LIST The character is sent from register C to the currently -assigned listing device. The character is in ASCII with zero -parity bit. -.sp -.ti -9 -PUNCH The character is sent from register C to the currently -assigned punch device. The character is in ASCII with zero -parity. -.sp -.ti -9 -READER The next character is read from the currently assigned reader -device into register A with zero parity (high-order bit must be -zero); an end-of-file condition is reported by returning an ASCII -CTRL-Z(1AH). -.sp -.ti -9 -HOME The disk head of the currently selected disk -(initially disk A) is moved to the track 00 position. If the controller -allows access to the track 0 flag from the drive, the head is -stepped until the track 0 flag is detected. If the controller -does not support this feature, the HOME -call is translated into a call to SETTRK with a parameter of 0. -.sp -.ti -9 -SELDSK The disk drive given by register C is selected for further -operations, where register C contains 0 for drive A, 1 for drive B, and so -on up to 15 for drive P (the standard CP/M distribution version supports four -drives). On each disk select, SELDSK must return in HL the base address of a -16-byte area, called the Disk Parameter Header, described in Section 6.10. -For standard floppy disk drives, the contents of the header and associated -tables do not change; thus, the program segment included in the sample CBIOS -performs this operation automatically. -.in 0 -.bp -.sh - Table 6-5. (continued) -.sp - Entry Point Function -.sp -.in 15 -If there is an attempt to select a -nonexistent drive, SELDSK returns HL=0000H as an error indicator. -Although SELDSK must return the header address on each call, it is advisable -to postpone the physical disk select operation until an I/O function (seek, -read, or write) is actually performed, because disk selects often occur -without utimately performing any disk I/O, and many controllers unload -the head of the current disk before selecting the new drive. This -causes an excessive amount of noise and disk wear. The least significant bit -of register E is zero if this is the first occurrence of the drive select -since the last cold or warm start. -.sp -.ti -9 -SETTRK Register BC contains the track number for subsequent disk accesses -on the currently selected drive. The sector number in BC is the same as the -number returned from the SECTRAN entry point. You can choose to seek -the selected track at this time or delay the seek until the next read or -write actually occurs. Register BC can take on values in the range 0-76 -corresponding to valid track numbers for standard floppy disk drives and -0-65535 for nonstandard disk subsystems. -.sp -.ti -9 -SETSEC Register BC contains the sector number, 1 through 26, for subsequent -disk accesses on the currently selected drive. The sector number in BC is -the same as the number returned from the SECTRAN entry point. You can -choose to send this information to the controller at this point or delay -sector selection until a read or write operation occurs. -.mb 4 -.fm 1 -.sp -.ti -9 -SETDMA Register BC contains the DMA (Disk Memory Access) address for -subsequent read or write operations. For example, if B = 00H and C = 80H -when SETDMA is called, all subsequent read operations read their data into -80H through 0FFH and all subsequent write operations get their -data from 80H through 0FFH, until the next call -to SETDMA occurs. The initial DMA address is -assumed to be 80H. The controller need not -actually support Direct Memory Access. If, -for example, all data transfers are through I/O -ports, the CBIOS that is constructed uses -the 128-byte area starting at the selected DMA -address for the memory buffer during the -subsequent read or write operations. -.in 0 -.bp -.sh - Table 6-5. (continued) -.sp - Entry Point Function -.sp -.in 15 -.ti -9 -READ Assuming the drive has been selected, the track -has been set, and the DMA address has been -specified, the READ subroutine attempts to -read one sector based upon these parameters -and returns the following error codes in -register A: -.sp -0 no errors occurred -.sp -1 nonrecoverable error condition occurred -.sp -Currently, CP/M responds only to a zero or nonzero -value as the return code. That is, if the -value in register A is 0, CP/M assumes that the -disk operation was completed properly. IF an -error occurs the CBIOS should attempt -at least 10 retries to see if the error is -recoverable. When an error is reported the BDOS -prints the message BDOS ERR ONx: BAD -SECTOR. The operator then has the option of -pressing a carriage return to ignore the error, or -CTRL-C to abort. -.sp -.ti -9 -WRITE Data is written from the currently -selected DMA address to the currently selected -drive, track, and sector. For floppy disks, the -data should be marked as nondeleted data to -maintain compatibility with other CP/M systems. -The error codes given in the READ command are -returned in register A, with error recovery -attempts as described above. -.mb 6 -.fm 2 -.sp -.ti -9 -LISTST You return the ready status of the list -device used by the DESPOOL program to improve -console response during its operation. The -value 00 is returned in A if the list device is -not ready to accept a character and 0FFH if a -character can be sent to the printer. A 00 -value should be returned if LIST status is not -implemented. -.in 0 -.bp -.sh - Table 6-5. (continued) -.sp - Entry Point Function -.sp -.in 15 -.ti -9 -SECTRAN Logical-to-physical sector -translation is performed to improve the overall response of -CP/M. Standard CP/M systems are shipped with a -skew factor of 6, where six physical sectors are -skipped between each logical read operation. -This skew factor allows enough time between -sectors for most programs to load their buffers -without missing the next sector. In particular -computer systems that use fast processors, -memory, and disk subsystems, the skew factor might -be changed to improve overall response. -However, the user should maintain a single-density -IBM-compatible version of CP/M for -information transfer into and out of the -computer system, using a skew factor of 6. -.sp -In general, SECTRAN receives a logical sector -number relative to zero in BC and a translate -table address in DE. The sector number is used -as an index into the translate table, with the -resulting physical sector number -in HL. For standard systems, the table and -indexing code is provided in the CBIOS and -need not be changed. -.in 0 -.ll 65 -.sp 2 -.tc 6.7 A Sample BIOS -.he CP/M Operating System Manual 6.7 A Sample BIOS -.sh -6.7 A Sample BIOS -.qs -.pp -The program shown in Appendix B can serve as a basis for your -first BIOS. The simplest functions are assumed in this BIOS, so -that you can enter it through a front panel, if absolutely -necessary. You must alter and insert code into the -subroutines for CONST, CONIN, CONOUT, READ, WRITE, and WAITIO -subroutines. Storage is reserved for user-supplied code in these -regions. The scratch area reserved in page zero (see Section -6.9) for the BIOS is used in this program, so that it could be -implemented in ROM, if desired. -.pp -Once operational, this skeletal version can be enhanced to print -the initial sign-on message and perform better error recovery. -The subroutines for LIST, PUNCH, and READER can be filled out and -the IOBYTE function can be implemented. -.sp 2 -.tc 6.8 A Sample Cold Start Loader -.he CP/M Operating System Manual 6.8 A Sample Cold Start Loader -.sh -6.8 A Sample Cold Start Loader -.qs -.pp -The program shown in Appendix E can serve as a basis for a cold -start loader. The disk read function must be supplied by the -user, and the program must be loaded somehow starting at location -0000. Space is reserved for the patch code so that the total -amount of storage required for the cold start loader is 128 -bytes. -.pp -Eventually, you might want to get this -loader onto the first disk sector (track 0, sector 1) and cause -the controller to load it into memory automatically upon system -start up. Alternatively, the cold start loader can be placed -into ROM, and above the CP/M system. In this case, it is -necessary to originate the program at a higher address and key in -a jump instruction at system start up that branches to the -loader. Subsequent warm starts do not require this key-in -operation, because the entry point WBOOT gets control, thus bringing -the system in from disk automatically. The skeletal cold start -loader has minimal error recovery, which might be enhanced in later -versions. -.sp 2 -.tc 6.9 Reserved Locations in Page Zero -.he CP/M Operating System Manual 6.9 Reserved Locations in Page Zero -.sh -6.9 Reserved Locations in Page Zero -.qs -.pp -Main memory page zero, between locations 00H and 0FFH, contains -several segments of code and data that are used during CP/M -processing. The code and data areas are given in the following table. -.sp 2 -.sh - Table 6-6. Reserved Locations in Page Zero -.sp -.nf - Locations Contents -.fi -.sp -.ll 60 -.in 22 -.ti -17 -000H-0002H Contains a jump instruction to the warm start entry location -4A03H+b. This allows a simple programmed restart (JMP 0000H) or manual -restart from the front panel. -.sp -.ti -17 -0003H-0003H Contains the Intel standard IOBYTE is optionally -included in the user's CBIOS (refer to Section 6.6). -.sp -.ti -17 -0004H-0004H Current default drive number (0=A,...,15=P). -.sp -.ti -17 -0005H-0007H Contains a jump instruction to the BDOS and serves two -purposes: JMP 0005H provides the primary entry point to the BDOS, as -described in Chapter 5, and LHLD 0006H brings the address field of the -instruction to the HL register pair. This value is the lowest address in -memory used by CP/M, assuming the CCP is being overlaid. The DDT program -changes the address field to reflect the reduced memory size in debug mode. -.sp -.ti -17 -0008H-0027H Interrupt locations 1 through 5 not used. -.sp -.ti -17 -0030H-0037H Interrupt location 6 (not currently used) is reserved. -.in 0 -.bp -.sh - Table 6-6. (continued) -.sp -.nf - Locations Contents -.fi -.sp -.in 22 -.ti -17 -0038H-003AH Restart 7; contains a jump instruction into the DDT or SID -program when running in debug mode for programmed breakpoints, but is not -otherwise used by CP/M. -.sp -.ti -17 -003BH-003FH Not currently used; reserved. -.sp -.ti -17 -0040H-004FH A 16-byte area reserved for scratch by CBIOS, but is not -used for any purpose in the distribution version of CP/M. -.sp -.ti -17 -0050H-005BH Not currently used; reserved. -.sp -.ti -17 -005CH-007CH Default File Control Block produced for a transient -program by the CCP. -.sp -.ti -17 -007DH-007FH Optional default random record position. -.sp -.ti -17 -0080H-00FFH Default 128-byte disk buffer, also filled with the -command line when a transient is loaded under the CCP. -.in 0 -.ll 65 -.mb 4 -.fm 1 -.sp -.pp -This information is set up for normal operation under the CP/M -system, but can be overwritten by a transient program if the BDOS -facilities are not required by the transient. -.pp -If, for example, a particular program performs only simple I/O -and must begin execution at location 0, it can first be loaded -into the TPA, using normal CP/M facilities, with a small memory -move program that gets control when loaded. The memory move -program must get control from location 0100H, which is the -assumed beginning of all transient programs. The move program can -then proceed to the entire memory image down to location 0 and -pass control to the starting address of the memory load. -.pp -If the BIOS is overwritten or if location 0, containing the warm -start entry point, is overwritten, the operator must bring the -CP/M system back into memory with a cold start sequence. -.sp 2 -.tc 6.10 Disk Parameter Tables -.he CP/M Operating System Manual 6.10 Disk Parameter Tables -.sh -6.10 Disk Parameter Tables -.qs -.pp -Tables are included in the BIOS that describe the particular -characteristics of the disk subsystem used with CP/M. These -tables can be either hand-coded, as shown in the sample CBIOS in -Appendix B, or automatically generated using the DISKDEF macro -library, as shown in Appendix F. The purpose here is to describe -the elements of these tables. -.bp -.pp -In general, each disk drive has an associated (16-byte) disk -parameter header that contains information about the disk drive -and provides a scratch pad area for certain BDOS operations. The -format of the disk parameter header for each drive is shown -in Figure 6-2, where each element is a word (16-bit) value. -.mb 6 -.fm 2 -.sp 3 -.nf -XLT 0000 0000 0000 DIRBUF DPB CSV ALV -16b 16b 16b 16b 16b 16b 16b 16b -.fi -.sp 2 -.sh - Figure 6-2. Disk Parameter Header Format -.sp 2 -.pp -The meaning of each Disk Parameter Header (DPH) element is detailed in Table -6-7. -.sp 2 -.sh - Table 6-7. Disk Parameter Headers -.sp -.nf - Disk Parameter Meaning - Header -.fi -.ll 60 -.sp -.in 20 -.ti -14 -XLT Address of the logical-to-physical translation vector, if used -for this particular drive, or the value 0000H if no sector translation -takes place (that is, the physical and logical sector numbers are the same). -Disk drives with identical sector skew factors share the same translate tables. -.sp -.ti -14 -0000 Scratch pad values for use within the BDOS, initial value is -unimportant. -.sp -.ti -14 -DIRBUF Address of a 128-byte scratch pad area for directory operations -within BDOS. All DPHs address the same scratch pad area. -.sp -.ti -14 -DPB Address of a disk parameter block for this drive. Drives with -identical disk characteristics address the same disk parameter block. -.sp -.ti -14 -CSV Address of a scratch pad area used for software check for -changed disks. This address is different for each DPH. -.sp -.ti -14 -ALV Address of a scratch pad area used by the BDOS to keep disk -storage allocation information. This address is different for each DPH. -.fi -.in 0 -.ll 65 -.bp -.pp -Given n disk drives, the DPHs are arranged in a table whose first row of 16 -bytes corresponds to drive 0, with the last row corresponding to drive n-1. -In the following figure the lable DPBASE defines the base address of the DPH -table. -.sp 3 -.nf - DPBASE: -.sp - 00 XLT 00 0000 0000 0000 DIRBUF DBP 00 CSV 00 ALV 00 -.sp - 01 XLT 01 0000 0000 0000 DIRBUF DBP 01 CSV 01 ALV 01 - . - . - . - n-1 XLTn-1 0000 0000 0000 DIRBUF DBTn-1 CSVn-1 ALVn-1 -.fi -.sp 2 -.sh - Figure 6-3. Disk Parameter Header Table -.sp 2 -.pp -A responsibility of the SELDSK subroutine is to return the base address of -the DPH for the selected drive. The following sequence of operations returns -the table address, with a 0000H returned if the selected drive does not exist. -.sp 2 -.nf -.in 7 - NDISKS EQU 4 ;NUMBER OF DISK DRIVES - ..... - SELDSK: ;SELECT DISK GIVEN BY BC - LSI H,0000H ;ERROR CODE - MOV A,C ;DRIVE OK? - CPI NDISKS ;CY IF SO - RNC ;RET IF ERROR - ;NO ERROR, CONTINUE - MOV L,C ;LOW(DISK) - MOV H,B ;HIGH(DISK) - DAD H ;*2 - DAD H ;*4 - DAD H ;*8 - DAD H ;*16 - LXI D,DPBASE;FIRST DPH - DAD D ;DPH(DISK) - RET -.fi -.in 0 -.sp -.pp -The translation vectors, XLT 00 through XLTn-1, are located elsewhere in -the BIOS, and simply correspond one-for-one with the logical sector numbers -zero through the sector count 1. The Disk Parameter Block (DPB) for each -drive is more complex. As shown in Figure 6-4, particular DPB, that is -addressed by one or more DPHs, takes the general form: -.sp 3 -.nf - SPT BSH BLM EXM DSM DRM AL0 AL1 CKS 0FF - 16b 8b 8b 8b 16b 16b 8b 8b 16b 16b -.fi -.sp 2 -.sh - Figure 6-4. Disk Parameter Block Format -.sp 3 -where each is a byte or word value, as shown by the 8b or 16b indicator below -the field. -.pp -The following field abbreviations are used in Figure 6-4: -.sp 2 -.in 5 -.ti -2 -o SPT is the total number of sectors per track. -.sp -.ti -2 -o BSH is the data allocation block shift factor, determined by the data -block allocation size. -.sp -.ti -2 -o BLM is the data allocation block mask (2[BSH-1]). -.sp -.ti -2 -o EXM is the extent mask, determined by the data block allocation -size and the number of disk blocks. -.sp -.ti -2 -o DSM determines the total storage capacity of the disk drive. -.sp -.ti -2 -o DRM determines the total number of directory entries that can be -stored on this drive. AL0, AL1 determine reserved directory blocks. -.sp -.ti -2 -o CKS is the size of the directory check vector. -.sp -.ti -2 -o 0FF is the number of reserved tracks at the beginning of the -(logical) disk. -.fi -.in 0 -.sp -The values of BSH and BLM determine the data allocation size BLS, -which is not an entry in the DPB. Given that the designer has selected a -value for BLS, the values of BSH and BLM are shown Table 6-8. -.sp 2 -.sh - Table 6-8. BSH and BLM Values -.nf -.sp -.in 18 - BLS BSH BLM -.sp - 1024 3 7 - 2048 4 15 - 4096 5 31 - 8192 6 63 -16,384 7 127 -.fi -.in 0 -.sp 2 -where all values are in decimal. The value of EXM depends upon both the BLS -and whether the DSM value is less than 256 or greater than 255, as shown in -Table 6-9. -.bp -.sh - Table 6-9. EXM Values -.nf -.sp - BLS EXM values -.sp -.in 18 - DSM<256 DSM>255 -.sp - 1024 0 N/A - 2048 1 0 - 4096 3 1 - 8192 7 3 -16,384 15 7 -.fi -.in 0 -.sp -.pp -The value of DSM is the maximum data block number supported by this -particular drive, measured in BLS units. The product (DSM+1) is the -total number of bytes held by the drive and must be within the -capacity of the physical disk, not counting the reserved operating system -tracks. -.pp -The DRM entry is the one less than the total number of directory entries -that can take on a 16-bit value. The values of AL0 and AL1, however, are -determined by DRM. The values AL0 and AL1 can together be considered a -string of 16-bits, as shown in Figure 6-5. -.sp 3 -.nf - AL0 AL1 - - 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 -.fi -.sp 2 -.sh - Figure 6-5. AL0 and AL1 -.sp 2 -.pp -Position 00 corresponds to the high-order bit of the byte -labeled AL0 and 15 corresponds to the low-order bit of the byte -labeled AL1. Each bit position reserves a data block for number -of directory entries, thus allowing a total of 16 data blocks to -be assigned for directory entries (bits are assigned starting at -00 and filled to the right until position 15). Each directory -entry occupies 32 bytes, resulting in the following tabulation: -.sp 2 -.sh - Table 6-10. BLS Tabulation -.sp -.nf -.in 18 - BLS Directory Entries -.sp - 1024 32 times # bits - 2048 64 times # bits - 4096 128 times # bits - 8192 256 times # bits -16,384 512 times # bits -.fi -.in 0 -.bp -.pp -Thus, if DRM = 127 (128 directory entries) and BLS = 1024, there -are 32 directory entries per block, requiring 4 reserved blocks. -In this case, the 4 high-order bits of AL0 are set, resulting in -the values AL0 = 0F0H and AL1 = 00H. -.pp -The CKS value is determined as follows: if the disk drive media is -removable, then CKS = (DRM+1)/4, where DRM is the last directory -entry number. If the media are fixed, then set CKS = 0 (no -directory records are checked in this case). -.pp -Finally, the 0FF field determines the number of tracks that are -skipped at the beginning of the physical disk. This value is -automatically added whenever SETTRK is called and can be used as -a mechanism for skipping reserved operating system tracks or for -partitioning a large disk into smaller segmented sections. -.pp -To complete the discussion of the DPB, several DPHs can address -the same DPB if their drive characteristics are identical. -Further, the DPB can be dynamically changed when a new drive is -addressed by simply changing the pointer in the DPH; because the -BDOS copies the DPB values to a local area whenever the SELDSK -function is invoked. -.pp -Returning back to DPH for a particular drive, the two address -values CSV and ALV remain. Both addresses reference an area of -uninitialized memory following the BIOS. The areas must be -unique for each drive, and the size of each area is determined by -the values in the DPB. -.pp -The size of the area addressed by CSV is CKS bytes, which is -sufficient to hold the directory check information for this -particular drive, If CKS = (DRM+1)/4, you must reserve (DRM+1)/4 -bytes for directory check use. If CKS = 0, no storage is -reserved. -.pp -The size of the area addressed by ALV is determined by the -maximum number of data blocks allowed for this particular disk -and is computed as (DSM/8)+1. -.pp -The CBIOS shown in Appendix B demonstrates an instance of these -tables for standard 8-inch, single-density drives. It might be -useful to examine this program and compare the tabular values -with the definitions given above. -.sp 2 -.tc 6.11 The DISKDEF Macro Library -.he CP/M Operating System Manual 6.11 The DISKDEF Macro Library -.sh -6.11 The DISKDEF Macro Library -.qs -.pp -A macro library called DISKDEF (shown in Appendix F), greatly -simplifies the table construction process. You must have access -to the MAC macro assembler, of course, to use the DISKDEF -facility, while the macro library is included with all CP.M 2 -distribution disks. -.bp -.pp -A BIOS disk definition consists of the following sequence of -macro statements: -.sp -.nf -.in 7 - MACLIB DISKDEF - ..... - DISKS n - DISKDEF 0,... - DISKDEF 1,... - ..... - DISKDEF n-1 - ..... - ENDEF -.fi -.in 0 -.sp -where the MACLIB statement loads the DISKDEF.LIB file, on the -same disk as the BIOS, into MAC's internal tables. The DISKS -macro call follows, which specifies the number of drives to be -configured with the user's system, where n is an integer in the -range 1 to 16. A series of DISKDEF macro calls then follow that -define the characteristics of each logical disk, 0 through n-1, -corresponding to logical drives A through P. The DISKS and -DISKDEF macros generate the in-line fixed data tables described -in the previous section and thus must be placed in a -nonexecutable portion of the BIOS, typically directly following -the BIOS jump vector. -.pp -The remaining portion of the BIOS is defined following the -DISKDEF macros, with the ENDEF macro call immediately preceding -the END statement. The ENDEF (End of Diskdef) macro generates -the necessary uninitialized RAM areas that are located in -memory above the BIOS. -.pp -The DISKDEF macro call takes the form: -.sp -.ti 8 -DISKDEF dn,fsc,lsc,[skf],bls dks,dir,cks,ofs,[0] -.sp -where -.sp -.in 5 -.ti -2 -o dn is the logical disk number, 0 to n-1. -.ti -2 -o fsc is the first physical sector number (0 or 1). -.ti -2 -o lsc is the last sector number. -.ti -2 -o skf is the optional sector skew factor. -.ti -2 -o bls is the data allocation block size. -.ti -2 -o dks is the number of blocks on the disk. -.ti -2 -o dir is the number of directory entries. -.ti -2 -o cks is the number of checked directory entries. -.ti -2 -o ofs is the track offset to logical track 00. -.ti -2 -o [0] is an optional 1.4 compatibility flag. -.fi -.in 0 -.sp -.pp -The value dn is the drive number being defined with this DISKDEF -macro invocation. The fsc parameter accounts for differing -sector numbering systems and is usually 0 to 1. The lsc is the -last numbered sector on a track. When present, the skf parameter -defines the sector skew factor, which is used to create a sector -translation table according to the skew. -.pp -If the number of sectors is less than 256, a single-byte table is -created, otherwise each translation table element occupies two -bytes. No translation table is created if the skf parameter is -omitted, or equal to 0. -.pp -The bls parameter specifies the number of bytes allocated to each -data block, and takes on the values 1024, 2048, 4096, 8192, or -16384. Generally, performance increases with larger data block -sizes because there are fewer directory references, and logically -connected data records are physically close on the disk. -Further, each directory entry addresses more data and the BIOS-resident -RAM space is reduced. -.pp -The dks parameter specifies the total disk size in bls units. -That is, if the bls = 2048 and dks = 1000, the total disk -capacity is 2,048,000 bytes. If dks is greater than 255, the -block size parameter bls must be greater than 1024. The value of -dir is the total number of directory entries that might exceed -255, if desired. -.pp -The cks parameter determines the number of directory items to -check on each directory scan and is used internally to detect -changed disks during system operation, where an intervening cold -or warm start has not occurred. When this situation is detected, -CP/M automatically marks the disk Read-Only so that data is not -subsequently destroyed. -.pp -As stated in the previous section, the value of cks = dir when -the medium is easily changed, as is the case with a floppy disk -subsystem. If the disk is permanently mounted, the value of cks -is typically 0, because the probability of changing disks without a -restart is low. -.pp -The ofs value determines the number of tracks to skip when this -particular drive is addressed, which can be used to reserve -additional operating system space or to simulate several logical -drives on a single large capacity physical drive. -Finally, the [0] parameter is included when file compatibility is -required with versions of 1.4 that have been modified for higher -density disks. This parameter ensures that only 16K is allocated -for each directory record, as was the case for previous versions. -Normally, this parameter is not included. -.pp -For convenience and economy of table space, the special form: -.sp -.ti 8 -DISKDEF i,j -.sp -gives disk i the same characteristics as a previously defined -drive j. A standard four-drive, single-density system, which is -compatible with version 1.4, is defined using the following macro -invocations: -.sp -.nf -.in 7 - DISKS 4 - DISKDEF 0,1,26,6,1024,243,64,2 - DISKDEF 1,0 - DISKDEF 2,0 - DISKDEF 3,0 - .... - ENDEF -.fi -.in 0 -.sp -with all disks having the same parameter values of 26 sectors per -track, numbered 1 through 26, with 6 sectors skipped between each -access, 1024 bytes per data block, 243 data blocks for a total of -243K-byte disk capacity, 64 checked directory entries, and two -operating system tracks. -.pp -The DISKS macro generates n DPHs, starting at the DPH table -address DPBASE generated by the macro. Each disk header block -contains sixteen bytes, as described above, and correspond -one-for-one to each of the defined drives. In the four-drive -standard system, for example, the DISKS macro generates a table -of the form: -.sp -.nf -.in 5 -DPBASE EQU$ -DPE0: DW XLT0,0000H,0000H,0000H,DIRBUF,DPB0,CSV0,ALV0 -DPE1: DW XLT0,0000H,0000H,0000H,DIRBUF,DPB0,CSV1,ALV1 -DPE2: DW XLT0,0000H,0000H,0000H,DIRBUF,DPB0,CSV2,ALV2 -DPE3: DW XLT0,0000H,0000H,0000H,DIRBUF,DPB0,CSV3,ALV3 -.fi -.in 0 -.sp -where the DPH labels are included for reference purposes to show -the beginning table addresses for each drive 0 through 3. The -values contained within the DPH are described in detail in the -previous section. The check and allocation vector addresses are -generated by the ENDEF macro in the ram area following the BIOS -code and tables. -.pp -Note that if the skf (skew factor) parameter is -omitted, or equal to 0, the translation table is omitted and a -0000H value is inserted in the XLT position of the DPH for the -disk. In a subsequent call to perform the logical-to-physical -translation, SECTRAN receives a translation table address of DE = -0000H and simply returns the original logical sector from BC in -the HL register pair. -.pp -A translate table is constructed when the skf parameter is -present, and the (nonzero) table address is placed into the -corresponding DPHs. The following for example, is constructed -when the standard skew factor skf = 6 is specified in the DISKDEF -macro call: -.sp -.nf -.in 8 -XLT0: DB 1,7,13,19,25,5,11,17,23,3,9,15,21 - DB 2,8,14,20,26,6,12,18,24,4,10,16,22 -.fi -.in 0 -.pp -Following the ENDEF macro call, a number of uninitialized data -areas are defined. These data areas need not be a part of the BIOS -that is loaded upon cold start, but must be available between the -BIOS and the end of memory. The size of the uninitialized RAM -area is determined by EQU statements generated by the ENDEF macro. -For a standard four-drive system, the ENDEF macro might produce -the following EQU statement: -.bp -.nf -.in 8 -4C72 = BEGDAT EQU $ - (data areas) -.sp -4DB0 = ENDDAT EQU $ -.sp -013C = DATSIZ EQU $-BEGDAT -.fi -.in 0 -.sp -which indicates that uninitialized RAM begins at location 4C72H, -ends at 4DB0H-1, and occupies 013CH bytes. You must ensure -that these addresses are free for use after the system is loaded. -.pp -After modification, you can use the STAT program to -check drive characteristics, because STAT uses the disk parameter -block to decode the drive information. A STAT command of the form: -.sp -.ti 8 -STAT d:DSK: -.sp -decodes the disk parameter block for drive d (d=A,...,P) and -displays the following values: -.sp 2 -.nf -.in 8 -r: 128-byte record capacity -k: kilobyte drive capacity -d: 32-byte directory entries -c: checked directory entries -e: records/extent -b: records/block -s: sectors/track -t: reserved tracks -.fi -.in 0 -.sp -.pp -Three examples of DISKDEF macro invocations are shown below with -corresponding STAT parameter values. The last example produces a full -8-megabyte system. -.sp -.nf -.in 8 - DISKDEF 0,1,58,,2048,256,128,128,2 -r=4096, k=512, d=128, c=128, e=256, b=16, s=58, t=2 -.sp - DISKDEF 0,1,58,,2048,1024,300,0,2 -r=16348, k=2048, d=300, c=0, e=128, b=16, s=58, t=2 -.sp - DISKDEF 0,1,58,,16348,512,128,128,2 -r=65536, k=8192, d=128, c=128, e=1024, b=128, s=58, t=2 -.fi -.in 0 -.sp 2 -.tc 6.12 Sector Blocking and Deblocking -.he CP/M Operating System Manual 6.12 Blocking and Deblocking -.sh -6.12 Sector Blocking and Deblocking -.qs -.pp -Upon each call to BIOS WRITE entry point, the CP/M BDOS includes -information that allows effective sector blocking and deblocking -where the host disk subsystem has a sector size that is a -multiple of the basic 128-byte unit. The purpose here is to -present a general-purpose algorithm that can be included within -the BIOS and that uses the BDOS information to perform the -operations automatically. -.pp -On each call to WRITE, the BDOS provides the following -information in register C: -.sp -.nf -.in 8 -0 = (normal sector write) -1 = (write to directory sector) -2 = (write to the first sector - of a new data block) -.fi -.in 0 -.pp -Condition 0 occurs whenever the next write operation is into a -previously written area, such as a random mode record update; -when the write is to other than the first sector of an -unallocated block; or when the write is not into the directory -area. Condition 1 occurs when a write into the directory area is -performed. Condition 2 occurs when the first record (only) of a -newly allocated data block is written. In most cases, -application programs read or write multiple 128-byte sectors in -sequence; thus, there is little overhead involved in either -operation when blocking and deblocking records, because preread -operations can be avoided when writing records. -.pp -Appendix G lists the blocking and deblocking algorithms in -skeletal form; this file is included on your CP/M disk. -Generally, the algorithms map all CP/M sector read operations -onto the host disk through an intermediate buffer that is the -size of the host disk sector. Throughout the program, values and -variables that relate to the CP/M sector involved in a seek -operation are prefixed by sek, while those related to the host -disk system are prefixed by hst. The equate statements beginning -on line 29 of Appendix G define the mapping between CP/M and the -host system, and must be changed if other than the sample host -system is involved. -.pp -The entry points BOOT and WBOOT must contain the initialization -code starting on line 57, while the SELDSK entry point must be -augmented by the code starting on line 65. Note that although -the SELDSK entry point computes and returns the Disk Parameter -Header address, it does not physically select the host disk at -this point (it is selected later at READHST or WRITEHST). -Further, SETTRK, SETTRK, and SETMA simply store the values, but -do not take any other action at this point. SECTRAN performs a -trivial function of returning the physical sector number. -.pp -The principal entry points are READ and WRITE, starting on lines -110 and 125, respectively. These subroutines take the place of -your previous READ and WRITE operations. -.pp -The actual physical read or write takes place at either WRITEHST -or READHST, where all values have been prepared: hstdsk is the -host disk number, hsttrk is the host track number, and -hstsec is the host sector number, which -may require translation to physical sector number. You must -insert code at this point that performs the full sector read or write -into or out of the buffer at hstbuf of length hstsiz. All other mapping -functions are performed by the algorithms. -.pp -This particular algorithm was tested using an 80-megabyte hard -disk unit that was originally configured for 128-byte sectors, -producing approximately 35 megabytes of formatted storage. When -configured for 512-byte host sectors, usable storage increased to -57 megabytes, with a corresponding 400% improvement in overall -response. In this situation, there is no apparent overhead -involved in deblocking sectors, with the advantage that user -programs still maintain 128-byte sectors. This is primarily -because of the information provided by the BDOS, which eliminates -the necessity for preread operations. -.sp 2 -.ce -End of Section 6 - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Source/Doc/CPM 22 Manual - Testing/test.tex b/Source/Doc/CPM 22 Manual - Testing/test.tex deleted file mode 100644 index 02ae661e..00000000 --- a/Source/Doc/CPM 22 Manual - Testing/test.tex +++ /dev/null @@ -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 - \ No newline at end of file diff --git a/Source/Doc/CPM 22 Manual - Testing/threea.tex b/Source/Doc/CPM 22 Manual - Testing/threea.tex deleted file mode 100644 index 1a5c666c..00000000 --- a/Source/Doc/CPM 22 Manual - Testing/threea.tex +++ /dev/null @@ -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 - - - - - - \ No newline at end of file diff --git a/Source/Doc/CPM 22 Manual - Testing/threeb.tex b/Source/Doc/CPM 22 Manual - Testing/threeb.tex deleted file mode 100644 index 616e190f..00000000 --- a/Source/Doc/CPM 22 Manual - Testing/threeb.tex +++ /dev/null @@ -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 - \ No newline at end of file diff --git a/Source/Doc/CPM 22 Manual - Testing/two.tex b/Source/Doc/CPM 22 Manual - Testing/two.tex deleted file mode 100644 index e534f9d3..00000000 --- a/Source/Doc/CPM 22 Manual - Testing/two.tex +++ /dev/null @@ -1,1124 +0,0 @@ -.bp 1 -.op -.cs 5 -.mt 5 -.mb 6 -.pl 66 -.ll 65 -.po 10 -.hm 2 -.fm 2 -.he -.ft 2-% -.pc 1 -.tc 2 The CP/M Editor -.ce 2 -.sh -Section 2 -.sp -.sh -The CP/M Editor -.sp 3 -.tc 2.1 Introduction to ED -.he CP/M Operating System Manual 2.1 Introduction to ED -.sh -2.1 Introduction to Ed -.qs -.pp 5 -Ed is the context editor for CP/M, and is used to create and alter CP/M source -files. To start ED, type a command of the following form: -.sp -.nf -.ti 8 -ED filename -or -.ti 8 -ED filename.typ -.fi -.sp -Generally, ED reads segments of the source file given by filename or -filename.typ into the central memory, where you edit the file -and it is subsequently written back to disk after alterations. If the -source file does not exist before editing, it is created by ED and -initialized to empty. The overall operation of Ed is shown in -Figure 2-1. -.sp 2 -.tc 2.1.1 ED Operation -.sh -2.1.1 ED Operation -.qs -.pp -Ed operates upon the source file, shown in Figure 2-1 by x.y, and passes -all text through a memory buffer where the text can be viewed or altered. -The number of lines that can be maintained in the memory buffer varies with -the line length, but has a total capacity of about 5000 characters in a 20K -CP/M system. -.pp -Edited text material is written into a temporary -work file under your command. Upon termination of the edit, the -memory buffer is written to the temporary file, followed by any remaining -(unread) text in the source file. The name of the original file is changed -from x.y to x.BAK so that the most recent edited source file can -be reclaimed if necessary. See the CP/M commands ERASE and RENAME. The -temporary file is then changed from x.$$$ to x.y, which becomes the resulting -edited file. -.pp -The memory buffer is logically between the source file and working file, as -shown in Figure 2-2. -.bp -.sp 27 -.ce -.sh -Figure 2-1. Overall ED Operation -.sp 3 -.nf - Source File Memory Buffer Temporary File - - 1 First Line 1 First Line 1 First Line - 2 Appended 2 Buffered 2 Processed - 3 Lines 3 Text 3 Text - - - - SP MP TP - - - - Unprocessed Next Free Next Free File - Source Append Memory Write Space - Lines Space - - - - SP = Source Pointer - MP = Memory Pointer - TP = Temporary Pointer -.sp 2 -.fi -.ce -.sh -Figure 2-2. Memory Buffer Organization -.bp -.tc 2.1.2 Text Transfer Functions -.sh -2.1.2 Text Transfer Functions -.qs -.pp -Given that n is an integer value in the range 0 through 65535, several -single-letter ED commands transfer lines of text from the source file through -the memory buffer to the temporary (and eventually final) file. Single letter -commands are shown in upper-case, but can be typed in either upper- or -lower-case. -.sp 2 -.ce -.sh -Table 2-1. ED Text Transfer Commands -.sp - Command Result -.sp -.ll 60 -.in 15 -.ti -10 -nA Appends the next n unprocessed source lines from the source file at -SP to the end of the memory buffer at MP. Increment SP and MP by n. If -upper-case translation is set (see the U command) and the A command is typed -in upper-case, all input lines will automatically be translated to upper-case. -.sp -.ti -10 -nW Writes the first n lines of the memory buffer to the temporary -file free space. Shift the remaining lines n+1 through MP to the top of the -memory buffer. Increment TP by n. -.sp -.ti -10 -E Ends the edit. Copy all buffered text to temporary file and copy -all unprocessed source lines to temporary file. Rename files. -.sp -.ti -10 -H Moves to head of new file by performing automatic E command. The -temporary file becomes the new source file, the memory buffer is emptied, and -a new temporary file is created. The effect is equivalent to issuing an E -command, followed by a reinvocation of ED, using x.y as the file to edit. -.sp -.ti -10 -O Returns to original file. The memory buffer is emptied, the -temporary file is deleted, and the SP is returned to position 1 of the -source file. The effects of the previous editing commands are thus nullified. -.sp -.ti -10 -Q Quits edit with no file alterations, returns to CP/M. -.in 0 -.ll 65 -.sp -.pp -There are a number of special cases to consider. If the integer n is omitted -in any ED command where an integer is allowed, then 1 is assumed. Thus, the -commands A and W append one line and write one line, respectively. In -addition, if a pound sign # is given in the place of n, then the integer -65535 is assumed (the largest value for n that is allowed). Because most -source files can be contained entirely in the memory buffer, -the command #A is often issued at the beginning of the edit to read the -entire source file to memory. Similarly, the command #W writes the entire -buffer to the temporary file. -.pp -Two special forms of the A and W commands -are provided as a convenience. The command 0A fills the current memory -buffer at least half full, while 0W writes lines until the buffer is at least -half empty. An error is issued if the memory buffer size is exceeded. -You can then enter any command, such as W, that does not increase -memory requirements. The remainder of any partial line read during the -overflow will be brought into memory on the next successful append. -.sp 2 -.tc 2.1.3 Memory Buffer Organization -.sh -2.1.3 Memory Buffer Organization -.qs -.pp -The memory buffer can be considered a sequence of source lines brought -in with the A command from a source file. The memory buffer has an imaginary -character pointer (CP) that moves throughout the memory buffer -under command of the operator. -.pp -The memory buffer appears logically as shown -in Figure 2-3, where the dashes represent characters of the source line of -indefinite length, terminated by carriage return () and line-feed () -characters, and CP represents the imaginary character pointer. -Note that the CP is always located ahead of the first character of the -first line, behind the last character of the last line, or between two -characters. The current line CL is the source line that contains the CP. -.sp 3 -.nf - Memory Buffer - - - first line ----------------------- - - - ----------------------- - - - current line CL --------------------------- - - - CP - - last line ----------------------- -.sp 2 -.sh - Figure 2-3. Logical Organization of Memory Buffer -.qs -.fi -.sp 5 -.tc 2.1.4 Line Numbers and ED Start-up -.sh -2.1.4 Line Numbers and ED Start-up -.qs -.pp -ED produces absolute line number prefixes that are used to reference a -line or range of lines. The absolute line number is displayed at the -beginning of each line when ED is in insert mode (see the I command in -Section 2.1.5). Each line number takes the form -.sp -.ti 8 -nnnnn: -.sp -where nnnnn is an absolute line number in the range of 1 to 65535. If the -memory buffer is empty or if the current line is at the end of the memory -buffer, nnnnn appears as 5 blanks. -.pp -You can reference an absolute line number by preceding any command by -a number followed by a colon, in the same format as the line number display. -In this case, the ED program moves the current line reference to the absolute -line number, if the line exists in the current memory buffer. The line -denoted by the absolute line number must be in the memory buffer (see the -A command). Thus, the command -.sp -.ti 8 -345:T -.sp -is interpreted as move to absolute 345, and type the line. Absolute line -numbers are produced only during the editing process and are not recorded -with the file. In particular, the line numbers will change following a -deleted or expanded section of text. -.pp -You can also reference an absolute line number as a backward or forward -distance from the current line by preceding the absolute number by a colon. -Thus, the command -.sp -.ti 8 -:400T -.sp -is interpreted as type from the current line number through the line whose -absolute number is 400. Combining the two line reference forms, the -command -.sp -.ti 8 -345::400T -.sp -is interpreted as move to absolute line 345, then type through -absolute line 400. Absolute line references of this sort can precede any -of the standard ED commands. -.pp -Line numbering is controlled by the V (Verify Line Numbers) command. Line -numbering can be turned off by typing the -V command. -.bp -If the file to edit does not exist, ED displays the following message: -.sp -.ti 8 -NEW FILE -.sp -To move text into the memory buffer, you must enter an i command before typing -input lines and terminate each line with a carriage return. A single -CTRL-Z character returns ED to command mode. -.sp 2 -.tc 2.1.5 Memory Buffer Operation -.sh -2.1.5 Memory Buffer Operation -.qs -.pp -When ED begins, the memory buffer is empty. You can either append -lines from the source file with the A command, or enter the lines directly -from the console with the insert command. The insert command takes the -following form: -.sp -.ti 8 -I -.sp -ED then accepts any number of input lines. You must terminate each line with -a (the is supplied automatically). A single CTRL-Z, denoted -by a caret (^)Z, returns ED to command mode. The CP is positioned after the -last character entered. The following sequence: -.sp -.in 8 -.nf -I -NOW IS THE -TIME FOR -ALL GOOD MEN -^Z -.fi -.in 0 -.sp -leaves the memory buffer as -.sp -.in 8 -.nf -NOW IS THE -TIME FOR -ALL GOOD MEN -.fi -.in 0 -.pp -Generally, ED accepts command letters in upper- or lower-case. If the -command is upper-case, all input values associated with the command are -translated to upper-case. If the I command is typed, all -input lines are automatically translated internally to upper-case. The -lower-case form of the i command is most often used to allow both upper- and -lower-case letters to be entered. -.pp -Various commands can be issued that control the CP or display source text -in the vicinity of the CP. The commands shown below with a preceding n -indicate that an optional unsigned value can be specified. When preceded -by +\b_, the command can be unsigned, or have an optional preceding plus or -minus sign. As before, the pound sign # is replaced by 65535. If an -integer n is optional, but not supplied, then n=1 is assumed. Finally, if a -plus sign is optional, but none is specified, then + is assumed. -.bp -.ce -.sh -Table 2-2. Editing Commands -.sp - Command Action -.sp -.ll 60 -.in 15 -.ti -10 -+\b_B Move CP to beginning of memory buffer if + and to bottom if -. -.sp -.ti -10 -+\b_nC Move CP by +\b_n characters (moving ahead if +), counting the - as two characters. -.sp -.ti -10 -+\b_nD Delete n characters ahead of CP if plus and behind CP if minus. -.sp -.ti -10 -+\b_nK Kill (remove) +\b_n lines of source text using CP as the -current reference. If CP is not at the beginning of the current line when K -is issued, the characters before CP remain if + is specified, while the -characters after CP remain if - is given in the command. -.sp -.ti -10 -+\b_nL If n = 0, move CP to the beginning of the current -line, if it is -not already there. If n =\b/ 0, first move the CP to the beginning of the -current line and then move it to the beginning of the line that is n lines -down (if +) or up (if -). The CP will stop at the top or bottom of the -memory buffer if too large a value of n is specified. -.sp -.ti -10 -+\b_nT If n = 0, type the contents of the current line up to CP. If -n = 1, type the contents of the current line from CP to the end of the line. -If n>1, type the current line along with n - 1 lines that follow, if + is -specified. Similarly, if n>1 and - is given, type the previous n lines up to -the CP. Any key can be depressed to abort long type-outs. -.sp -.ti -10 -+\b_n Equivalent to +\b_nLT, which moves up or down and types a -single line. -.in 0 -.ll 65 -.sp 3 -.tc 2.1.6 Command Strings -.sh -2.1.6 Command Strings -.qs -.pp -Any number of commands can be typed contiguously (up to the capacity of -the console buffer) and are executed only after you press the . Table 2-3 -summarizes the CP/M console line-editing commands used to control the input -command line. -.bp -.ce -.sh -Table 2-3. Line-editing Controls -.sp - Command Result -.sp -.ll 60 -.in 16 -.ti -11 -CTRL-C Reboots the CP/M system when typed at the start of a line. -.sp -.ti -11 -CTRL-E Physical end of line: carriage is returned, but line is not sent -until the carriage return key is depressed. -.sp -.ti -11 -CTRL-H Backspaces one character position. -.sp -.ti -11 -CTRL-J Terminates current input (line-feed). -.sp -.ti -11 -CTRL-M Terminates current input (carriage return). -.sp -.ti -11 -CTRL-R Retypes current command line: types a clean line character -deletion with rubouts. -.sp -.ti -11 -CTRL-U Deletes the entire line typed at the console. -.sp -.ti -11 -CTRL-X Same as CTRL-U. -.sp -.ti -11 -CTRL-Z Ends input from the console (used in PIP and ED). -.sp -.ti -11 -rub/del Deletes and echos the last character typed at the -console. -.in 0 -.ll 65 -.sp -.pp -Suppose the memory buffer contains the characters shown in the -previous section, with the CP following the last character of the -buffer. In the following example, the command strings on the left produce -the results shown to the right. Use lower-case command letters to avoid -automatic translation of strings to upper-case. -.sp 2 - Command String Effect -.sp -.fi -.in 20 -.ll 60 -.ti -15 -B2T Move to beginning of the buffer and type two lines: -.nf -.sp -NOW IS THE -TIME FOR -.fi -The result in the memory buffer is -.sp -.nf -NOW IS THE -TIME FOR -ALL GOOD MEN -.fi -.in 0 -.bp - Command String Effect -.in 20 -.sp -.ti -15 -5C0T Move CP five characters and type the beginning of the line NOW -I. The result in the memory buffer is -.sp -NOW I S THE -.sp 2 -.ti -15 -2L-T Move two lines down and type the previous line TIME FOR. -The result in the memory buffer is -.sp -.nf -NOW IS THE -TIME FOR -ALL GOOD MEN -.fi -.sp 2 -.ti -15 --L#K Move up one line, delete 65535 lines that follow. The result -in the memory buffer is -.sp -NOW IS THE -.sp 2 -.ti -15 -I Insert two lines of text with automatic -.ti -15 -TIME TO translation to upper-case. The result in -.ti -15 -INSERT the memory buffer is -.ti -15 -^Z -.sp -.nf -NOW IS THE -TIME TO -INSERT -.fi -.sp 2 -.ti -15 --2L#T Move up two lines and type 65535 lines ahead of CP NOW IS THE. -The result in the memory buffer is -.sp -.nf -NOW IS THE -TIME TO -INSERT -.fi -.sp 2 -.ti -15 - Move down one line and type one line INSERT. The result in -the memory buffer is -.sp -.nf -NOW IS THE -TIME TO -INSERT -.fi -.in 0 -.ll 65 -.bp -.tc 2.1.7 Text Search and Alteration -.sh -2.1.7 Text Search and Alteration -.qs -.pp -ED has a command that locates strings within the memory -buffer. The command takes the form -.sp -.nf -.ti 8 -nF s -or -.ti 8 -nF s ^Z -.fi -.sp -where s represents the string to match, followed by either a -or CTRL-Z, denoted by ^Z. ED starts at the current position -of CP and attempts to match the string. The match is attempted n -times and, if successful, the CP is moved directly after the -string. If the n matches are not successful, the CP is not moved -from its initial position. Search strings can include CTRL-L, -which is replaced by the pair of symbols . -.pp -The following commands illustrate the use of the F command: -.sp 2 - Command String Effect -.in 20 -.sp -.ll 60 -.ti -15 -B#T Move to the beginning and type the entire buffer. The result -in the memory buffer is -.sp -.nf -NOW IS THE -TIME FOR -ALL GOOD MEN -.fi -.sp 2 -.ti -15 -FS T Find the end of the string S T. The result in the memory -buffer is -.nf -.sp -NOW IS T HE -.fi -.sp 2 -.ti -15 -FIs^Z0TT Find the next I and type to the CP; then type the remainder -of the current line ME FOR. The result in the memory buffer is -.nf -.sp -NOW IS THE -TI ME FOR - -ALL GOOD MEN -.fi -.in 0 -.ll 65 -.sp -.pp -An abbreviated form of the insert command is also allowed, which -is often used in conjunction with the F command to make simple -textual changes. The form is -.sp -.ti 8 -.nf -| s ^Z -or -.ti 8 -| s -.fi -.sp -where s is the string to insert. If the insertion string is -terminated by a CTRL-Z, the string is inserted directly following -the CP, and the CP is positioned directly after the string. The -action is the same if the command is followed by a except -that a is automatically inserted into the text following -the string. The following command sequences are examples -of the F and I commands: -.sp 2 - Command String Effect -.in 20 -.ll 60 -.sp -.ti -15 -BITHIS IS ^Z -.sp -Insert THIS IS at the beginning of the text. The result in the -memory buffer is -.sp -THIS IS NOW THE -.nf - -TIME FOR -ALL GOOD MEN -.sp 2 -.fi -.ti -15 -FTIME^Z-4DIPLACE^Z -.sp -Find TIME and delete it; then insert PLACE. The result in the memory -buffer is -.nf -.sp -THIS IS NOW THE -PLACE FOR - -ALL GOOD MEN -.sp 2 -.ti -15 -3FO^Z-3D5D1 -.fi -.ti -15 -CHANGES^Z Find third occurrence of O (that is, the -second O in GOOD), -delete previous 3 characters and the subsequent 5 characters; then insert -CHANGES. The result in the memory buffer is -.nf -.sp -THIS IS NOW THE -PLACE FOR -ALL CHANGES -.fi -.sp 2 -.ti -15 --8CISOURCE -.sp -Move back 8 characters and insert the line SOURCE. The result in the -memory buffer is -.nf -.sp -THIS IS NOW THE -PLACE FOR -ALL SOURCE - CHANGES -.fi -.ll 65 -.in 0 -.sp -.pp -ED also provides a single command that combines the F and I -commands to perform simple string substitutions. The command -takes the following form: -.sp -.nf -.ti 8 -nS s\d1\u^Zs\d2\u -or -.ti 8 -nS s\d1\u^Zs\d2\u ^Z -.fi -.sp -and has exactly the same effect as applying the following command -string a total of n times: -.sp -.nf -.ti 8 -F s\d1\u^Z-kDIs\d2 -or -.ti 8 -F s\d1\u^Z-kDIs\d2\u ^Z -.fi -.sp -where k is the length of the string. ED searches the -memory buffer starting at the current position of CP and -successively substitutes the second string for the first string -until the end of buffer, or until the substitution has been -performed n times. -.pp -As a convenience, a command similar to F is provided by ED that -automatically appends and writes lines as the search proceeds. -The form is -.sp -.nf -.ti 8 -n N s -or -.ti 8 -n N s ^Z -.fi -.sp -which searches the entire source file for the nth occurrence of -the strings (you should recall that F fails if the string -cannot be found in the current buffer). The operation of the N -command is precisely the same as F except in the case that the -string cannot be found within the current memory buffer. In this -case, the entire memory content is written (that is, an automatic #W -is issued). Input lines are then read until the buffer is at -least half full, or the entire source file is exhausted. The -search continues in this manner until the string has been found n -times, or until the source file has been completely transferred to -the temporary file. -.pp -A final line editing function, called the juxtaposition command, -takes the form -.sp -.nf -.ti 8 -n J s\d1\u^Zs\d2\u^Zs\d3\u -or -.ti 8 -n J s\d1\u^Zs\d2\u^Zs\d3\u ^Z -.fi -.sp -with the following action applied n times to the memory buffer: search from -the current CP for the next occurrence of the string s1. If found, -insert the string s2, and move CP to follow s2. Then delete all -characters following CP up to, but not including, the string s\d3\u, leaving -CP directly after s\d2\u. If s\d3\u cannot be found, then no deletion is -made. If the current line is -.sp 4 -.ti 8 -.nf -NOW IS THE TIME -.sp -the command -.sp -.ti 8 -JW ^ZWHAT^Z^1 -.sp -results in -.sp -.ti 8 -NOW WHAT -.fi -.sp -You should recall that ^1 (CTRL-L) represents the pair - in search and substitute strings. -.pp -The number of characters ED allows in the F, S, N, and J -commands is limited to 100 symbols. -.sp 2 -.tc 2.1.8 Source Libraries -.sh -2.1.8 Source Libraries -.qs -.pp -ED also allows the inclusion of source libraries during the -editing process with the R command. The form of this command is -.sp -.nf -.ti 8 -R filename ^Z -or -.ti 8 -R filename -.fi -.sp -where filename is the primary filename of a source file on the -disk with an assumed filetype of LIB. ED reads the specified -file, and places the characters into the memory buffer after CP, -in a manner similar to the I command. Thus, if the command -.sp -.ti 8 -RMACRO -.sp -is issued by the operator, ED reads from the file MACRO.LIB until -the end-of-file and automatically inserts the characters into the -memory buffer. -.pp -ED also includes a block move facility implemented through the -X (Transfer) command. The form -.sp -.ti 8 -nX -.sp -transfers the next n lines from the current line to a temporary -file called -.sp -.ti 8 -X$$$$$$.LIB -.sp -which is active only during the editing process. You can -reposition the current line reference to any portion of -the source file and transfer lines to the temporary file. The -transferred lines accumulate one after another in this file and -can be retrieved by simply typing -.sp -.ti 8 -R -.sp -which is the trivial case of the library read command. In this -case, the entire transferred set of lines is read into the memory -buffer. Note that the X command does not remove -the transferred lines from the memory buffer, although a K -command can be used directly after the X, and the R command does -not empty the transferred LIB file. That is, given that a set of -lines has been transferred with the X command, they can be -reread any number of times back into the source file. The -command -.sp -.ti 8 -0X -.sp -is provided to empty the transferred line file. -.pp -Note that upon normal completion of the ED -program through Q or E, the temporary LIB file is removed. If ED -is aborted with a CTRL-C, the LIB file will exist if lines have -been transferred, but will generally be empty (a subsequent ED -invocation will erase the temporary file). -.sp 2 -.tc 2.1.9 Repetitive Command Execution -.sh -2.1.9 Repetitive Command Execution -.qs -.pp -The macro command M allows you to group ED commands -together for repeated evaluation. The M command takes the following form: -.sp -.nf -.ti 8 -n M CS -or -.ti 8 -n M CS ^Z -.sp -.fi -where CS represents a string of ED commands, not including -another M command. ED executes the command string n times if -n>1. If n=0 or 1, the command string is executed repetitively -until an error condition is encountered (for example, the end of the -memory buffer is reached with an F command). -.pp -As an example, the following macro changes all occurrences of -GAMMA to DELTA within the current buffer, and types each line -that is changed: -.sp -.ti 8 -MFGAMMA^Z-5DIDELTA^Z0TT -.sp -or equivalently -.sp -.ti 8 -MSGAMMA^ZDELTA^Z0TT -.sp 2 -.tc 2.2 ED Error Conditions -.he CP/M Operating System Manual 2.2 ED Error Conditions -.sh -2.2 ED Error Conditions -.qs -.pp -On error conditions, ED prints the message BREAK X AT C where X -is one of the error indicators shown in Table 2-4. -.bp -.ce -.sh -Table 2-4. Error Message Symbols -.sp - Symbol Meaning -.sp -.ll 62 -.in 15 -.ti -10 -? Unrecognized command. -.sp -.ti -10 -> Memory buffer full (use one of the commands D, K, N, S, -or W to remove characters); F, N, or S strings too long. -.sp -.ti -10 -# Cannot apply command the number of times specified -(for example, in F command). -.sp -.ti -10 -O Cannot open LIB file in R command. -.in 0 -.ll 65 -.sp 2 -If there is a disk error, CP/M displays the following message: -.sp -.ti 8 -BDOS ERR on d: BAD SECTOR -.sp -You can choose to ignore the error by pressing RETURN -at the console (in this case, the memory buffer data -should be examined to see if they were incorrectly read), or you -can reset the system with a CTRL-C and reclaim the back-up file -if it exists. The file can be reclaimed by first typing the -contents of the BAK file to ensure that it contains the proper -information. For example, type the following: -.sp -.ti 8 -TYPE x.BAK -.sp -where x is the file being edited. Then remove the primary file -.sp -.ti 8 -ERA x.y -.sp -and rename the BAK file -.sp -.ti 8 -REN x.y=x.BAK -.sp -The file can then be reedited, starting with the previous -version. -.pp -ED also takes file attributes into account. If you -attempt to edit a Read-Only file, the message -.sp -.ti 8 -** FILE IS READ/ONLY ** -.sp -appears at the console. The file can be loaded and examined, but -cannot be altered. You must end the edit -session and use STAT to change the file attribute to R/W. If -the edited file has the system attribute set, the following message: -.sp -.ti 8 -'SYSTEM' FILE NOT ACCESSIBLE -.sp -is displayed and the edit session is aborted. Again, the STAT -program can be used to change the system attribute, if desired. -.sp 2 -.tc 2.3 Control Characters and Commands -.he CP/M Operating System Manual 2.3 Control Characters and Commands -.sh -2.3 Control Characters and Commands -.qs -.pp -Table 2-5 summarizes the control characters and -commands available in ED. -.sp 2 -.ce -.sh -Table 2-5. ED Control Characters -.sp -.ll 60 -.nf - Control Function - Character -.sp -.fi -.in 20 -.ti -16 -CTRL-C System reboot -.sp -.ti -16 -CTRL-E Physical (not actually entered -in command) -.sp -.ti -16 -CTRL-H Backspace -.sp -.ti -16 -CTRL-J Logical tab (cols 1, 9, 16, ...) -.sp -.ti -16 -CTRL-L Logical in search and -substitute strings -.sp -.ti -16 -CTRL-R Repeat line -.sp -.ti -16 -CTRL-U Line delete -.sp -.ti -16 -CTRL-X Line delete -.sp -.ti -16 -CTRL-Z String terminator -.sp -.ti -16 -rub/del Character delete -.sp -.in 0 -.ll 65 -.pp -Table 2-6 summarizes the commands used in ED. -.sp 2 -.ce -.sh -Table 2-6. ED Commands -.sp -.nf - Command Function -.ll 60 -.fi -.sp -.in 20 -.ti -16 - nA Append lines -.sp -.ti -16 - +\b_B Begin or bottom of buffer -.sp -.ti -16 - +\b_nC Move character positions -.sp -.ti -16 - +\b_nD Delete characters -.sp -.ti -16 - E End edit and close files (normal end) -.sp -.ti -16 - nF Find string -.bp -.in 0 -.ll 65 -.ce -.sh -Table 2-6. (continued) -.sp - Command Function -.ll 60 -.in 20 -.sp -.ti -16 - H End edit, close and reopen files -.sp -.ti -16 - I Insert characters, use i if both upper -and lower-case characters are to be entered. -.sp -.ti -16 - nJ Place strings in juxtaposition -.sp -.ti -16 - +\b_nK Kill lines -.sp -.ti -16 - +\b_nL Move down/up lines -.sp -.ti -16 - nM Macro definition -.sp -.ti -16 - nN Find next occurrence with autoscan -.sp -.ti -16 - O Return to original file -.sp -.ti -16 - +\b_nP Move and print pages -.sp -.ti -16 - Q Quit with no file changes -.sp -.ti -16 - R Read library file -.sp -.ti -16 - nS Substitute strings -.sp -.ti -16 - +\b_nT Type lines -.sp -.ti -16 - +\b_U Translate lower- to upper-case if U, -no translation if -U -.sp -.ti -16 - +\b_V Verify line numbers, or show -remaining free character space -.sp -.ti -16 - 0V A special case of the V command, OV, -prints the memory buffer statistics in the form -.sp -free/total -.sp -where free is the number of free bytes in the memory buffer (in -decimal) and total is the size of the memory buffer -.sp -.ti -16 - nW Write lines -.sp -.ti -16 - nZ Wait (sleep) for approximately n -seconds -.sp -.ti -16 - +\b_n Move and type (+\b_nLT). -.in 0 -.ll 65 -.sp -.pp -Because of common typographical errors, ED requires several -potentially disastrous commands to be typed as single letters, -rather than in composite commands. The following commands: -.sp -.nf -.in 3 -o E(end) -o H(head) -o O(original) -o Q(quit) -.fi -.in 0 -.sp -must be typed as single letter commands. -.pp -The commands I, J, M, N, R, and S should be typed as i, j, m, n, -r, and s if both upper- and lower-case characters are used in the -operation, otherwise all characters are converted to upper-case. -When a command is entered in upper-case, ED automatically -converts the associated string to upper-case, and vice versa. -.sp 2 -.ce -End of Section 2 -.nx threea - - - - - \ No newline at end of file diff --git a/Source/Doc/CPM 22 Manual/Build.cmd b/Source/Doc/CPM 22 Manual/Build.cmd deleted file mode 100644 index 601e5b49..00000000 --- a/Source/Doc/CPM 22 Manual/Build.cmd +++ /dev/null @@ -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" \ No newline at end of file diff --git a/Source/Doc/CPM 22 Manual/Clean.cmd b/Source/Doc/CPM 22 Manual/Clean.cmd deleted file mode 100644 index 42d81d19..00000000 --- a/Source/Doc/CPM 22 Manual/Clean.cmd +++ /dev/null @@ -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 diff --git a/Source/Doc/CPM 22 Manual/Main.ltx b/Source/Doc/CPM 22 Manual/Main.ltx deleted file mode 100644 index 09593aeb..00000000 --- a/Source/Doc/CPM 22 Manual/Main.ltx +++ /dev/null @@ -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} \ No newline at end of file diff --git a/Source/Doc/CPM 22 Manual/Main.ltx.bak b/Source/Doc/CPM 22 Manual/Main.ltx.bak deleted file mode 100644 index 9cd1d4e7..00000000 --- a/Source/Doc/CPM 22 Manual/Main.ltx.bak +++ /dev/null @@ -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} \ No newline at end of file diff --git a/Source/Doc/CPM 22 Manual/Strip.ps1 b/Source/Doc/CPM 22 Manual/Strip.ps1 deleted file mode 100644 index d10584bb..00000000 --- a/Source/Doc/CPM 22 Manual/Strip.ps1 +++ /dev/null @@ -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 diff --git a/Source/Doc/CPM 22 Manual/appa.tex b/Source/Doc/CPM 22 Manual/appa.tex deleted file mode 100644 index e6542646..00000000 --- a/Source/Doc/CPM 22 Manual/appa.tex +++ /dev/null @@ -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 - - \ No newline at end of file diff --git a/Source/Doc/CPM 22 Manual/appb.tex b/Source/Doc/CPM 22 Manual/appb.tex deleted file mode 100644 index f8105690..00000000 --- a/Source/Doc/CPM 22 Manual/appb.tex +++ /dev/null @@ -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 - \ No newline at end of file diff --git a/Source/Doc/CPM 22 Manual/appc.tex b/Source/Doc/CPM 22 Manual/appc.tex deleted file mode 100644 index b45311ad..00000000 --- a/Source/Doc/CPM 22 Manual/appc.tex +++ /dev/null @@ -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 ;= + 128 -0211 0c inr 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 , - ;sector in - ;dmaaddr in - -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 - \ No newline at end of file diff --git a/Source/Doc/CPM 22 Manual/appd.tex b/Source/Doc/CPM 22 Manual/appd.tex deleted file mode 100644 index 30424b39..00000000 --- a/Source/Doc/CPM 22 Manual/appd.tex +++ /dev/null @@ -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 - \ No newline at end of file diff --git a/Source/Doc/CPM 22 Manual/appe.tex b/Source/Doc/CPM 22 Manual/appe.tex deleted file mode 100644 index 36a53fbc..00000000 --- a/Source/Doc/CPM 22 Manual/appe.tex +++ /dev/null @@ -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 - ;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 as scratch - ;register - ; to hold the load address increment - -006f 318000 lxi sp,128 ;128 bytes per - ;sector -0072 39 dad sp ; = + - 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 - \ No newline at end of file diff --git a/Source/Doc/CPM 22 Manual/appf.tex b/Source/Doc/CPM 22 Manual/appf.tex deleted file mode 100644 index f34da4f2..00000000 --- a/Source/Doc/CPM 22 Manual/appf.tex +++ /dev/null @@ -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, -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 - - \ No newline at end of file diff --git a/Source/Doc/CPM 22 Manual/appg.tex b/Source/Doc/CPM 22 Manual/appg.tex deleted file mode 100644 index 6848b31f..00000000 --- a/Source/Doc/CPM 22 Manual/appg.tex +++ /dev/null @@ -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 - \ No newline at end of file diff --git a/Source/Doc/CPM 22 Manual/apph.tex b/Source/Doc/CPM 22 Manual/apph.tex deleted file mode 100644 index 90d673d2..00000000 --- a/Source/Doc/CPM 22 Manual/apph.tex +++ /dev/null @@ -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 - \ No newline at end of file diff --git a/Source/Doc/CPM 22 Manual/apph2.tex b/Source/Doc/CPM 22 Manual/apph2.tex deleted file mode 100644 index 89387031..00000000 --- a/Source/Doc/CPM 22 Manual/apph2.tex +++ /dev/null @@ -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 = -.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 - \ No newline at end of file diff --git a/Source/Doc/CPM 22 Manual/appi.tex b/Source/Doc/CPM 22 Manual/appi.tex deleted file mode 100644 index 745b5b2e..00000000 --- a/Source/Doc/CPM 22 Manual/appi.tex +++ /dev/null @@ -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, 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 - \ No newline at end of file diff --git a/Source/Doc/CPM 22 Manual/cpm22tex.zip b/Source/Doc/CPM 22 Manual/cpm22tex.zip deleted file mode 100644 index 6248e534..00000000 Binary files a/Source/Doc/CPM 22 Manual/cpm22tex.zip and /dev/null differ diff --git a/Source/Doc/CPM 22 Manual/fivea.tex b/Source/Doc/CPM 22 Manual/fivea.tex deleted file mode 100644 index cbd6b8f5..00000000 --- a/Source/Doc/CPM 22 Manual/fivea.tex +++ /dev/null @@ -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 - 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 - - - - \ No newline at end of file diff --git a/Source/Doc/CPM 22 Manual/fiveb.tex b/Source/Doc/CPM 22 Manual/fiveb.tex deleted file mode 100644 index ad1ec089..00000000 --- a/Source/Doc/CPM 22 Manual/fiveb.tex +++ /dev/null @@ -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 - \ No newline at end of file diff --git a/Source/Doc/CPM 22 Manual/fivec.tex b/Source/Doc/CPM 22 Manual/fivec.tex deleted file mode 100644 index e0cfc002..00000000 --- a/Source/Doc/CPM 22 Manual/fivec.tex +++ /dev/null @@ -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 - \ No newline at end of file diff --git a/Source/Doc/CPM 22 Manual/fived.tex b/Source/Doc/CPM 22 Manual/fived.tex deleted file mode 100644 index 49bf9f2b..00000000 --- a/Source/Doc/CPM 22 Manual/fived.tex +++ /dev/null @@ -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 - \ No newline at end of file diff --git a/Source/Doc/CPM 22 Manual/foura.tex b/Source/Doc/CPM 22 Manual/foura.tex deleted file mode 100644 index 9f90f979..00000000 --- a/Source/Doc/CPM 22 Manual/foura.tex +++ /dev/null @@ -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 - - - - \ No newline at end of file diff --git a/Source/Doc/CPM 22 Manual/fourb.tex b/Source/Doc/CPM 22 Manual/fourb.tex deleted file mode 100644 index 84f1ac1f..00000000 --- a/Source/Doc/CPM 22 Manual/fourb.tex +++ /dev/null @@ -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 - \ No newline at end of file diff --git a/Source/Doc/CPM 22 Manual/front.tex b/Source/Doc/CPM 22 Manual/front.tex deleted file mode 100644 index 6c6df942..00000000 --- a/Source/Doc/CPM 22 Manual/front.tex +++ /dev/null @@ -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 - \ No newline at end of file diff --git a/Source/Doc/CPM 22 Manual/index.tex b/Source/Doc/CPM 22 Manual/index.tex deleted file mode 100644 index e7f353ec..00000000 --- a/Source/Doc/CPM 22 Manual/index.tex +++ /dev/null @@ -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 - - - \ No newline at end of file diff --git a/Source/Doc/CPM 22 Manual/onea.tex b/Source/Doc/CPM 22 Manual/onea.tex deleted file mode 100644 index 51969d60..00000000 --- a/Source/Doc/CPM 22 Manual/onea.tex +++ /dev/null @@ -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 - - - \ No newline at end of file diff --git a/Source/Doc/CPM 22 Manual/oneb.tex b/Source/Doc/CPM 22 Manual/oneb.tex deleted file mode 100644 index 67ae6beb..00000000 --- a/Source/Doc/CPM 22 Manual/oneb.tex +++ /dev/null @@ -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 - \ No newline at end of file diff --git a/Source/Doc/CPM 22 Manual/onec.tex b/Source/Doc/CPM 22 Manual/onec.tex deleted file mode 100644 index 6ab06cf0..00000000 --- a/Source/Doc/CPM 22 Manual/onec.tex +++ /dev/null @@ -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 -.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 - \ No newline at end of file diff --git a/Source/Doc/CPM 22 Manual/part1.tex b/Source/Doc/CPM 22 Manual/part1.tex deleted file mode 100644 index 7e98c4ef..00000000 --- a/Source/Doc/CPM 22 Manual/part1.tex +++ /dev/null @@ -1,2 +0,0 @@ -.nx front - \ No newline at end of file diff --git a/Source/Doc/CPM 22 Manual/part2.tex b/Source/Doc/CPM 22 Manual/part2.tex deleted file mode 100644 index 75330cc4..00000000 --- a/Source/Doc/CPM 22 Manual/part2.tex +++ /dev/null @@ -1,2 +0,0 @@ -.nx appa.tex - \ No newline at end of file diff --git a/Source/Doc/CPM 22 Manual/part3.tex b/Source/Doc/CPM 22 Manual/part3.tex deleted file mode 100644 index e8e80d7e..00000000 --- a/Source/Doc/CPM 22 Manual/part3.tex +++ /dev/null @@ -1,2 +0,0 @@ -.nx apph.tex - \ No newline at end of file diff --git a/Source/Doc/CPM 22 Manual/sixa.tex b/Source/Doc/CPM 22 Manual/sixa.tex deleted file mode 100644 index 3b594928..00000000 --- a/Source/Doc/CPM 22 Manual/sixa.tex +++ /dev/null @@ -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 - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Source/Doc/CPM 22 Manual/sixb.tex b/Source/Doc/CPM 22 Manual/sixb.tex deleted file mode 100644 index 5ab5e7e7..00000000 --- a/Source/Doc/CPM 22 Manual/sixb.tex +++ /dev/null @@ -1,1311 +0,0 @@ -.bp 13 -.tc 6.6 The BIOS Entry Points -.he CP/M Operating System Manual 6.6 BIOS Entry Points -.sh -6.6 The BIOS Entry Points -.qs -.pp 5 -The entry points into the BIOS from the cold start loader and -BDOS are detailed below. Entry to the BIOS is through a jump -vector located at 4A00H+b, as shown below. See Appendixes A and -B. The jump vector is a sequence of 17 jump -instructions that send program control to the individual BIOS -subroutines. The BIOS subroutines might be empty for certain -functions (they might contain a single RET operation) -during reconfiguration of CP/M, but the entries must be present -in the jump vector. -.pp -The jump vector at 4A00H+b takes the form shown below, where the -individual jump addresses are given to the left: -.mb 4 -.fm 1 -.mt 4 -.hm 1 -.sp 2 -.nf -.in 5 -4A00H+b JMP BOOT ;ARRIVE HERE FROM COLD - START LOAD -.sp -4A03H+b JMP WBOOT ;ARRIVE HERE FOR WARM START - -4A06H+b JMP CONST ;CHECK FOR CONSOLE CHAR - READY - -4A09H+b JMP CONIN ;READ CONSOLE CHARACTER IN - -4A0CH+b JMP CONOUT ;WRITE CONSOLE CHARACTER - OUT - -4A0FH+b JMP LIST ;WRITE LISTING CHARACTER OUT - -4A12H+b JMP PUNCH ;WRITE CHARACTER TO PUNCH - DEVICE - -4A15H+b JMP READER ;READ READER DEVICE - -4A18H+b JMP HOME ;MOVE TO TRACK 00 ON - SELECTED DISK - -4A1BH+b JMP SELDSK ;SELECT DISK DRIVE - -4A1EH+b JMP SETTRK ;SET TRACK NUMBER - -4A21H+b JMP SETSEC ;SET SECTOR NUMBER - -4A24H+b JMP SETDMA ;SET DMA ADDRESS - -4A27H+b JMP READ ;READ SELECTED SECTOR - -4A2AH+b JMP WRITE ;WRITE SELECTED SECTOR - -4A2DH+b JMP LISTST ;RETURN LIST STATUS - -4A30H+b JMP SECTRAN ;SECTOR TRANSLATE - SUBROUTINE -.fi -.in 0 -.sp 2 -.sh - Listing 6-2. BIOS Entry Points -.pp -Each jump address corresponds to a particular subroutine that performs the -specific function, as outlined below. There are three major -divisions in the jump table: the system reinitialization, -which results from calls on BOOT and WBOOT; simple character I/O, -performed by calls on CONST, CONIN, CONOUT, LIST, PUNCH, READER, -and LISTST; and disk I/O, performed by calls on HOME, SELDSK, -SETTRK, SETSEC, SETDMA, READ, WRITE, and SECTRAN. -.pp -All simple character I/O operations are assumed to be performed -in ASCII, upper- and lower-case, with high-order (parity bit) set -to zero. An end-of-file condition for an input device is given -by an ASCII CTRL-Z (1AH). Peripheral devices are seen by CP/M as -logical devices and are assigned to physical devices within the -BIOS. -.pp -To operate, the BDOS needs only the CONST, CONIN, and CONOUT -subroutines. LIST, PUNCH, and READER can be used by PIP, but not -the BDOS. Further, the LISTST entry is currently used only by -DESPOOL, the print spooling utility. Thus, the initial version -of CBIOS can have empty subroutines for the remaining ASCII -devices. -.pp -The following list describes the characteristics of each device. -.sp 2 -.in 5 -.ti -2 -o CONSOLE is the principal interactive console that communicates with the -operator and it is accessed through CONST, CONIN, and CONOUT. Typically, the -CONSOLE is a device such as a CRT or teletype. -.sp -.ti -2 -o LIST is the principal listing device. If it exists on the user's system, -it is usually a hard-copy device, such as a printer or teletype. -.sp -.ti -2 -o PUNCH is the principal tape punching device. If it exists, it is normally a -high-speed paper tape punch or teletype. -.sp -.ti -2 -o READER is the principal tape reading device, such as a simple optical -reader or teletype. -.fi -.in 0 -.sp -.pp -A single peripheral can be assigned as the LIST, PUNCH, and -READER device simultaneously. If no peripheral device is -assigned as the LIST, PUNCH, or READER device, the CBIOS -gives an appropriate error message so that the -system does not hang if the device is accessed by PIP or some -other user program. Alternately, the PUNCH and LIST routines can -just simply return, and the READER routine can return with a 1AH -(CTRL-Z) in register A to indicate immediate end-of-file. -.pp -For added flexibility, you can optionally implement the -IOBYTE function, which allows reassignment of physical devices. -The IOBYTE function creates a mapping of logical-to-physical -devices that can be altered during CP/M processing, -see the STAT command in Section 1.6.1. -.pp -The definition of the IOBYTE function corresponds to the Intel -standard as follows: a single location in memory, currently -location 0003H, is maintained, called IOBYTE, which defines the -logical-to-physical device mapping that is in effect at a -particular time. The mapping is performed by splitting the -IOBYTE into four distinct fields of two bits each, called the -CONSOLE, READER, PUNCH, and LIST fields, as shown in the -following figure. -.sp 2 -.nf - most significant least significant -.sp - IOBYTE AT 003H LIST PUNCH READER CONSOLE -.sp - bits 6,7 bits 4,5 bits 2,3 bits 0,1 -.fi -.sp 2 -.sh - Figure 6-1. IOBYTE Fields -.sp 2 -.pp -The value in each field can be in the range 0-3, defining the -assigned source or destination of each logical device. Table 6-4 -gives the values that can be assigned to each field. -.sp 2 -.sh -.nf - Table 6-4. IOBYTE Field Values -.sp - Value Meaning -.sp - CONSOLE field (bits 0,1) -.sp - 0 console is assigned to the console printer - device (TTY:) - 1 console is assigned to the CRT device (CRT:) - 2 batch mode: use the READER as the CONSOLE input, - and the LIST device as the CONSOLE output (BAT:) - 3 user-defined console device (UC1:) -.sp -.mb 4 -.fm 1 -.mt 4 -.hm 1 - READER field (bits 2,3) -.sp - 0 READER is the teletype device (TTY:) - 1 READER is the high speed reader device (PTR:) - 2 user-defined reader #1 (UR1:) - 3 user-defined reader #2 (UR2:) -.sp - PUNCH field (bits 4,5) -.sp - 0 PUNCH is the teletype device (TTY:) - 1 PUNCH is the high speed punch device (PTP:) - 2 user-defined punch #1 (UP1:) - 3 user-defined punch #2 (UP2:) -.sp - LIST field (bits 6,7) -.sp - 0 LIST is the teletype device (TTY:) - 1 LIST is the CRT device (CRT:) - 2 LIST is the line printer device (LPT:) - 3 user-defined list device (UL1:) -.fi -.bp -.pp -The implementation of the IOBYTE is optional and effects only the -organization of the CBIOS. No CP/M systems use the IOBYTE -(although they tolerate the existence of the IOBYTE at location -0003H) except for PIP, which allows access to the physical -devices, and STAT, which allows logical-physical assignments to -be make or displayed. For more information see Section 1. In -any case the IOBYTE implementation should be omitted until the -basic CBIOS is fully implemented and tested; then you should -add the IOBYTE to increase the facilities. -.mb 6 -.fm 2 -.mt 5 -.hm 2 -.pp -Disk I/O is always performed through a sequence of calls on the -various disk access subroutines that set up the disk number to -access, the track and sector on a particular disk, and the Direct -Memory Access (DMA) address involved in the I/O operation. After -all these parameters have been set up, a call is made to the READ -or WRITE function to perform the actual I/O operation. -.pp -There is often a single call to SELDSK to select a disk drive, -followed by a number of read or write operations to the selected -disk before selecting another drive for subsequent operations. -Similarly, there might be a single call to set the DMA address, -followed by several calls that read or write from the selected -DMA address before the DMA address is changed. The track and -sector subroutines are always called before the READ or WRITE -operations are performed. -.pp -The READ and WRITE routines should perform several retries (10 is -standard) before reporting the error condition to the BDOS. If -the error condition is returned to the BDOS, it reports the -error to the user. The HOME subroutine might or might not actually -perform the track 00 seek, depending upon controller -characteristics; the important point is that track 00 has been -selected for the next operation and is often treated in exactly -the same manner as SETTRK with a parameter of 00. -.pp -The following table describes the exact responsibilities of each -BIOS entry point subroutine. -.sp 2 -.sh - Table 6-5. BIOS Entry Points -.sp - Entry Point Function -.sp -.ll 60 -.in 15 -.ti -9 -BOOT The BOOT entry point gets control from the cold start loader and is -responsible for basic system initialization, including sending a sign-on -message, which can be omitted in the first version. If the IOBYTE function -is implemented, it must be set at this point. The various system parameters -that are set by the WBOOT entry point must be initialized, and control is -transferred to the CCP at 3400+b for further processing. Note that register -C must be set to zero to select drive A. -.in 0 -.bp -.sh - Table 6-5. (continued) -.sp - Entry Point Function -.sp -.in 15 -.ti -9 -WBOOT The WBOOT entry point gets control when a warm start occurs. A warm -start is performed whenever a user program branches to location 0000H, or -when the CPU is reset from the front panel. The CP/M system must be loaded -from the first two tracks of drive A up to, but not including, the BIOS, or -CBIOS, if the user has completed the patch. System parameters must be -initialized as follows: -.sp -.in 32 -.ti -17 -location 0,1,2 Set to JMP WBOOT for warm starts (000H: JMP 4A03H+b) -.sp -.ti -17 -location 3 Set initial value of IOBYTE, if implemented in the CBIOS -.sp -.ti -17 -location 4 High nibble = current user no; low nibble = current drive -.sp -.ti -17 -location 5,6,7 Set to JMP BDOS, which is the primary entry point to CP/M for -transient programs. (0005H: JMP 3C06H+b) -.sp -.in 15 -Refer to Section 6.9 for complete details of page zero use. -Upon completion of the initialization, the WBOOT program must branch to the -CCP at 3400H+b to restart the system. Upon entry to the CCP, register C is -set to the drive to select after system initialization. The WBOOT routine -should read location 4 in memory, verify that is a legal drive, and pass it -to the CCP in register C. -.sp -.ti -9 -CONST You should sample the status of the currently assigned console -device and return 0FFH in register A if a character is ready to read and 00H -in register A if no console characters are ready. -.sp -.ti -9 -CONIN The next console character is read into register A, and the parity -bit is set, high-order bit, to zero. If no console character is ready, -wait until a character is typed before returning. -.in 0 -.bp -.sh - Table 6-5. (continued) -.sp - Entry Point Function -.sp -.in 15 -.ti -9 -CONOUT The character is sent from register C to the console -output device. The character is in ASCII, with high-order parity -bit set to zero. You might want to include a time-out on a -line-feed or carriage return, if the console device requires some -time interval at the end of the line (such as a TI Silent 700 -terminal). You can filter out control characters that cause -the console device to react in a strange way (CTRL-Z causes the -Lear-Seigler terminal to clear the screen, for example). -.sp -.ti -9 -LIST The character is sent from register C to the currently -assigned listing device. The character is in ASCII with zero -parity bit. -.sp -.ti -9 -PUNCH The character is sent from register C to the currently -assigned punch device. The character is in ASCII with zero -parity. -.sp -.ti -9 -READER The next character is read from the currently assigned reader -device into register A with zero parity (high-order bit must be -zero); an end-of-file condition is reported by returning an ASCII -CTRL-Z(1AH). -.sp -.ti -9 -HOME The disk head of the currently selected disk -(initially disk A) is moved to the track 00 position. If the controller -allows access to the track 0 flag from the drive, the head is -stepped until the track 0 flag is detected. If the controller -does not support this feature, the HOME -call is translated into a call to SETTRK with a parameter of 0. -.sp -.ti -9 -SELDSK The disk drive given by register C is selected for further -operations, where register C contains 0 for drive A, 1 for drive B, and so -on up to 15 for drive P (the standard CP/M distribution version supports four -drives). On each disk select, SELDSK must return in HL the base address of a -16-byte area, called the Disk Parameter Header, described in Section 6.10. -For standard floppy disk drives, the contents of the header and associated -tables do not change; thus, the program segment included in the sample CBIOS -performs this operation automatically. -.in 0 -.bp -.sh - Table 6-5. (continued) -.sp - Entry Point Function -.sp -.in 15 -If there is an attempt to select a -nonexistent drive, SELDSK returns HL=0000H as an error indicator. -Although SELDSK must return the header address on each call, it is advisable -to postpone the physical disk select operation until an I/O function (seek, -read, or write) is actually performed, because disk selects often occur -without utimately performing any disk I/O, and many controllers unload -the head of the current disk before selecting the new drive. This -causes an excessive amount of noise and disk wear. The least significant bit -of register E is zero if this is the first occurrence of the drive select -since the last cold or warm start. -.sp -.ti -9 -SETTRK Register BC contains the track number for subsequent disk accesses -on the currently selected drive. The sector number in BC is the same as the -number returned from the SECTRAN entry point. You can choose to seek -the selected track at this time or delay the seek until the next read or -write actually occurs. Register BC can take on values in the range 0-76 -corresponding to valid track numbers for standard floppy disk drives and -0-65535 for nonstandard disk subsystems. -.sp -.ti -9 -SETSEC Register BC contains the sector number, 1 through 26, for subsequent -disk accesses on the currently selected drive. The sector number in BC is -the same as the number returned from the SECTRAN entry point. You can -choose to send this information to the controller at this point or delay -sector selection until a read or write operation occurs. -.mb 4 -.fm 1 -.sp -.ti -9 -SETDMA Register BC contains the DMA (Disk Memory Access) address for -subsequent read or write operations. For example, if B = 00H and C = 80H -when SETDMA is called, all subsequent read operations read their data into -80H through 0FFH and all subsequent write operations get their -data from 80H through 0FFH, until the next call -to SETDMA occurs. The initial DMA address is -assumed to be 80H. The controller need not -actually support Direct Memory Access. If, -for example, all data transfers are through I/O -ports, the CBIOS that is constructed uses -the 128-byte area starting at the selected DMA -address for the memory buffer during the -subsequent read or write operations. -.in 0 -.bp -.sh - Table 6-5. (continued) -.sp - Entry Point Function -.sp -.in 15 -.ti -9 -READ Assuming the drive has been selected, the track -has been set, and the DMA address has been -specified, the READ subroutine attempts to -read one sector based upon these parameters -and returns the following error codes in -register A: -.sp -0 no errors occurred -.sp -1 nonrecoverable error condition occurred -.sp -Currently, CP/M responds only to a zero or nonzero -value as the return code. That is, if the -value in register A is 0, CP/M assumes that the -disk operation was completed properly. IF an -error occurs the CBIOS should attempt -at least 10 retries to see if the error is -recoverable. When an error is reported the BDOS -prints the message BDOS ERR ONx: BAD -SECTOR. The operator then has the option of -pressing a carriage return to ignore the error, or -CTRL-C to abort. -.sp -.ti -9 -WRITE Data is written from the currently -selected DMA address to the currently selected -drive, track, and sector. For floppy disks, the -data should be marked as nondeleted data to -maintain compatibility with other CP/M systems. -The error codes given in the READ command are -returned in register A, with error recovery -attempts as described above. -.mb 6 -.fm 2 -.sp -.ti -9 -LISTST You return the ready status of the list -device used by the DESPOOL program to improve -console response during its operation. The -value 00 is returned in A if the list device is -not ready to accept a character and 0FFH if a -character can be sent to the printer. A 00 -value should be returned if LIST status is not -implemented. -.in 0 -.bp -.sh - Table 6-5. (continued) -.sp - Entry Point Function -.sp -.in 15 -.ti -9 -SECTRAN Logical-to-physical sector -translation is performed to improve the overall response of -CP/M. Standard CP/M systems are shipped with a -skew factor of 6, where six physical sectors are -skipped between each logical read operation. -This skew factor allows enough time between -sectors for most programs to load their buffers -without missing the next sector. In particular -computer systems that use fast processors, -memory, and disk subsystems, the skew factor might -be changed to improve overall response. -However, the user should maintain a single-density -IBM-compatible version of CP/M for -information transfer into and out of the -computer system, using a skew factor of 6. -.sp -In general, SECTRAN receives a logical sector -number relative to zero in BC and a translate -table address in DE. The sector number is used -as an index into the translate table, with the -resulting physical sector number -in HL. For standard systems, the table and -indexing code is provided in the CBIOS and -need not be changed. -.in 0 -.ll 65 -.sp 2 -.tc 6.7 A Sample BIOS -.he CP/M Operating System Manual 6.7 A Sample BIOS -.sh -6.7 A Sample BIOS -.qs -.pp -The program shown in Appendix B can serve as a basis for your -first BIOS. The simplest functions are assumed in this BIOS, so -that you can enter it through a front panel, if absolutely -necessary. You must alter and insert code into the -subroutines for CONST, CONIN, CONOUT, READ, WRITE, and WAITIO -subroutines. Storage is reserved for user-supplied code in these -regions. The scratch area reserved in page zero (see Section -6.9) for the BIOS is used in this program, so that it could be -implemented in ROM, if desired. -.pp -Once operational, this skeletal version can be enhanced to print -the initial sign-on message and perform better error recovery. -The subroutines for LIST, PUNCH, and READER can be filled out and -the IOBYTE function can be implemented. -.sp 2 -.tc 6.8 A Sample Cold Start Loader -.he CP/M Operating System Manual 6.8 A Sample Cold Start Loader -.sh -6.8 A Sample Cold Start Loader -.qs -.pp -The program shown in Appendix E can serve as a basis for a cold -start loader. The disk read function must be supplied by the -user, and the program must be loaded somehow starting at location -0000. Space is reserved for the patch code so that the total -amount of storage required for the cold start loader is 128 -bytes. -.pp -Eventually, you might want to get this -loader onto the first disk sector (track 0, sector 1) and cause -the controller to load it into memory automatically upon system -start up. Alternatively, the cold start loader can be placed -into ROM, and above the CP/M system. In this case, it is -necessary to originate the program at a higher address and key in -a jump instruction at system start up that branches to the -loader. Subsequent warm starts do not require this key-in -operation, because the entry point WBOOT gets control, thus bringing -the system in from disk automatically. The skeletal cold start -loader has minimal error recovery, which might be enhanced in later -versions. -.sp 2 -.tc 6.9 Reserved Locations in Page Zero -.he CP/M Operating System Manual 6.9 Reserved Locations in Page Zero -.sh -6.9 Reserved Locations in Page Zero -.qs -.pp -Main memory page zero, between locations 00H and 0FFH, contains -several segments of code and data that are used during CP/M -processing. The code and data areas are given in the following table. -.sp 2 -.sh - Table 6-6. Reserved Locations in Page Zero -.sp -.nf - Locations Contents -.fi -.sp -.ll 60 -.in 22 -.ti -17 -000H-0002H Contains a jump instruction to the warm start entry location -4A03H+b. This allows a simple programmed restart (JMP 0000H) or manual -restart from the front panel. -.sp -.ti -17 -0003H-0003H Contains the Intel standard IOBYTE is optionally -included in the user's CBIOS (refer to Section 6.6). -.sp -.ti -17 -0004H-0004H Current default drive number (0=A,...,15=P). -.sp -.ti -17 -0005H-0007H Contains a jump instruction to the BDOS and serves two -purposes: JMP 0005H provides the primary entry point to the BDOS, as -described in Chapter 5, and LHLD 0006H brings the address field of the -instruction to the HL register pair. This value is the lowest address in -memory used by CP/M, assuming the CCP is being overlaid. The DDT program -changes the address field to reflect the reduced memory size in debug mode. -.sp -.ti -17 -0008H-0027H Interrupt locations 1 through 5 not used. -.sp -.ti -17 -0030H-0037H Interrupt location 6 (not currently used) is reserved. -.in 0 -.bp -.sh - Table 6-6. (continued) -.sp -.nf - Locations Contents -.fi -.sp -.in 22 -.ti -17 -0038H-003AH Restart 7; contains a jump instruction into the DDT or SID -program when running in debug mode for programmed breakpoints, but is not -otherwise used by CP/M. -.sp -.ti -17 -003BH-003FH Not currently used; reserved. -.sp -.ti -17 -0040H-004FH A 16-byte area reserved for scratch by CBIOS, but is not -used for any purpose in the distribution version of CP/M. -.sp -.ti -17 -0050H-005BH Not currently used; reserved. -.sp -.ti -17 -005CH-007CH Default File Control Block produced for a transient -program by the CCP. -.sp -.ti -17 -007DH-007FH Optional default random record position. -.sp -.ti -17 -0080H-00FFH Default 128-byte disk buffer, also filled with the -command line when a transient is loaded under the CCP. -.in 0 -.ll 65 -.mb 4 -.fm 1 -.sp -.pp -This information is set up for normal operation under the CP/M -system, but can be overwritten by a transient program if the BDOS -facilities are not required by the transient. -.pp -If, for example, a particular program performs only simple I/O -and must begin execution at location 0, it can first be loaded -into the TPA, using normal CP/M facilities, with a small memory -move program that gets control when loaded. The memory move -program must get control from location 0100H, which is the -assumed beginning of all transient programs. The move program can -then proceed to the entire memory image down to location 0 and -pass control to the starting address of the memory load. -.pp -If the BIOS is overwritten or if location 0, containing the warm -start entry point, is overwritten, the operator must bring the -CP/M system back into memory with a cold start sequence. -.sp 2 -.tc 6.10 Disk Parameter Tables -.he CP/M Operating System Manual 6.10 Disk Parameter Tables -.sh -6.10 Disk Parameter Tables -.qs -.pp -Tables are included in the BIOS that describe the particular -characteristics of the disk subsystem used with CP/M. These -tables can be either hand-coded, as shown in the sample CBIOS in -Appendix B, or automatically generated using the DISKDEF macro -library, as shown in Appendix F. The purpose here is to describe -the elements of these tables. -.bp -.pp -In general, each disk drive has an associated (16-byte) disk -parameter header that contains information about the disk drive -and provides a scratch pad area for certain BDOS operations. The -format of the disk parameter header for each drive is shown -in Figure 6-2, where each element is a word (16-bit) value. -.mb 6 -.fm 2 -.sp 3 -.nf -XLT 0000 0000 0000 DIRBUF DPB CSV ALV -16b 16b 16b 16b 16b 16b 16b 16b -.fi -.sp 2 -.sh - Figure 6-2. Disk Parameter Header Format -.sp 2 -.pp -The meaning of each Disk Parameter Header (DPH) element is detailed in Table -6-7. -.sp 2 -.sh - Table 6-7. Disk Parameter Headers -.sp -.nf - Disk Parameter Meaning - Header -.fi -.ll 60 -.sp -.in 20 -.ti -14 -XLT Address of the logical-to-physical translation vector, if used -for this particular drive, or the value 0000H if no sector translation -takes place (that is, the physical and logical sector numbers are the same). -Disk drives with identical sector skew factors share the same translate tables. -.sp -.ti -14 -0000 Scratch pad values for use within the BDOS, initial value is -unimportant. -.sp -.ti -14 -DIRBUF Address of a 128-byte scratch pad area for directory operations -within BDOS. All DPHs address the same scratch pad area. -.sp -.ti -14 -DPB Address of a disk parameter block for this drive. Drives with -identical disk characteristics address the same disk parameter block. -.sp -.ti -14 -CSV Address of a scratch pad area used for software check for -changed disks. This address is different for each DPH. -.sp -.ti -14 -ALV Address of a scratch pad area used by the BDOS to keep disk -storage allocation information. This address is different for each DPH. -.fi -.in 0 -.ll 65 -.bp -.pp -Given n disk drives, the DPHs are arranged in a table whose first row of 16 -bytes corresponds to drive 0, with the last row corresponding to drive n-1. -In the following figure the lable DPBASE defines the base address of the DPH -table. -.sp 3 -.nf - DPBASE: -.sp - 00 XLT 00 0000 0000 0000 DIRBUF DBP 00 CSV 00 ALV 00 -.sp - 01 XLT 01 0000 0000 0000 DIRBUF DBP 01 CSV 01 ALV 01 - . - . - . - n-1 XLTn-1 0000 0000 0000 DIRBUF DBTn-1 CSVn-1 ALVn-1 -.fi -.sp 2 -.sh - Figure 6-3. Disk Parameter Header Table -.sp 2 -.pp -A responsibility of the SELDSK subroutine is to return the base address of -the DPH for the selected drive. The following sequence of operations returns -the table address, with a 0000H returned if the selected drive does not exist. -.sp 2 -.nf -.in 7 - NDISKS EQU 4 ;NUMBER OF DISK DRIVES - ..... - SELDSK: ;SELECT DISK GIVEN BY BC - LSI H,0000H ;ERROR CODE - MOV A,C ;DRIVE OK? - CPI NDISKS ;CY IF SO - RNC ;RET IF ERROR - ;NO ERROR, CONTINUE - MOV L,C ;LOW(DISK) - MOV H,B ;HIGH(DISK) - DAD H ;*2 - DAD H ;*4 - DAD H ;*8 - DAD H ;*16 - LXI D,DPBASE;FIRST DPH - DAD D ;DPH(DISK) - RET -.fi -.in 0 -.sp -.pp -The translation vectors, XLT 00 through XLTn-1, are located elsewhere in -the BIOS, and simply correspond one-for-one with the logical sector numbers -zero through the sector count 1. The Disk Parameter Block (DPB) for each -drive is more complex. As shown in Figure 6-4, particular DPB, that is -addressed by one or more DPHs, takes the general form: -.sp 3 -.nf - SPT BSH BLM EXM DSM DRM AL0 AL1 CKS 0FF - 16b 8b 8b 8b 16b 16b 8b 8b 16b 16b -.fi -.sp 2 -.sh - Figure 6-4. Disk Parameter Block Format -.sp 3 -where each is a byte or word value, as shown by the 8b or 16b indicator below -the field. -.pp -The following field abbreviations are used in Figure 6-4: -.sp 2 -.in 5 -.ti -2 -o SPT is the total number of sectors per track. -.sp -.ti -2 -o BSH is the data allocation block shift factor, determined by the data -block allocation size. -.sp -.ti -2 -o BLM is the data allocation block mask (2[BSH-1]). -.sp -.ti -2 -o EXM is the extent mask, determined by the data block allocation -size and the number of disk blocks. -.sp -.ti -2 -o DSM determines the total storage capacity of the disk drive. -.sp -.ti -2 -o DRM determines the total number of directory entries that can be -stored on this drive. AL0, AL1 determine reserved directory blocks. -.sp -.ti -2 -o CKS is the size of the directory check vector. -.sp -.ti -2 -o 0FF is the number of reserved tracks at the beginning of the -(logical) disk. -.fi -.in 0 -.sp -The values of BSH and BLM determine the data allocation size BLS, -which is not an entry in the DPB. Given that the designer has selected a -value for BLS, the values of BSH and BLM are shown Table 6-8. -.sp 2 -.sh - Table 6-8. BSH and BLM Values -.nf -.sp -.in 18 - BLS BSH BLM -.sp - 1024 3 7 - 2048 4 15 - 4096 5 31 - 8192 6 63 -16,384 7 127 -.fi -.in 0 -.sp 2 -where all values are in decimal. The value of EXM depends upon both the BLS -and whether the DSM value is less than 256 or greater than 255, as shown in -Table 6-9. -.bp -.sh - Table 6-9. EXM Values -.nf -.sp - BLS EXM values -.sp -.in 18 - DSM<256 DSM>255 -.sp - 1024 0 N/A - 2048 1 0 - 4096 3 1 - 8192 7 3 -16,384 15 7 -.fi -.in 0 -.sp -.pp -The value of DSM is the maximum data block number supported by this -particular drive, measured in BLS units. The product (DSM+1) is the -total number of bytes held by the drive and must be within the -capacity of the physical disk, not counting the reserved operating system -tracks. -.pp -The DRM entry is the one less than the total number of directory entries -that can take on a 16-bit value. The values of AL0 and AL1, however, are -determined by DRM. The values AL0 and AL1 can together be considered a -string of 16-bits, as shown in Figure 6-5. -.sp 3 -.nf - AL0 AL1 - - 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 -.fi -.sp 2 -.sh - Figure 6-5. AL0 and AL1 -.sp 2 -.pp -Position 00 corresponds to the high-order bit of the byte -labeled AL0 and 15 corresponds to the low-order bit of the byte -labeled AL1. Each bit position reserves a data block for number -of directory entries, thus allowing a total of 16 data blocks to -be assigned for directory entries (bits are assigned starting at -00 and filled to the right until position 15). Each directory -entry occupies 32 bytes, resulting in the following tabulation: -.sp 2 -.sh - Table 6-10. BLS Tabulation -.sp -.nf -.in 18 - BLS Directory Entries -.sp - 1024 32 times # bits - 2048 64 times # bits - 4096 128 times # bits - 8192 256 times # bits -16,384 512 times # bits -.fi -.in 0 -.bp -.pp -Thus, if DRM = 127 (128 directory entries) and BLS = 1024, there -are 32 directory entries per block, requiring 4 reserved blocks. -In this case, the 4 high-order bits of AL0 are set, resulting in -the values AL0 = 0F0H and AL1 = 00H. -.pp -The CKS value is determined as follows: if the disk drive media is -removable, then CKS = (DRM+1)/4, where DRM is the last directory -entry number. If the media are fixed, then set CKS = 0 (no -directory records are checked in this case). -.pp -Finally, the 0FF field determines the number of tracks that are -skipped at the beginning of the physical disk. This value is -automatically added whenever SETTRK is called and can be used as -a mechanism for skipping reserved operating system tracks or for -partitioning a large disk into smaller segmented sections. -.pp -To complete the discussion of the DPB, several DPHs can address -the same DPB if their drive characteristics are identical. -Further, the DPB can be dynamically changed when a new drive is -addressed by simply changing the pointer in the DPH; because the -BDOS copies the DPB values to a local area whenever the SELDSK -function is invoked. -.pp -Returning back to DPH for a particular drive, the two address -values CSV and ALV remain. Both addresses reference an area of -uninitialized memory following the BIOS. The areas must be -unique for each drive, and the size of each area is determined by -the values in the DPB. -.pp -The size of the area addressed by CSV is CKS bytes, which is -sufficient to hold the directory check information for this -particular drive, If CKS = (DRM+1)/4, you must reserve (DRM+1)/4 -bytes for directory check use. If CKS = 0, no storage is -reserved. -.pp -The size of the area addressed by ALV is determined by the -maximum number of data blocks allowed for this particular disk -and is computed as (DSM/8)+1. -.pp -The CBIOS shown in Appendix B demonstrates an instance of these -tables for standard 8-inch, single-density drives. It might be -useful to examine this program and compare the tabular values -with the definitions given above. -.sp 2 -.tc 6.11 The DISKDEF Macro Library -.he CP/M Operating System Manual 6.11 The DISKDEF Macro Library -.sh -6.11 The DISKDEF Macro Library -.qs -.pp -A macro library called DISKDEF (shown in Appendix F), greatly -simplifies the table construction process. You must have access -to the MAC macro assembler, of course, to use the DISKDEF -facility, while the macro library is included with all CP.M 2 -distribution disks. -.bp -.pp -A BIOS disk definition consists of the following sequence of -macro statements: -.sp -.nf -.in 7 - MACLIB DISKDEF - ..... - DISKS n - DISKDEF 0,... - DISKDEF 1,... - ..... - DISKDEF n-1 - ..... - ENDEF -.fi -.in 0 -.sp -where the MACLIB statement loads the DISKDEF.LIB file, on the -same disk as the BIOS, into MAC's internal tables. The DISKS -macro call follows, which specifies the number of drives to be -configured with the user's system, where n is an integer in the -range 1 to 16. A series of DISKDEF macro calls then follow that -define the characteristics of each logical disk, 0 through n-1, -corresponding to logical drives A through P. The DISKS and -DISKDEF macros generate the in-line fixed data tables described -in the previous section and thus must be placed in a -nonexecutable portion of the BIOS, typically directly following -the BIOS jump vector. -.pp -The remaining portion of the BIOS is defined following the -DISKDEF macros, with the ENDEF macro call immediately preceding -the END statement. The ENDEF (End of Diskdef) macro generates -the necessary uninitialized RAM areas that are located in -memory above the BIOS. -.pp -The DISKDEF macro call takes the form: -.sp -.ti 8 -DISKDEF dn,fsc,lsc,[skf],bls dks,dir,cks,ofs,[0] -.sp -where -.sp -.in 5 -.ti -2 -o dn is the logical disk number, 0 to n-1. -.ti -2 -o fsc is the first physical sector number (0 or 1). -.ti -2 -o lsc is the last sector number. -.ti -2 -o skf is the optional sector skew factor. -.ti -2 -o bls is the data allocation block size. -.ti -2 -o dks is the number of blocks on the disk. -.ti -2 -o dir is the number of directory entries. -.ti -2 -o cks is the number of checked directory entries. -.ti -2 -o ofs is the track offset to logical track 00. -.ti -2 -o [0] is an optional 1.4 compatibility flag. -.fi -.in 0 -.sp -.pp -The value dn is the drive number being defined with this DISKDEF -macro invocation. The fsc parameter accounts for differing -sector numbering systems and is usually 0 to 1. The lsc is the -last numbered sector on a track. When present, the skf parameter -defines the sector skew factor, which is used to create a sector -translation table according to the skew. -.pp -If the number of sectors is less than 256, a single-byte table is -created, otherwise each translation table element occupies two -bytes. No translation table is created if the skf parameter is -omitted, or equal to 0. -.pp -The bls parameter specifies the number of bytes allocated to each -data block, and takes on the values 1024, 2048, 4096, 8192, or -16384. Generally, performance increases with larger data block -sizes because there are fewer directory references, and logically -connected data records are physically close on the disk. -Further, each directory entry addresses more data and the BIOS-resident -RAM space is reduced. -.pp -The dks parameter specifies the total disk size in bls units. -That is, if the bls = 2048 and dks = 1000, the total disk -capacity is 2,048,000 bytes. If dks is greater than 255, the -block size parameter bls must be greater than 1024. The value of -dir is the total number of directory entries that might exceed -255, if desired. -.pp -The cks parameter determines the number of directory items to -check on each directory scan and is used internally to detect -changed disks during system operation, where an intervening cold -or warm start has not occurred. When this situation is detected, -CP/M automatically marks the disk Read-Only so that data is not -subsequently destroyed. -.pp -As stated in the previous section, the value of cks = dir when -the medium is easily changed, as is the case with a floppy disk -subsystem. If the disk is permanently mounted, the value of cks -is typically 0, because the probability of changing disks without a -restart is low. -.pp -The ofs value determines the number of tracks to skip when this -particular drive is addressed, which can be used to reserve -additional operating system space or to simulate several logical -drives on a single large capacity physical drive. -Finally, the [0] parameter is included when file compatibility is -required with versions of 1.4 that have been modified for higher -density disks. This parameter ensures that only 16K is allocated -for each directory record, as was the case for previous versions. -Normally, this parameter is not included. -.pp -For convenience and economy of table space, the special form: -.sp -.ti 8 -DISKDEF i,j -.sp -gives disk i the same characteristics as a previously defined -drive j. A standard four-drive, single-density system, which is -compatible with version 1.4, is defined using the following macro -invocations: -.sp -.nf -.in 7 - DISKS 4 - DISKDEF 0,1,26,6,1024,243,64,2 - DISKDEF 1,0 - DISKDEF 2,0 - DISKDEF 3,0 - .... - ENDEF -.fi -.in 0 -.sp -with all disks having the same parameter values of 26 sectors per -track, numbered 1 through 26, with 6 sectors skipped between each -access, 1024 bytes per data block, 243 data blocks for a total of -243K-byte disk capacity, 64 checked directory entries, and two -operating system tracks. -.pp -The DISKS macro generates n DPHs, starting at the DPH table -address DPBASE generated by the macro. Each disk header block -contains sixteen bytes, as described above, and correspond -one-for-one to each of the defined drives. In the four-drive -standard system, for example, the DISKS macro generates a table -of the form: -.sp -.nf -.in 5 -DPBASE EQU$ -DPE0: DW XLT0,0000H,0000H,0000H,DIRBUF,DPB0,CSV0,ALV0 -DPE1: DW XLT0,0000H,0000H,0000H,DIRBUF,DPB0,CSV1,ALV1 -DPE2: DW XLT0,0000H,0000H,0000H,DIRBUF,DPB0,CSV2,ALV2 -DPE3: DW XLT0,0000H,0000H,0000H,DIRBUF,DPB0,CSV3,ALV3 -.fi -.in 0 -.sp -where the DPH labels are included for reference purposes to show -the beginning table addresses for each drive 0 through 3. The -values contained within the DPH are described in detail in the -previous section. The check and allocation vector addresses are -generated by the ENDEF macro in the ram area following the BIOS -code and tables. -.pp -Note that if the skf (skew factor) parameter is -omitted, or equal to 0, the translation table is omitted and a -0000H value is inserted in the XLT position of the DPH for the -disk. In a subsequent call to perform the logical-to-physical -translation, SECTRAN receives a translation table address of DE = -0000H and simply returns the original logical sector from BC in -the HL register pair. -.pp -A translate table is constructed when the skf parameter is -present, and the (nonzero) table address is placed into the -corresponding DPHs. The following for example, is constructed -when the standard skew factor skf = 6 is specified in the DISKDEF -macro call: -.sp -.nf -.in 8 -XLT0: DB 1,7,13,19,25,5,11,17,23,3,9,15,21 - DB 2,8,14,20,26,6,12,18,24,4,10,16,22 -.fi -.in 0 -.pp -Following the ENDEF macro call, a number of uninitialized data -areas are defined. These data areas need not be a part of the BIOS -that is loaded upon cold start, but must be available between the -BIOS and the end of memory. The size of the uninitialized RAM -area is determined by EQU statements generated by the ENDEF macro. -For a standard four-drive system, the ENDEF macro might produce -the following EQU statement: -.bp -.nf -.in 8 -4C72 = BEGDAT EQU $ - (data areas) -.sp -4DB0 = ENDDAT EQU $ -.sp -013C = DATSIZ EQU $-BEGDAT -.fi -.in 0 -.sp -which indicates that uninitialized RAM begins at location 4C72H, -ends at 4DB0H-1, and occupies 013CH bytes. You must ensure -that these addresses are free for use after the system is loaded. -.pp -After modification, you can use the STAT program to -check drive characteristics, because STAT uses the disk parameter -block to decode the drive information. A STAT command of the form: -.sp -.ti 8 -STAT d:DSK: -.sp -decodes the disk parameter block for drive d (d=A,...,P) and -displays the following values: -.sp 2 -.nf -.in 8 -r: 128-byte record capacity -k: kilobyte drive capacity -d: 32-byte directory entries -c: checked directory entries -e: records/extent -b: records/block -s: sectors/track -t: reserved tracks -.fi -.in 0 -.sp -.pp -Three examples of DISKDEF macro invocations are shown below with -corresponding STAT parameter values. The last example produces a full -8-megabyte system. -.sp -.nf -.in 8 - DISKDEF 0,1,58,,2048,256,128,128,2 -r=4096, k=512, d=128, c=128, e=256, b=16, s=58, t=2 -.sp - DISKDEF 0,1,58,,2048,1024,300,0,2 -r=16348, k=2048, d=300, c=0, e=128, b=16, s=58, t=2 -.sp - DISKDEF 0,1,58,,16348,512,128,128,2 -r=65536, k=8192, d=128, c=128, e=1024, b=128, s=58, t=2 -.fi -.in 0 -.sp 2 -.tc 6.12 Sector Blocking and Deblocking -.he CP/M Operating System Manual 6.12 Blocking and Deblocking -.sh -6.12 Sector Blocking and Deblocking -.qs -.pp -Upon each call to BIOS WRITE entry point, the CP/M BDOS includes -information that allows effective sector blocking and deblocking -where the host disk subsystem has a sector size that is a -multiple of the basic 128-byte unit. The purpose here is to -present a general-purpose algorithm that can be included within -the BIOS and that uses the BDOS information to perform the -operations automatically. -.pp -On each call to WRITE, the BDOS provides the following -information in register C: -.sp -.nf -.in 8 -0 = (normal sector write) -1 = (write to directory sector) -2 = (write to the first sector - of a new data block) -.fi -.in 0 -.pp -Condition 0 occurs whenever the next write operation is into a -previously written area, such as a random mode record update; -when the write is to other than the first sector of an -unallocated block; or when the write is not into the directory -area. Condition 1 occurs when a write into the directory area is -performed. Condition 2 occurs when the first record (only) of a -newly allocated data block is written. In most cases, -application programs read or write multiple 128-byte sectors in -sequence; thus, there is little overhead involved in either -operation when blocking and deblocking records, because preread -operations can be avoided when writing records. -.pp -Appendix G lists the blocking and deblocking algorithms in -skeletal form; this file is included on your CP/M disk. -Generally, the algorithms map all CP/M sector read operations -onto the host disk through an intermediate buffer that is the -size of the host disk sector. Throughout the program, values and -variables that relate to the CP/M sector involved in a seek -operation are prefixed by sek, while those related to the host -disk system are prefixed by hst. The equate statements beginning -on line 29 of Appendix G define the mapping between CP/M and the -host system, and must be changed if other than the sample host -system is involved. -.pp -The entry points BOOT and WBOOT must contain the initialization -code starting on line 57, while the SELDSK entry point must be -augmented by the code starting on line 65. Note that although -the SELDSK entry point computes and returns the Disk Parameter -Header address, it does not physically select the host disk at -this point (it is selected later at READHST or WRITEHST). -Further, SETTRK, SETTRK, and SETMA simply store the values, but -do not take any other action at this point. SECTRAN performs a -trivial function of returning the physical sector number. -.pp -The principal entry points are READ and WRITE, starting on lines -110 and 125, respectively. These subroutines take the place of -your previous READ and WRITE operations. -.pp -The actual physical read or write takes place at either WRITEHST -or READHST, where all values have been prepared: hstdsk is the -host disk number, hsttrk is the host track number, and -hstsec is the host sector number, which -may require translation to physical sector number. You must -insert code at this point that performs the full sector read or write -into or out of the buffer at hstbuf of length hstsiz. All other mapping -functions are performed by the algorithms. -.pp -This particular algorithm was tested using an 80-megabyte hard -disk unit that was originally configured for 128-byte sectors, -producing approximately 35 megabytes of formatted storage. When -configured for 512-byte host sectors, usable storage increased to -57 megabytes, with a corresponding 400% improvement in overall -response. In this situation, there is no apparent overhead -involved in deblocking sectors, with the advantage that user -programs still maintain 128-byte sectors. This is primarily -because of the information provided by the BDOS, which eliminates -the necessity for preread operations. -.sp 2 -.ce -End of Section 6 - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Source/Doc/CPM 22 Manual/test.tex b/Source/Doc/CPM 22 Manual/test.tex deleted file mode 100644 index 02ae661e..00000000 --- a/Source/Doc/CPM 22 Manual/test.tex +++ /dev/null @@ -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 - \ No newline at end of file diff --git a/Source/Doc/CPM 22 Manual/threea.tex b/Source/Doc/CPM 22 Manual/threea.tex deleted file mode 100644 index 1a5c666c..00000000 --- a/Source/Doc/CPM 22 Manual/threea.tex +++ /dev/null @@ -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 - - - - - - \ No newline at end of file diff --git a/Source/Doc/CPM 22 Manual/threeb.tex b/Source/Doc/CPM 22 Manual/threeb.tex deleted file mode 100644 index 616e190f..00000000 --- a/Source/Doc/CPM 22 Manual/threeb.tex +++ /dev/null @@ -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 - \ No newline at end of file diff --git a/Source/Doc/CPM 22 Manual/two.tex b/Source/Doc/CPM 22 Manual/two.tex deleted file mode 100644 index e534f9d3..00000000 --- a/Source/Doc/CPM 22 Manual/two.tex +++ /dev/null @@ -1,1124 +0,0 @@ -.bp 1 -.op -.cs 5 -.mt 5 -.mb 6 -.pl 66 -.ll 65 -.po 10 -.hm 2 -.fm 2 -.he -.ft 2-% -.pc 1 -.tc 2 The CP/M Editor -.ce 2 -.sh -Section 2 -.sp -.sh -The CP/M Editor -.sp 3 -.tc 2.1 Introduction to ED -.he CP/M Operating System Manual 2.1 Introduction to ED -.sh -2.1 Introduction to Ed -.qs -.pp 5 -Ed is the context editor for CP/M, and is used to create and alter CP/M source -files. To start ED, type a command of the following form: -.sp -.nf -.ti 8 -ED filename -or -.ti 8 -ED filename.typ -.fi -.sp -Generally, ED reads segments of the source file given by filename or -filename.typ into the central memory, where you edit the file -and it is subsequently written back to disk after alterations. If the -source file does not exist before editing, it is created by ED and -initialized to empty. The overall operation of Ed is shown in -Figure 2-1. -.sp 2 -.tc 2.1.1 ED Operation -.sh -2.1.1 ED Operation -.qs -.pp -Ed operates upon the source file, shown in Figure 2-1 by x.y, and passes -all text through a memory buffer where the text can be viewed or altered. -The number of lines that can be maintained in the memory buffer varies with -the line length, but has a total capacity of about 5000 characters in a 20K -CP/M system. -.pp -Edited text material is written into a temporary -work file under your command. Upon termination of the edit, the -memory buffer is written to the temporary file, followed by any remaining -(unread) text in the source file. The name of the original file is changed -from x.y to x.BAK so that the most recent edited source file can -be reclaimed if necessary. See the CP/M commands ERASE and RENAME. The -temporary file is then changed from x.$$$ to x.y, which becomes the resulting -edited file. -.pp -The memory buffer is logically between the source file and working file, as -shown in Figure 2-2. -.bp -.sp 27 -.ce -.sh -Figure 2-1. Overall ED Operation -.sp 3 -.nf - Source File Memory Buffer Temporary File - - 1 First Line 1 First Line 1 First Line - 2 Appended 2 Buffered 2 Processed - 3 Lines 3 Text 3 Text - - - - SP MP TP - - - - Unprocessed Next Free Next Free File - Source Append Memory Write Space - Lines Space - - - - SP = Source Pointer - MP = Memory Pointer - TP = Temporary Pointer -.sp 2 -.fi -.ce -.sh -Figure 2-2. Memory Buffer Organization -.bp -.tc 2.1.2 Text Transfer Functions -.sh -2.1.2 Text Transfer Functions -.qs -.pp -Given that n is an integer value in the range 0 through 65535, several -single-letter ED commands transfer lines of text from the source file through -the memory buffer to the temporary (and eventually final) file. Single letter -commands are shown in upper-case, but can be typed in either upper- or -lower-case. -.sp 2 -.ce -.sh -Table 2-1. ED Text Transfer Commands -.sp - Command Result -.sp -.ll 60 -.in 15 -.ti -10 -nA Appends the next n unprocessed source lines from the source file at -SP to the end of the memory buffer at MP. Increment SP and MP by n. If -upper-case translation is set (see the U command) and the A command is typed -in upper-case, all input lines will automatically be translated to upper-case. -.sp -.ti -10 -nW Writes the first n lines of the memory buffer to the temporary -file free space. Shift the remaining lines n+1 through MP to the top of the -memory buffer. Increment TP by n. -.sp -.ti -10 -E Ends the edit. Copy all buffered text to temporary file and copy -all unprocessed source lines to temporary file. Rename files. -.sp -.ti -10 -H Moves to head of new file by performing automatic E command. The -temporary file becomes the new source file, the memory buffer is emptied, and -a new temporary file is created. The effect is equivalent to issuing an E -command, followed by a reinvocation of ED, using x.y as the file to edit. -.sp -.ti -10 -O Returns to original file. The memory buffer is emptied, the -temporary file is deleted, and the SP is returned to position 1 of the -source file. The effects of the previous editing commands are thus nullified. -.sp -.ti -10 -Q Quits edit with no file alterations, returns to CP/M. -.in 0 -.ll 65 -.sp -.pp -There are a number of special cases to consider. If the integer n is omitted -in any ED command where an integer is allowed, then 1 is assumed. Thus, the -commands A and W append one line and write one line, respectively. In -addition, if a pound sign # is given in the place of n, then the integer -65535 is assumed (the largest value for n that is allowed). Because most -source files can be contained entirely in the memory buffer, -the command #A is often issued at the beginning of the edit to read the -entire source file to memory. Similarly, the command #W writes the entire -buffer to the temporary file. -.pp -Two special forms of the A and W commands -are provided as a convenience. The command 0A fills the current memory -buffer at least half full, while 0W writes lines until the buffer is at least -half empty. An error is issued if the memory buffer size is exceeded. -You can then enter any command, such as W, that does not increase -memory requirements. The remainder of any partial line read during the -overflow will be brought into memory on the next successful append. -.sp 2 -.tc 2.1.3 Memory Buffer Organization -.sh -2.1.3 Memory Buffer Organization -.qs -.pp -The memory buffer can be considered a sequence of source lines brought -in with the A command from a source file. The memory buffer has an imaginary -character pointer (CP) that moves throughout the memory buffer -under command of the operator. -.pp -The memory buffer appears logically as shown -in Figure 2-3, where the dashes represent characters of the source line of -indefinite length, terminated by carriage return () and line-feed () -characters, and CP represents the imaginary character pointer. -Note that the CP is always located ahead of the first character of the -first line, behind the last character of the last line, or between two -characters. The current line CL is the source line that contains the CP. -.sp 3 -.nf - Memory Buffer - - - first line ----------------------- - - - ----------------------- - - - current line CL --------------------------- - - - CP - - last line ----------------------- -.sp 2 -.sh - Figure 2-3. Logical Organization of Memory Buffer -.qs -.fi -.sp 5 -.tc 2.1.4 Line Numbers and ED Start-up -.sh -2.1.4 Line Numbers and ED Start-up -.qs -.pp -ED produces absolute line number prefixes that are used to reference a -line or range of lines. The absolute line number is displayed at the -beginning of each line when ED is in insert mode (see the I command in -Section 2.1.5). Each line number takes the form -.sp -.ti 8 -nnnnn: -.sp -where nnnnn is an absolute line number in the range of 1 to 65535. If the -memory buffer is empty or if the current line is at the end of the memory -buffer, nnnnn appears as 5 blanks. -.pp -You can reference an absolute line number by preceding any command by -a number followed by a colon, in the same format as the line number display. -In this case, the ED program moves the current line reference to the absolute -line number, if the line exists in the current memory buffer. The line -denoted by the absolute line number must be in the memory buffer (see the -A command). Thus, the command -.sp -.ti 8 -345:T -.sp -is interpreted as move to absolute 345, and type the line. Absolute line -numbers are produced only during the editing process and are not recorded -with the file. In particular, the line numbers will change following a -deleted or expanded section of text. -.pp -You can also reference an absolute line number as a backward or forward -distance from the current line by preceding the absolute number by a colon. -Thus, the command -.sp -.ti 8 -:400T -.sp -is interpreted as type from the current line number through the line whose -absolute number is 400. Combining the two line reference forms, the -command -.sp -.ti 8 -345::400T -.sp -is interpreted as move to absolute line 345, then type through -absolute line 400. Absolute line references of this sort can precede any -of the standard ED commands. -.pp -Line numbering is controlled by the V (Verify Line Numbers) command. Line -numbering can be turned off by typing the -V command. -.bp -If the file to edit does not exist, ED displays the following message: -.sp -.ti 8 -NEW FILE -.sp -To move text into the memory buffer, you must enter an i command before typing -input lines and terminate each line with a carriage return. A single -CTRL-Z character returns ED to command mode. -.sp 2 -.tc 2.1.5 Memory Buffer Operation -.sh -2.1.5 Memory Buffer Operation -.qs -.pp -When ED begins, the memory buffer is empty. You can either append -lines from the source file with the A command, or enter the lines directly -from the console with the insert command. The insert command takes the -following form: -.sp -.ti 8 -I -.sp -ED then accepts any number of input lines. You must terminate each line with -a (the is supplied automatically). A single CTRL-Z, denoted -by a caret (^)Z, returns ED to command mode. The CP is positioned after the -last character entered. The following sequence: -.sp -.in 8 -.nf -I -NOW IS THE -TIME FOR -ALL GOOD MEN -^Z -.fi -.in 0 -.sp -leaves the memory buffer as -.sp -.in 8 -.nf -NOW IS THE -TIME FOR -ALL GOOD MEN -.fi -.in 0 -.pp -Generally, ED accepts command letters in upper- or lower-case. If the -command is upper-case, all input values associated with the command are -translated to upper-case. If the I command is typed, all -input lines are automatically translated internally to upper-case. The -lower-case form of the i command is most often used to allow both upper- and -lower-case letters to be entered. -.pp -Various commands can be issued that control the CP or display source text -in the vicinity of the CP. The commands shown below with a preceding n -indicate that an optional unsigned value can be specified. When preceded -by +\b_, the command can be unsigned, or have an optional preceding plus or -minus sign. As before, the pound sign # is replaced by 65535. If an -integer n is optional, but not supplied, then n=1 is assumed. Finally, if a -plus sign is optional, but none is specified, then + is assumed. -.bp -.ce -.sh -Table 2-2. Editing Commands -.sp - Command Action -.sp -.ll 60 -.in 15 -.ti -10 -+\b_B Move CP to beginning of memory buffer if + and to bottom if -. -.sp -.ti -10 -+\b_nC Move CP by +\b_n characters (moving ahead if +), counting the - as two characters. -.sp -.ti -10 -+\b_nD Delete n characters ahead of CP if plus and behind CP if minus. -.sp -.ti -10 -+\b_nK Kill (remove) +\b_n lines of source text using CP as the -current reference. If CP is not at the beginning of the current line when K -is issued, the characters before CP remain if + is specified, while the -characters after CP remain if - is given in the command. -.sp -.ti -10 -+\b_nL If n = 0, move CP to the beginning of the current -line, if it is -not already there. If n =\b/ 0, first move the CP to the beginning of the -current line and then move it to the beginning of the line that is n lines -down (if +) or up (if -). The CP will stop at the top or bottom of the -memory buffer if too large a value of n is specified. -.sp -.ti -10 -+\b_nT If n = 0, type the contents of the current line up to CP. If -n = 1, type the contents of the current line from CP to the end of the line. -If n>1, type the current line along with n - 1 lines that follow, if + is -specified. Similarly, if n>1 and - is given, type the previous n lines up to -the CP. Any key can be depressed to abort long type-outs. -.sp -.ti -10 -+\b_n Equivalent to +\b_nLT, which moves up or down and types a -single line. -.in 0 -.ll 65 -.sp 3 -.tc 2.1.6 Command Strings -.sh -2.1.6 Command Strings -.qs -.pp -Any number of commands can be typed contiguously (up to the capacity of -the console buffer) and are executed only after you press the . Table 2-3 -summarizes the CP/M console line-editing commands used to control the input -command line. -.bp -.ce -.sh -Table 2-3. Line-editing Controls -.sp - Command Result -.sp -.ll 60 -.in 16 -.ti -11 -CTRL-C Reboots the CP/M system when typed at the start of a line. -.sp -.ti -11 -CTRL-E Physical end of line: carriage is returned, but line is not sent -until the carriage return key is depressed. -.sp -.ti -11 -CTRL-H Backspaces one character position. -.sp -.ti -11 -CTRL-J Terminates current input (line-feed). -.sp -.ti -11 -CTRL-M Terminates current input (carriage return). -.sp -.ti -11 -CTRL-R Retypes current command line: types a clean line character -deletion with rubouts. -.sp -.ti -11 -CTRL-U Deletes the entire line typed at the console. -.sp -.ti -11 -CTRL-X Same as CTRL-U. -.sp -.ti -11 -CTRL-Z Ends input from the console (used in PIP and ED). -.sp -.ti -11 -rub/del Deletes and echos the last character typed at the -console. -.in 0 -.ll 65 -.sp -.pp -Suppose the memory buffer contains the characters shown in the -previous section, with the CP following the last character of the -buffer. In the following example, the command strings on the left produce -the results shown to the right. Use lower-case command letters to avoid -automatic translation of strings to upper-case. -.sp 2 - Command String Effect -.sp -.fi -.in 20 -.ll 60 -.ti -15 -B2T Move to beginning of the buffer and type two lines: -.nf -.sp -NOW IS THE -TIME FOR -.fi -The result in the memory buffer is -.sp -.nf -NOW IS THE -TIME FOR -ALL GOOD MEN -.fi -.in 0 -.bp - Command String Effect -.in 20 -.sp -.ti -15 -5C0T Move CP five characters and type the beginning of the line NOW -I. The result in the memory buffer is -.sp -NOW I S THE -.sp 2 -.ti -15 -2L-T Move two lines down and type the previous line TIME FOR. -The result in the memory buffer is -.sp -.nf -NOW IS THE -TIME FOR -ALL GOOD MEN -.fi -.sp 2 -.ti -15 --L#K Move up one line, delete 65535 lines that follow. The result -in the memory buffer is -.sp -NOW IS THE -.sp 2 -.ti -15 -I Insert two lines of text with automatic -.ti -15 -TIME TO translation to upper-case. The result in -.ti -15 -INSERT the memory buffer is -.ti -15 -^Z -.sp -.nf -NOW IS THE -TIME TO -INSERT -.fi -.sp 2 -.ti -15 --2L#T Move up two lines and type 65535 lines ahead of CP NOW IS THE. -The result in the memory buffer is -.sp -.nf -NOW IS THE -TIME TO -INSERT -.fi -.sp 2 -.ti -15 - Move down one line and type one line INSERT. The result in -the memory buffer is -.sp -.nf -NOW IS THE -TIME TO -INSERT -.fi -.in 0 -.ll 65 -.bp -.tc 2.1.7 Text Search and Alteration -.sh -2.1.7 Text Search and Alteration -.qs -.pp -ED has a command that locates strings within the memory -buffer. The command takes the form -.sp -.nf -.ti 8 -nF s -or -.ti 8 -nF s ^Z -.fi -.sp -where s represents the string to match, followed by either a -or CTRL-Z, denoted by ^Z. ED starts at the current position -of CP and attempts to match the string. The match is attempted n -times and, if successful, the CP is moved directly after the -string. If the n matches are not successful, the CP is not moved -from its initial position. Search strings can include CTRL-L, -which is replaced by the pair of symbols . -.pp -The following commands illustrate the use of the F command: -.sp 2 - Command String Effect -.in 20 -.sp -.ll 60 -.ti -15 -B#T Move to the beginning and type the entire buffer. The result -in the memory buffer is -.sp -.nf -NOW IS THE -TIME FOR -ALL GOOD MEN -.fi -.sp 2 -.ti -15 -FS T Find the end of the string S T. The result in the memory -buffer is -.nf -.sp -NOW IS T HE -.fi -.sp 2 -.ti -15 -FIs^Z0TT Find the next I and type to the CP; then type the remainder -of the current line ME FOR. The result in the memory buffer is -.nf -.sp -NOW IS THE -TI ME FOR - -ALL GOOD MEN -.fi -.in 0 -.ll 65 -.sp -.pp -An abbreviated form of the insert command is also allowed, which -is often used in conjunction with the F command to make simple -textual changes. The form is -.sp -.ti 8 -.nf -| s ^Z -or -.ti 8 -| s -.fi -.sp -where s is the string to insert. If the insertion string is -terminated by a CTRL-Z, the string is inserted directly following -the CP, and the CP is positioned directly after the string. The -action is the same if the command is followed by a except -that a is automatically inserted into the text following -the string. The following command sequences are examples -of the F and I commands: -.sp 2 - Command String Effect -.in 20 -.ll 60 -.sp -.ti -15 -BITHIS IS ^Z -.sp -Insert THIS IS at the beginning of the text. The result in the -memory buffer is -.sp -THIS IS NOW THE -.nf - -TIME FOR -ALL GOOD MEN -.sp 2 -.fi -.ti -15 -FTIME^Z-4DIPLACE^Z -.sp -Find TIME and delete it; then insert PLACE. The result in the memory -buffer is -.nf -.sp -THIS IS NOW THE -PLACE FOR - -ALL GOOD MEN -.sp 2 -.ti -15 -3FO^Z-3D5D1 -.fi -.ti -15 -CHANGES^Z Find third occurrence of O (that is, the -second O in GOOD), -delete previous 3 characters and the subsequent 5 characters; then insert -CHANGES. The result in the memory buffer is -.nf -.sp -THIS IS NOW THE -PLACE FOR -ALL CHANGES -.fi -.sp 2 -.ti -15 --8CISOURCE -.sp -Move back 8 characters and insert the line SOURCE. The result in the -memory buffer is -.nf -.sp -THIS IS NOW THE -PLACE FOR -ALL SOURCE - CHANGES -.fi -.ll 65 -.in 0 -.sp -.pp -ED also provides a single command that combines the F and I -commands to perform simple string substitutions. The command -takes the following form: -.sp -.nf -.ti 8 -nS s\d1\u^Zs\d2\u -or -.ti 8 -nS s\d1\u^Zs\d2\u ^Z -.fi -.sp -and has exactly the same effect as applying the following command -string a total of n times: -.sp -.nf -.ti 8 -F s\d1\u^Z-kDIs\d2 -or -.ti 8 -F s\d1\u^Z-kDIs\d2\u ^Z -.fi -.sp -where k is the length of the string. ED searches the -memory buffer starting at the current position of CP and -successively substitutes the second string for the first string -until the end of buffer, or until the substitution has been -performed n times. -.pp -As a convenience, a command similar to F is provided by ED that -automatically appends and writes lines as the search proceeds. -The form is -.sp -.nf -.ti 8 -n N s -or -.ti 8 -n N s ^Z -.fi -.sp -which searches the entire source file for the nth occurrence of -the strings (you should recall that F fails if the string -cannot be found in the current buffer). The operation of the N -command is precisely the same as F except in the case that the -string cannot be found within the current memory buffer. In this -case, the entire memory content is written (that is, an automatic #W -is issued). Input lines are then read until the buffer is at -least half full, or the entire source file is exhausted. The -search continues in this manner until the string has been found n -times, or until the source file has been completely transferred to -the temporary file. -.pp -A final line editing function, called the juxtaposition command, -takes the form -.sp -.nf -.ti 8 -n J s\d1\u^Zs\d2\u^Zs\d3\u -or -.ti 8 -n J s\d1\u^Zs\d2\u^Zs\d3\u ^Z -.fi -.sp -with the following action applied n times to the memory buffer: search from -the current CP for the next occurrence of the string s1. If found, -insert the string s2, and move CP to follow s2. Then delete all -characters following CP up to, but not including, the string s\d3\u, leaving -CP directly after s\d2\u. If s\d3\u cannot be found, then no deletion is -made. If the current line is -.sp 4 -.ti 8 -.nf -NOW IS THE TIME -.sp -the command -.sp -.ti 8 -JW ^ZWHAT^Z^1 -.sp -results in -.sp -.ti 8 -NOW WHAT -.fi -.sp -You should recall that ^1 (CTRL-L) represents the pair - in search and substitute strings. -.pp -The number of characters ED allows in the F, S, N, and J -commands is limited to 100 symbols. -.sp 2 -.tc 2.1.8 Source Libraries -.sh -2.1.8 Source Libraries -.qs -.pp -ED also allows the inclusion of source libraries during the -editing process with the R command. The form of this command is -.sp -.nf -.ti 8 -R filename ^Z -or -.ti 8 -R filename -.fi -.sp -where filename is the primary filename of a source file on the -disk with an assumed filetype of LIB. ED reads the specified -file, and places the characters into the memory buffer after CP, -in a manner similar to the I command. Thus, if the command -.sp -.ti 8 -RMACRO -.sp -is issued by the operator, ED reads from the file MACRO.LIB until -the end-of-file and automatically inserts the characters into the -memory buffer. -.pp -ED also includes a block move facility implemented through the -X (Transfer) command. The form -.sp -.ti 8 -nX -.sp -transfers the next n lines from the current line to a temporary -file called -.sp -.ti 8 -X$$$$$$.LIB -.sp -which is active only during the editing process. You can -reposition the current line reference to any portion of -the source file and transfer lines to the temporary file. The -transferred lines accumulate one after another in this file and -can be retrieved by simply typing -.sp -.ti 8 -R -.sp -which is the trivial case of the library read command. In this -case, the entire transferred set of lines is read into the memory -buffer. Note that the X command does not remove -the transferred lines from the memory buffer, although a K -command can be used directly after the X, and the R command does -not empty the transferred LIB file. That is, given that a set of -lines has been transferred with the X command, they can be -reread any number of times back into the source file. The -command -.sp -.ti 8 -0X -.sp -is provided to empty the transferred line file. -.pp -Note that upon normal completion of the ED -program through Q or E, the temporary LIB file is removed. If ED -is aborted with a CTRL-C, the LIB file will exist if lines have -been transferred, but will generally be empty (a subsequent ED -invocation will erase the temporary file). -.sp 2 -.tc 2.1.9 Repetitive Command Execution -.sh -2.1.9 Repetitive Command Execution -.qs -.pp -The macro command M allows you to group ED commands -together for repeated evaluation. The M command takes the following form: -.sp -.nf -.ti 8 -n M CS -or -.ti 8 -n M CS ^Z -.sp -.fi -where CS represents a string of ED commands, not including -another M command. ED executes the command string n times if -n>1. If n=0 or 1, the command string is executed repetitively -until an error condition is encountered (for example, the end of the -memory buffer is reached with an F command). -.pp -As an example, the following macro changes all occurrences of -GAMMA to DELTA within the current buffer, and types each line -that is changed: -.sp -.ti 8 -MFGAMMA^Z-5DIDELTA^Z0TT -.sp -or equivalently -.sp -.ti 8 -MSGAMMA^ZDELTA^Z0TT -.sp 2 -.tc 2.2 ED Error Conditions -.he CP/M Operating System Manual 2.2 ED Error Conditions -.sh -2.2 ED Error Conditions -.qs -.pp -On error conditions, ED prints the message BREAK X AT C where X -is one of the error indicators shown in Table 2-4. -.bp -.ce -.sh -Table 2-4. Error Message Symbols -.sp - Symbol Meaning -.sp -.ll 62 -.in 15 -.ti -10 -? Unrecognized command. -.sp -.ti -10 -> Memory buffer full (use one of the commands D, K, N, S, -or W to remove characters); F, N, or S strings too long. -.sp -.ti -10 -# Cannot apply command the number of times specified -(for example, in F command). -.sp -.ti -10 -O Cannot open LIB file in R command. -.in 0 -.ll 65 -.sp 2 -If there is a disk error, CP/M displays the following message: -.sp -.ti 8 -BDOS ERR on d: BAD SECTOR -.sp -You can choose to ignore the error by pressing RETURN -at the console (in this case, the memory buffer data -should be examined to see if they were incorrectly read), or you -can reset the system with a CTRL-C and reclaim the back-up file -if it exists. The file can be reclaimed by first typing the -contents of the BAK file to ensure that it contains the proper -information. For example, type the following: -.sp -.ti 8 -TYPE x.BAK -.sp -where x is the file being edited. Then remove the primary file -.sp -.ti 8 -ERA x.y -.sp -and rename the BAK file -.sp -.ti 8 -REN x.y=x.BAK -.sp -The file can then be reedited, starting with the previous -version. -.pp -ED also takes file attributes into account. If you -attempt to edit a Read-Only file, the message -.sp -.ti 8 -** FILE IS READ/ONLY ** -.sp -appears at the console. The file can be loaded and examined, but -cannot be altered. You must end the edit -session and use STAT to change the file attribute to R/W. If -the edited file has the system attribute set, the following message: -.sp -.ti 8 -'SYSTEM' FILE NOT ACCESSIBLE -.sp -is displayed and the edit session is aborted. Again, the STAT -program can be used to change the system attribute, if desired. -.sp 2 -.tc 2.3 Control Characters and Commands -.he CP/M Operating System Manual 2.3 Control Characters and Commands -.sh -2.3 Control Characters and Commands -.qs -.pp -Table 2-5 summarizes the control characters and -commands available in ED. -.sp 2 -.ce -.sh -Table 2-5. ED Control Characters -.sp -.ll 60 -.nf - Control Function - Character -.sp -.fi -.in 20 -.ti -16 -CTRL-C System reboot -.sp -.ti -16 -CTRL-E Physical (not actually entered -in command) -.sp -.ti -16 -CTRL-H Backspace -.sp -.ti -16 -CTRL-J Logical tab (cols 1, 9, 16, ...) -.sp -.ti -16 -CTRL-L Logical in search and -substitute strings -.sp -.ti -16 -CTRL-R Repeat line -.sp -.ti -16 -CTRL-U Line delete -.sp -.ti -16 -CTRL-X Line delete -.sp -.ti -16 -CTRL-Z String terminator -.sp -.ti -16 -rub/del Character delete -.sp -.in 0 -.ll 65 -.pp -Table 2-6 summarizes the commands used in ED. -.sp 2 -.ce -.sh -Table 2-6. ED Commands -.sp -.nf - Command Function -.ll 60 -.fi -.sp -.in 20 -.ti -16 - nA Append lines -.sp -.ti -16 - +\b_B Begin or bottom of buffer -.sp -.ti -16 - +\b_nC Move character positions -.sp -.ti -16 - +\b_nD Delete characters -.sp -.ti -16 - E End edit and close files (normal end) -.sp -.ti -16 - nF Find string -.bp -.in 0 -.ll 65 -.ce -.sh -Table 2-6. (continued) -.sp - Command Function -.ll 60 -.in 20 -.sp -.ti -16 - H End edit, close and reopen files -.sp -.ti -16 - I Insert characters, use i if both upper -and lower-case characters are to be entered. -.sp -.ti -16 - nJ Place strings in juxtaposition -.sp -.ti -16 - +\b_nK Kill lines -.sp -.ti -16 - +\b_nL Move down/up lines -.sp -.ti -16 - nM Macro definition -.sp -.ti -16 - nN Find next occurrence with autoscan -.sp -.ti -16 - O Return to original file -.sp -.ti -16 - +\b_nP Move and print pages -.sp -.ti -16 - Q Quit with no file changes -.sp -.ti -16 - R Read library file -.sp -.ti -16 - nS Substitute strings -.sp -.ti -16 - +\b_nT Type lines -.sp -.ti -16 - +\b_U Translate lower- to upper-case if U, -no translation if -U -.sp -.ti -16 - +\b_V Verify line numbers, or show -remaining free character space -.sp -.ti -16 - 0V A special case of the V command, OV, -prints the memory buffer statistics in the form -.sp -free/total -.sp -where free is the number of free bytes in the memory buffer (in -decimal) and total is the size of the memory buffer -.sp -.ti -16 - nW Write lines -.sp -.ti -16 - nZ Wait (sleep) for approximately n -seconds -.sp -.ti -16 - +\b_n Move and type (+\b_nLT). -.in 0 -.ll 65 -.sp -.pp -Because of common typographical errors, ED requires several -potentially disastrous commands to be typed as single letters, -rather than in composite commands. The following commands: -.sp -.nf -.in 3 -o E(end) -o H(head) -o O(original) -o Q(quit) -.fi -.in 0 -.sp -must be typed as single letter commands. -.pp -The commands I, J, M, N, R, and S should be typed as i, j, m, n, -r, and s if both upper- and lower-case characters are used in the -operation, otherwise all characters are converted to upper-case. -When a command is entered in upper-case, ED automatically -converts the associated string to upper-case, and vice versa. -.sp 2 -.ce -End of Section 2 -.nx threea - - - - - \ No newline at end of file diff --git a/Source/Doc/Clean.cmd b/Source/Doc/Clean.cmd index 31a220b4..1c04ba1b 100644 --- a/Source/Doc/Clean.cmd +++ b/Source/Doc/Clean.cmd @@ -1,7 +1,6 @@ @echo off setlocal -setlocal & cd CPM 22 Manual && call Clean.cmd & endlocal setlocal & cd ZCPR Manual && call Clean.cmd & endlocal setlocal & cd RomWBW User Guide && call Clean.cmd & endlocal setlocal & cd RomWBW System Guide && call Clean.cmd & endlocal diff --git a/Source/HBIOS/Build.ps1 b/Source/HBIOS/Build.ps1 index 74601bb3..72fe4316 100644 --- a/Source/HBIOS/Build.ps1 +++ b/Source/HBIOS/Build.ps1 @@ -9,7 +9,7 @@ while ($true) while ($true) { - $PlatformConfigFile = "Config/plt_${Platform}.asm" +; $PlatformConfigFile = "Config/plt_${Platform}.asm" $ConfigFile = "Config/${Platform}_${Config}.asm" if (Test-Path $ConfigFile) {break} if ($Config -ne "") {Write-Host "${ConfigFile} does not exist!"} @@ -85,7 +85,7 @@ Function Concat($InputFileList, $OutputFile) PLATFORM .EQU PLT_${Platform} ; HARDWARE PLATFORM ROMSIZE .EQU ${ROMSize} ; SIZE OF ROM IN KB ; -#INCLUDE "${PlatformConfigFile}" +;#INCLUDE "${PlatformConfigFile}" #INCLUDE "${ConfigFile}" ; "@ | Out-File "build.inc" -Encoding ASCII @@ -124,7 +124,8 @@ Concat 'romldr.bin', 'dbgmon.bin','cpm.bin','zsys.bin' osimg.bin Copy-Item $BlankROM $RomDiskFile cpmcp -f $RomFmt $RomDiskFile ../RomDsk/ROM_${RomSize}KB/*.* 0: -cpmcp -f $RomFmt $RomDiskFile ../RomDsk/${Platform}_${Config}/*.* 0: +#cpmcp -f $RomFmt $RomDiskFile ../RomDsk/${Platform}_${Config}/*.* 0: +cpmcp -f $RomFmt $RomDiskFile ../RomDsk/${Platform}/*.* 0: cpmcp -f $RomFmt $RomDiskFile ../Apps/*.com 0: cpmcp -f $RomFmt $RomDiskFile *.sys 0: diff --git a/Source/HBIOS/Config/N8_std.asm b/Source/HBIOS/Config/N8_std.asm new file mode 100644 index 00000000..a5ac243b --- /dev/null +++ b/Source/HBIOS/Config/N8_std.asm @@ -0,0 +1,14 @@ +; +;================================================================================================== +; N8 STANDARD CONFIGURATION +;================================================================================================== +; +#include "cfg_n8.asm" +; +Z180_CLKDIV .SET 1 ; 0=OSC/2, 1=OSC, 2=OSC*2 +Z180_MEMWAIT .SET 1 ; MEMORY WAIT STATES TO INSERT (0-3) +Z180_IOWAIT .SET 3 ; IO WAIT STATES TO INSERT (0-3) +; +SDMODE .SET SDMODE_CSIO ; FOR N8 PROTOTYPE (DATECODE 2511), USE SDMODE_N8 +; +CRTACT .SET FALSE ; TRUE TO ACTIVATE CRT AT STARTUP (BOOT ON CRT) diff --git a/Source/HBIOS/Config/mk4_cvdu.asm b/Source/HBIOS/Config/mk4_cvdu.asm deleted file mode 100644 index 01f48332..00000000 --- a/Source/HBIOS/Config/mk4_cvdu.asm +++ /dev/null @@ -1,8 +0,0 @@ -; -;================================================================================================== -; MARK IV CVDU CONFIGURATION -;================================================================================================== -; -CRTACT .SET FALSE ; ACTIVATE CRT AT STARTUP -; -CVDUENABLE .SET TRUE ; ENABLE CVDU BOARD SUPPORT diff --git a/Source/HBIOS/Config/mk4_diskio3.asm b/Source/HBIOS/Config/mk4_diskio3.asm deleted file mode 100644 index 3bc838f5..00000000 --- a/Source/HBIOS/Config/mk4_diskio3.asm +++ /dev/null @@ -1,10 +0,0 @@ -; -;================================================================================================== -; MARK IV DISKIO V3 CONFIGURATION -;================================================================================================== -; -FDENABLE .SET TRUE ; ENABLE FLOPPY SUPPORT -FDMODE .SET FDMODE_DIO3 ; USE DISKIO V3 MODE -; -PPIDEENABLE .SET TRUE ; ENABLE PPIDE SUPPORT -PPIDEMODE .SET PPIDEMODE_DIO3 ; PPIDEMODE_SBC, PPPIDEMODE_DIO3, PPIDEMODE_MFP, PPIDEMODE_N8 diff --git a/Source/HBIOS/Config/mk4_dsd.asm b/Source/HBIOS/Config/mk4_dsd.asm deleted file mode 100644 index 791a354a..00000000 --- a/Source/HBIOS/Config/mk4_dsd.asm +++ /dev/null @@ -1,7 +0,0 @@ -; -;================================================================================================== -; MARK IV DUAL SD CONFIGURATION -;================================================================================================== -; -SDENABLE .SET TRUE ; ENABLE SD SUPPORT -SDMODE .SET SDMODE_DSD ; USE DUAL SD BOARD MODE diff --git a/Source/HBIOS/Config/mk4_propio.asm b/Source/HBIOS/Config/mk4_propio.asm deleted file mode 100644 index 23ccf733..00000000 --- a/Source/HBIOS/Config/mk4_propio.asm +++ /dev/null @@ -1,8 +0,0 @@ -; -;================================================================================================== -; MARK IV PROPIO CONFIGURATION -;================================================================================================== -; -CRTACT .SET FALSE ; CRT ACTIVATION AT STARTUP -; -PRPENABLE .SET TRUE ; ENABLE PROPIO BOARD SUPPORT diff --git a/Source/HBIOS/Config/mk4_std.asm b/Source/HBIOS/Config/mk4_std.asm index eab14af0..c2265f33 100644 --- a/Source/HBIOS/Config/mk4_std.asm +++ b/Source/HBIOS/Config/mk4_std.asm @@ -3,3 +3,28 @@ ; MARK IV STANDARD CONFIGURATION ;================================================================================================== ; +#include "cfg_mk4.asm" +; +Z180_CLKDIV .SET 1 ; 0=OSC/2, 1=OSC, 2=OSC*2 +Z180_MEMWAIT .SET 0 ; MEMORY WAIT STATES TO INSERT (0-3) +Z180_IOWAIT .SET 1 ; IO WAIT STATES TO INSERT (0-3) +; +FDENABLE .SET FALSE ; TRUE FOR FLOPPY DEVICE SUPPORT +FDMODE .SET FDMODE_DIDE ; FDMODE_DIO, FDMODE_DIDE, FDMODE_DIO3 +; +IDEENABLE .SET TRUE ; TRUE FOR IDE DEVICE SUPPORT +IDEMODE .SET IDEMODE_MK4 ; IDEMODE_MK4, IDEMODE_DIO, IDEMODE_DIDE +; +PPIDEENABLE .SET FALSE ; TRUE FOR PPIDE DEVICE SUPPORT +PPIDEMODE .SET PPIDEMODE_MFP ; PPIDEMODE_MFP, PPPIDEMODE_DIO3 +; +SDENABLE .SET TRUE ; TRUE FOR SD DEVICE SUPPORT +SDMODE .SET SDMODE_MK4 ; SDMODE_MK4, SDMODE_DSD +; +PRPENABLE .SET TRUE ; TRUE FOR PROPIO BOARD SUPPORT (VIDEO, KBD, & SD CARD) +; +VGAENABLE .SET TRUE ; TRUE FOR VGA BOARD VIDEO & KBD SUPPORT +CVDUENABLE .SET TRUE ; TRUE FOR CVDU BOARD VIDEO & KBD SUPPORT +VDUENABLE .SET FALSE ; TRUE FOR VDU BOARD VIDEO & KBD SUPPORT +; +CRTACT .SET FALSE ; TRUE TO ACTIVATE CRT AT STARTUP (BOOT ON CRT) diff --git a/Source/HBIOS/Config/n8_2312.asm b/Source/HBIOS/Config/n8_2312.asm deleted file mode 100644 index ef04f64e..00000000 --- a/Source/HBIOS/Config/n8_2312.asm +++ /dev/null @@ -1,7 +0,0 @@ -; -;================================================================================================== -; ROMWBW 2.X CONFIGURATION FOR N8 2312 -;================================================================================================== -; -SDMODE .SET SDMODE_CSIO ; SDMODE_JUHA, SDMODE_CSIO, SDMODE_UART, SDMODE_PPI, SDMODE_DSD -SDCSIOFAST .SET TRUE ; TABLE-DRIVEN BIT INVERTER diff --git a/Source/HBIOS/Config/n8_2511.asm b/Source/HBIOS/Config/n8_2511.asm deleted file mode 100644 index 030dae01..00000000 --- a/Source/HBIOS/Config/n8_2511.asm +++ /dev/null @@ -1,5 +0,0 @@ -; -;================================================================================================== -; ROMWBW 2.X CONFIGURATION FOR N8 2511 -;================================================================================================== -; diff --git a/Source/HBIOS/Config/sbc_cvdu.asm b/Source/HBIOS/Config/sbc_cvdu.asm deleted file mode 100644 index 35094fd1..00000000 --- a/Source/HBIOS/Config/sbc_cvdu.asm +++ /dev/null @@ -1,8 +0,0 @@ -; -;================================================================================================== -; SBC CVDU CONFIGURATION -;================================================================================================== -; -CRTACT .SET TRUE ; ACTIVATE CRT AT STARTUP -; -CVDUENABLE .SET TRUE ; ENABLE CVDU BOARD SUPPORT diff --git a/Source/HBIOS/Config/sbc_dide.asm b/Source/HBIOS/Config/sbc_dide.asm deleted file mode 100644 index 91bdf7d7..00000000 --- a/Source/HBIOS/Config/sbc_dide.asm +++ /dev/null @@ -1,10 +0,0 @@ -; -;================================================================================================== -; SBC DIDE CONFIGURATION -;================================================================================================== -; -FDENABLE .SET TRUE ; ENABLE FLOPPY SUPPORT -FDMODE .SET FDMODE_DIDE ; USE DUAL IDE MODE -; -IDEENABLE .SET TRUE ; ENABLE IDE SUPPORT -IDEMODE .SET IDEMODE_DIDE ; USE DUAL IDE MODE diff --git a/Source/HBIOS/Config/sbc_diskio.asm b/Source/HBIOS/Config/sbc_diskio.asm deleted file mode 100644 index 6a5d2890..00000000 --- a/Source/HBIOS/Config/sbc_diskio.asm +++ /dev/null @@ -1,10 +0,0 @@ -; -;================================================================================================== -; SBC DISKIO CONFIGURATION -;================================================================================================== -; -FDENABLE .SET TRUE ; ENABLE FLOPPY SUPPORT -FDMODE .SET FDMODE_DIO ; USE DISKIO MODE (V1) -; -IDEENABLE .SET TRUE ; ENABLE IDE SUPPORT -IDEMODE .SET IDEMODE_DIO ; USE DISKIO IDE INTERFACE diff --git a/Source/HBIOS/Config/sbc_diskio3+cvdu.asm b/Source/HBIOS/Config/sbc_diskio3+cvdu.asm deleted file mode 100644 index 5498d945..00000000 --- a/Source/HBIOS/Config/sbc_diskio3+cvdu.asm +++ /dev/null @@ -1,15 +0,0 @@ -; -;================================================================================================== -; SBC DISKIO V3 + CVDU CONFIGURATION -;================================================================================================== -; -CRTACT .SET TRUE ; ACTIVATE CRT AT STARTUP -VDAEMU .SET EMUTYP_ANSI ; SELECT ANSI TERMINAL EMULATION -; -CVDUENABLE .SET TRUE ; ENABLE CVDU BOARD SUPPORT -; -FDENABLE .SET TRUE ; ENABLE FLOPPY SUPPORT -FDMODE .SET FDMODE_DIO3 ; USE DISKIO V3 MODE -; -PPIDEENABLE .SET TRUE ; ENABLE PPIDE SUPPORT -PPIDEMODE .SET PPIDEMODE_DIO3 ; PPIDEMODE_SBC, PPPIDEMODE_DIO3, PPIDEMODE_MFP, PPIDEMODE_N8 diff --git a/Source/HBIOS/Config/sbc_diskio3.asm b/Source/HBIOS/Config/sbc_diskio3.asm deleted file mode 100644 index 86eb2dc1..00000000 --- a/Source/HBIOS/Config/sbc_diskio3.asm +++ /dev/null @@ -1,10 +0,0 @@ -; -;================================================================================================== -; SBC DISKIO V3 CONFIGURATION -;================================================================================================== -; -FDENABLE .SET TRUE ; ENABLE FLOPPY SUPPORT -FDMODE .SET FDMODE_DIO3 ; USE DISKIO V3 MODE -; -PPIDEENABLE .SET TRUE ; ENABLE PPIDE SUPPORT -PPIDEMODE .SET PPIDEMODE_DIO3 ; PPIDEMODE_SBC, PPPIDEMODE_DIO3, PPIDEMODE_MFP, PPIDEMODE_N8 diff --git a/Source/HBIOS/Config/sbc_dsd.asm b/Source/HBIOS/Config/sbc_dsd.asm deleted file mode 100644 index 154ef652..00000000 --- a/Source/HBIOS/Config/sbc_dsd.asm +++ /dev/null @@ -1,7 +0,0 @@ -; -;================================================================================================== -; SBC DUAL SD CONFIGURATION -;================================================================================================== -; -SDENABLE .SET TRUE ; ENABLE SD SUPPORT -SDMODE .SET SDMODE_DSD ; USE DUAL SD BOARD MODE diff --git a/Source/HBIOS/Config/sbc_mfpic.asm b/Source/HBIOS/Config/sbc_mfpic.asm deleted file mode 100644 index d9566dcd..00000000 --- a/Source/HBIOS/Config/sbc_mfpic.asm +++ /dev/null @@ -1,7 +0,0 @@ -; -;================================================================================================== -; SBC MF/PIC CONFIGURATION -;================================================================================================== -; -PPIDEENABLE .SET TRUE ; ENABLE PPIDE SUPPORT -PPIDEMODE .SET PPIDEMODE_MFP ; PPIDEMODE_SBC, PPPIDEMODE_DIO3, PPIDEMODE_MFP, PPIDEMODE_N8 diff --git a/Source/HBIOS/Config/sbc_ppide.asm b/Source/HBIOS/Config/sbc_ppide.asm deleted file mode 100644 index 92cf7b6b..00000000 --- a/Source/HBIOS/Config/sbc_ppide.asm +++ /dev/null @@ -1,7 +0,0 @@ -; -;================================================================================================== -; SBC PPIDE CONFIGURATION -;================================================================================================== -; -PPIDEENABLE .SET TRUE ; ENABLE PPIDE SUPPORT (DO USE WITH DSKYENABLE) -PPIDEMODE .SET PPIDEMODE_SBC ; PPIDEMODE_SBC, PPPIDEMODE_DIO3, PPIDEMODE_MFP, PPIDEMODE_N8 diff --git a/Source/HBIOS/Config/sbc_ppisd.asm b/Source/HBIOS/Config/sbc_ppisd.asm deleted file mode 100644 index dbcd67ff..00000000 --- a/Source/HBIOS/Config/sbc_ppisd.asm +++ /dev/null @@ -1,7 +0,0 @@ -; -;================================================================================================== -; SBC PPISD CONFIGURATION -;================================================================================================== -; -SDENABLE .SET TRUE ; ENABLE SD SUPPORT -SDMODE .SET SDMODE_PPI ; USE PPI -> SD INTERFACE diff --git a/Source/HBIOS/Config/sbc_propio.asm b/Source/HBIOS/Config/sbc_propio.asm deleted file mode 100644 index d6297ef9..00000000 --- a/Source/HBIOS/Config/sbc_propio.asm +++ /dev/null @@ -1,8 +0,0 @@ -; -;================================================================================================== -; SBC PROPIO CONFIGURATION -;================================================================================================== -; -CRTACT .SET TRUE ; CRT ACTIVATION AT STARTUP -; -PRPENABLE .SET TRUE ; ENABLE PROPIO BOARD SUPPORT diff --git a/Source/HBIOS/Config/sbc_rf.asm b/Source/HBIOS/Config/sbc_rf.asm deleted file mode 100644 index 1b17c4db..00000000 --- a/Source/HBIOS/Config/sbc_rf.asm +++ /dev/null @@ -1,6 +0,0 @@ -; -;================================================================================================== -; SBC RAM FLOPPY CONFIGURATION -;================================================================================================== -; -RFENABLE .SET TRUE ; ENABLE RAM FLOPPY SUPPORT diff --git a/Source/HBIOS/Config/sbc_simh.asm b/Source/HBIOS/Config/sbc_simh.asm index 402ab8f6..06ac2b65 100644 --- a/Source/HBIOS/Config/sbc_simh.asm +++ b/Source/HBIOS/Config/sbc_simh.asm @@ -1,13 +1,11 @@ ; ;================================================================================================== -; SBC SIMH CONFIGURATION +; SBC SIMH EMULATOR CONFIGURATION ;================================================================================================== ; -CPUOSC .SET 20000000 ; EMULATOR RUNS FAST... +#include "cfg_sbc.asm" ; -INTTYPE .SET IT_SIMH +DSRTCENABLE .SET FALSE ; DS-1302 CLOCK DRIVER +SIMRTCENABLE .SET TRUE ; SIMH CLOCK DRIVER ; -SIMRTCENABLE .SET TRUE -DSRTCENABLE .SET FALSE -; -HDSKENABLE .SET TRUE +HDSKENABLE .SET TRUE ; TRUE FOR SIMH HDSK SUPPORT diff --git a/Source/HBIOS/Config/sbc_std.asm b/Source/HBIOS/Config/sbc_std.asm index fcb4c35d..40a7ccb2 100644 --- a/Source/HBIOS/Config/sbc_std.asm +++ b/Source/HBIOS/Config/sbc_std.asm @@ -3,3 +3,24 @@ ; SBC STANDARD CONFIGURATION ;================================================================================================== ; +#include "cfg_sbc.asm" +; +FDENABLE .SET FALSE ; TRUE FOR FLOPPY DEVICE SUPPORT +FDMODE .SET FDMODE_DIO3 ; FDMODE_DIO, FDMODE_DIDE, FDMODE_DIO3 +; +IDEENABLE .SET FALSE ; TRUE FOR IDE DEVICE SUPPORT +IDEMODE .SET IDEMODE_DIO ; IDEMODE_DIO, IDEMODE_DIDE +; +PPIDEENABLE .SET TRUE ; TRUE FOR PPIDE DEVICE SUPPORT +PPIDEMODE .SET PPIDEMODE_SBC ; PPIDEMODE_SBC, PPPIDEMODE_DIO3, PPIDEMODE_MFP +; +SDENABLE .SET FALSE ; TRUE FOR SD DEVICE SUPPORT +SDMODE .SET SDMODE_PPI ; SDMODE_JUHA, SDMODE_PPI, SDMODE_DSD +; +PRPENABLE .SET TRUE ; TRUE FOR PROPIO BOARD SUPPORT (VIDEO, KBD, & SD CARD) +; +VGAENABLE .SET TRUE ; TRUE FOR VGA BOARD VIDEO & KBD SUPPORT +CVDUENABLE .SET TRUE ; TRUE FOR CVDU BOARD VIDEO & KBD SUPPORT +VDUENABLE .SET FALSE ; TRUE FOR VDU BOARD VIDEO & KBD SUPPORT +; +CRTACT .SET FALSE ; TRUE TO ACTIVATE CRT AT STARTUP (BOOT ON CRT) diff --git a/Source/HBIOS/Config/sbc_vdu.asm b/Source/HBIOS/Config/sbc_vdu.asm deleted file mode 100644 index 88c27605..00000000 --- a/Source/HBIOS/Config/sbc_vdu.asm +++ /dev/null @@ -1,8 +0,0 @@ -; -;================================================================================================== -; SBC VDU CONFIGURATION -;================================================================================================== -; -CRTACT .SET TRUE ; ACTIVATE CRT AT STARTUP -; -VDUENABLE .SET TRUE ; ENABLE VDU BOARD SUPPORT diff --git a/Source/HBIOS/Config/una_std.asm b/Source/HBIOS/Config/una_std.asm index 52c3d6d2..093e0af2 100644 --- a/Source/HBIOS/Config/una_std.asm +++ b/Source/HBIOS/Config/una_std.asm @@ -3,3 +3,5 @@ ; UNA STANDARD CONFIGURATION ;================================================================================================== ; +#include "cfg_una.asm" +; diff --git a/Source/HBIOS/Config/zeta2_ppide.asm b/Source/HBIOS/Config/zeta2_ppide.asm deleted file mode 100644 index add6fa6a..00000000 --- a/Source/HBIOS/Config/zeta2_ppide.asm +++ /dev/null @@ -1,6 +0,0 @@ -; -;================================================================================================== -; ZETA2 PPIDE CONFIGURATION -;================================================================================================== -; -PPIDEENABLE .SET TRUE ; TRUE FOR PPIDE SUPPORT (DO NOT COMBINE WITH DSKYENABLE) diff --git a/Source/HBIOS/Config/zeta2_ppisd.asm b/Source/HBIOS/Config/zeta2_ppisd.asm deleted file mode 100644 index c3a32096..00000000 --- a/Source/HBIOS/Config/zeta2_ppisd.asm +++ /dev/null @@ -1,6 +0,0 @@ -; -;================================================================================================== -; ZETA2 PPISD CONFIGURATION -;================================================================================================== -; -SDENABLE .SET TRUE ; TRUE FOR SD SUPPORT diff --git a/Source/HBIOS/Config/zeta2_ppp.asm b/Source/HBIOS/Config/zeta2_ppp.asm deleted file mode 100644 index 1ef5e8d0..00000000 --- a/Source/HBIOS/Config/zeta2_ppp.asm +++ /dev/null @@ -1,7 +0,0 @@ -; -;================================================================================================== -; ZETA2 PARPORTPROP CONFIGURATION -;================================================================================================== -; -CRTACT .SET TRUE ; ACTIVATE CRT CONSOLE AT BOOT -PPPENABLE .SET TRUE ; TRUE FOR PARPORTPROP SUPPORT diff --git a/Source/HBIOS/Config/zeta2_std.asm b/Source/HBIOS/Config/zeta2_std.asm index b39646b2..a31af926 100644 --- a/Source/HBIOS/Config/zeta2_std.asm +++ b/Source/HBIOS/Config/zeta2_std.asm @@ -3,3 +3,12 @@ ; ZETA2 STANDARD CONFIGURATION ;================================================================================================== ; +#include "cfg_zeta2.asm" +; +PPIDEENABLE .SET FALSE ; TRUE FOR PPIDE DEVICE SUPPORT +; +SDENABLE .SET FALSE ; TRUE FOR SD DEVICE SUPPORT +; +PPPENABLE .SET TRUE ; TRUE FOR PROPIO BOARD SUPPORT (VIDEO, KBD, & SD CARD) +; +CRTACT .SET TRUE ; TRUE TO ACTIVATE CRT AT STARTUP (BOOT ON CRT) diff --git a/Source/HBIOS/Config/zeta_ppide.asm b/Source/HBIOS/Config/zeta_ppide.asm deleted file mode 100644 index a58a935b..00000000 --- a/Source/HBIOS/Config/zeta_ppide.asm +++ /dev/null @@ -1,6 +0,0 @@ -; -;================================================================================================== -; ZETA PPIDE CONFIGURATION -;================================================================================================== -; -PPIDEENABLE .SET TRUE ; TRUE FOR PPIDE SUPPORT (DO NOT COMBINE WITH DSKYENABLE) diff --git a/Source/HBIOS/Config/zeta_ppisd.asm b/Source/HBIOS/Config/zeta_ppisd.asm deleted file mode 100644 index 7f5a5bd5..00000000 --- a/Source/HBIOS/Config/zeta_ppisd.asm +++ /dev/null @@ -1,6 +0,0 @@ -; -;================================================================================================== -; ZETA PPISD CONFIGURATION -;================================================================================================== -; -SDENABLE .SET TRUE ; TRUE FOR SD SUPPORT diff --git a/Source/HBIOS/Config/zeta_ppp.asm b/Source/HBIOS/Config/zeta_ppp.asm deleted file mode 100644 index c08a37e6..00000000 --- a/Source/HBIOS/Config/zeta_ppp.asm +++ /dev/null @@ -1,7 +0,0 @@ -; -;================================================================================================== -; ZETA PARPORTPROP CONFIGURATION -;================================================================================================== -; -CRTACT .SET TRUE ; ACTIVATE CRT CONSOLE AT BOOT -PPPENABLE .SET TRUE ; TRUE FOR PARPORTPROP SUPPORT diff --git a/Source/HBIOS/Config/zeta_std.asm b/Source/HBIOS/Config/zeta_std.asm index 61de0b89..9a31ad5b 100644 --- a/Source/HBIOS/Config/zeta_std.asm +++ b/Source/HBIOS/Config/zeta_std.asm @@ -3,3 +3,12 @@ ; ZETA STANDARD CONFIGURATION ;================================================================================================== ; +#include "cfg_zeta.asm" +; +PPIDEENABLE .SET FALSE ; TRUE FOR PPIDE DEVICE SUPPORT +; +SDENABLE .SET FALSE ; TRUE FOR SD DEVICE SUPPORT +; +PPPENABLE .SET TRUE ; TRUE FOR PROPIO BOARD SUPPORT (VIDEO, KBD, & SD CARD) +; +CRTACT .SET TRUE ; TRUE TO ACTIVATE CRT AT STARTUP (BOOT ON CRT) diff --git a/Source/HBIOS/Old/Make.cmd b/Source/HBIOS/Old/Make.cmd deleted file mode 100644 index c161db34..00000000 --- a/Source/HBIOS/Old/Make.cmd +++ /dev/null @@ -1 +0,0 @@ -@..\tools\gcc\mingw32-make %* \ No newline at end of file diff --git a/Source/HBIOS/Old/bioshdr.inc b/Source/HBIOS/Old/bioshdr.inc deleted file mode 100644 index 4ee1e8e1..00000000 --- a/Source/HBIOS/Old/bioshdr.inc +++ /dev/null @@ -1,131 +0,0 @@ -; bioshdr.inc 5/10/2012 dwg - offsets into the BIOS Header data - -B_BOOT .equ 0e600h -B_WBOOT .equ 0e603h -B_CONST .equ 0e606h -B_CONIN .equ 0e609h -B_CONOUT .equ 0e60ch -B_LIST .equ 0e60fh -B_PUNCH .equ 0e612h -B_READER .equ 0e615h -B_HOME .equ 0e618h -B_SELDSK .equ 0e61bh -B_SETTRK .equ 0e61eh -B_SETSEC .equ 0e621h -B_SETDMA .equ 0e624h -B_READ .equ 0e627h -B_WRITE .equ 0e62ah -B_LISTST .equ 0e62dh -B_SECTRN .equ 0e630h -B_BNKSEL .equ 0e633h -B_GETLU .equ 0e636h -B_SETLU .equ 0e639h -B_GETINFO .equ 0e63ch -B_RSVD1 .equ 0e63fh -B_RSVD2 .equ 0e642h -B_RSVD3 .equ 0e645h -B_RSVD4 .equ 0e648h - -B_CNFGDATA .equ 0e64bh - -B_RMJ .equ 0e64bh -B_RMN .equ 0e64ch -B_RUP .equ 0e64dh -B_RTP .equ 0e64eh -B_DSKBOOT .equ 0e64fh -B_BOOTDRV .equ 0e650h - -B_MONTH .equ 0e651h -B_DAY .equ 0e652h -B_YEAR .equ 0e653h - -B_HOUR .equ 0e654h -B_MIN .equ 0e655h -B_SEC .equ 0e656h - -; Config Proper Start Here - -B_FREQ .equ 0e657h -B_PLATFORM .equ B_FREQ+1 -B_DIOPLAT .equ B_PLATFORM+1 -B_VDUMODE .equ B_DIOPLAT+1 -B_ROMSIZE .equ B_VDUMODE+1 -B_RAMSIZE .equ B_ROMSIZE+2 -B_CLRRAMDSK .equ B_RAMSIZE+2 -B_DSKYENABLE .equ B_CLRRAMDSK+1 -B_UARTENABLE .equ B_DSKYENABLE+1 -B_VDUENABLE .equ B_UARTENABLE+1 -B_FDENABLE .equ B_VDUENABLE+1 -B_FDTRACE .equ B_FDENABLE+1 -B_FDMEDIA .equ B_FDTRACE+1 -B_FDMEDIAALT .equ B_FDMEDIA+1 -B_FDMAUTO .equ B_FDMEDIAALT+1 -B_IDEENABLE .equ B_FDMAUTO+1 -B_IDETRACE .equ B_IDEENABLE+1 -B_IDE8BIT .equ B_IDETRACE+1 -B_IDECAPACITY .equ B_IDE8BIT+1 -B_PPIDEENABLE .equ B_IDECAPACITY+2 -B_PPIDETRACE .equ B_PPIDEENABLE+1 -B_PPIDE8BIT .equ B_PPIDETRACE+1 -B_PPIDECAPACITY .equ B_PPIDE8BIT+1 -B_PPIDESLOW .equ B_PPIDECAPACITY+2 -B_BOOTTYPE .equ B_PPIDESLOW+1 -B_BAUDRATE .equ B_BOOTTYPE+1 -B_CLKDIV .equ B_BAUDRATE+2 - -B_MEMWAIT .equ B_CLKDIV+1 -B_IOWAIT .equ B_MEMWAIT+1 -B_CNTLB0 .equ B_IOWAIT+1 -B_CNTLB1 .equ B_CNTLB0+1 -B_SDCAPACITY .equ B_CNTLB1+1 -B_SDCSIO .equ B_SDCAPACITY+2 -B_SDCSIOFAST .equ B_SDCSIO+1 -B_DEFIOBYTE .equ B_SDCSIOFAST+1 -B_TERMTYPE .equ B_DEFIOBYTE+1 -B_REVISION .equ B_TERMTYPE+1 -B_PRPSDENABLE .equ B_REVISION+2 -B_PRPSDTRACE .equ B_PRPSDENABLE+1 -B_PRPSDCAPACITY .equ B_PRPSDTRACE+1 -B_PRPCONENABLE .equ B_PRPSDCAPACITY+2 -B_DATASIZE .equ B_PRPCONENABLE+1 - - -B_INFOVER .equ 0 -B_STRBANNER .equ B_INFOVER+2 -B_VARLOC .equ B_STRBANNER+2 -B_TSTLOC .equ B_VARLOC+2 -B_SECADR .equ B_TSTLOC+2 -B_SEKDSK .equ B_SECADR+2 -B_SEKTRK .equ B_SEKDSK+2 -B_SEKSEC .equ B_SEKTRK+2 -B_DSKOP .equ B_SEKSEC+2 -B_DMAADR .equ B_DSKOP+2 -B_DPHADR .equ B_DMAADR+2 -B_XLT .equ B_DPHADR+2 -B_HST .equ B_XLT+2 -B_DIRBF .equ B_HST+2 -B_DPBMAP .equ B_DIRBF+2 -B_DSKMAP .equ B_DPBMAP+2 -B_DPHMAP .equ B_DSKMAP+2 -B_CIOMAP .equ B_DPHMAP+2 -B_SECBUF .equ B_CIOMAP+2 -B_ORGFDDATA .equ B_SECBUF+2 -B_ORGIDEDATA .equ B_ORGFDDATA+2 -B_ORGSDDATA .equ B_ORGIDEDATA+2 -B_ORGPRPSDDATA .equ B_ORGSDDATA+2 -B_ORGPPPSDDATA .equ B_ORGPRPSDDATA+2 -B_INFOTBLSIZE .equ B_ORGPPPSDDATA+2 - -;;;;;;;;;;;;;;;;;;;;; -; eof - bioshdr.inc ; -;;;;;;;;;;;;;;;;;;;;; - - - - - - - - - - diff --git a/Source/HBIOS/Old/bootapp.asm b/Source/HBIOS/Old/bootapp.asm deleted file mode 100644 index 26430385..00000000 --- a/Source/HBIOS/Old/bootapp.asm +++ /dev/null @@ -1,180 +0,0 @@ -;___BOOTAPP____________________________________________________________________________________________________________ -; -; APPLICATION BOOT MANAGER -; -; USED TO LOAD AN APPLICATION IMAGE BASED COPY OF THE SYSTEM -; REFER TO BANKEDBIOS.TXT FOR MORE INFORMATION. -;______________________________________________________________________________________________________________________ -; -; -#INCLUDE "std.asm" -; - .ORG $100 -; - DI ; NO INTERRUPTS - IM 1 ; INTERRUPT MODE 1 - ;LD SP,STACK ; SP IN RAM - LD SP,HBX_LOC ; SP IN RAM -; -; PERFORM MINIMAL Z180 SPECIFIC INITIALIZATION -; -#IFNDEF UNALOAD -; -#IF ((PLATFORM == PLT_N8) | (PLATFORM == PLT_MK4)) - ; SET BASE FOR CPU IO REGISTERS - LD A,CPU_BASE - OUT0 (CPU_ICR),A - - ; SET DEFAULT CPU CLOCK MULTIPLIERS (XTAL / 2) - XOR A - OUT0 (CPU_CCR),A - OUT0 (CPU_CMR),A - - ; SET DEFAULT WAIT STATES - LD A,$F0 - OUT0 (CPU_DCNTL),A - -#IF (Z180_CLKDIV >= 1) - ; SET CLOCK DIVIDE TO 1 RESULTING IN FULL XTAL SPEED - LD A,$80 - OUT0 (CPU_CCR),A -#ENDIF - -#IF (Z180_CLKDIV >= 2) - ; SET CPU MULTIPLIER TO 1 RESULTING IN XTAL * 2 SPEED - LD A,$80 - OUT0 (CPU_CMR),A -#ENDIF - ; SET DESIRED WAIT STATES - LD A,0 + (Z180_MEMWAIT << 6) | (Z180_IOWAIT << 4) - OUT0 (CPU_DCNTL),A - - ; CANNOT CHANGE MMU SETUP DURING AN APP BASED BOOT - ;; MMU SETUP - ;LD A,$80 - ;OUT0 (CPU_CBAR),A ; SETUP FOR 32K/32K BANK CONFIG - ;LD A,RAMBIAS >> 2 - ;OUT0 (CPU_BBR),A ; BANK BASE SET TO START OF RAM - ;LD A,(RAMSIZE + RAMBIAS - 64) >> 2 - ;OUT0 (CPU_CBR),A ; COMMON BASE = LAST (TOP) BANK -#ENDIF -; -#ENDIF -; -; EMIT FIRST SIGN OF LIFE TO SERIAL PORT -; - CALL XIO_INIT ; INIT SERIAL PORT - LD HL,STR_BOOT ; POINT TO MESSAGE - CALL XIO_OUTS ; SAY HELLO -; -; RELOCATE MONITOR/OS CODE FROM 8000H TO C000H -; THIS INCLUDES OURSELVES (FOR PHASE 2) AND THE LOADER CODE -; CAREFUL, WORKING STACK AREA IS WIPED OUT!!! -; - LD HL,$8000 ; COPY MEMORY FROM $8000 - LD DE,$C000 ; TO $C000 - LD BC,$4000 - $400 ; ALL BUT TOP 1K TO AVOID OVERLAYING PROXY - LDIR -; - CALL XIO_DOT ; MARK PROGRESS -; -; COPY FIRST $1000 BYTES TO $8000 (UPPER, NON-BANKED MEMORY) -; THIS INCLUDES OURSELVES AND THE LOADER CODE -; STACK AREA IS WIPED OUT!!! -; - LD HL,$0000 ; COPY MEMORY FROM 0000 - LD DE,$8000 ; TO 8000H - LD BC,$1000 ; COPY 1000H BYTES - LDIR -; - CALL XIO_DOT ; MARK PROGRESS -; -#IF (PLATFORM == PLT_UNA) - ; IF RUNNING UNDER UNA, WE ARE DONE, PROCEED TO LOADER - LD DE,$0100 ; *** FIX *** ASSUME WE WANT DEFAULT DRIVE TO BE ROM - JP CPM_ENT ; JUMP TO OS -#ELSE - ; NON-UNA REQUIRES PHASE 2 - JP PHASE2 ; JUMP TO PHASE 2 BOOT IN UPPER MEMORY -#ENDIF -; -STR_BOOT .DB "RomWBW$" -; -; IMBED DIRECT SERIAL I/O ROUTINES -; -#INCLUDE "xio.asm" - -; -;______________________________________________________________________________________________________________________ -; -; THIS IS THE PHASE 2 CODE THAT MUST EXECUTE IN UPPER MEMORY -; - .ORG $ + $8000 ; WE ARE NOW EXECUTING IN UPPER MEMORY - -#IF (PLATFORM != PLT_UNA) - -; -PHASE2: - LD SP,HBX_LOC ; MOVE SP TO HIMEM JUST BELOW HBIOS -; - CALL XIO_DOT ; MARK PROGRESS -; -; COPY NEW HBIOS IMAGE INTO TARGET RAM PAGE -; - LD HL,0 ; HL = LOCATION IN LOMEM TO COPY FROM/TO -LOOP: - LD DE,$9000 ; DE = BUFFER ADDRESS - LD BC,$1000 ; BYTES TO COPY (4K CHUNKS) - PUSH BC ; SAVE COPY SIZE - PUSH DE ; SAVE COPY DEST - PUSH HL ; SAVE COPY SOURCE - LD A,BID_USR ; RAM PAGE WITH NEW HBIOS IMAGE - CALL PGSEL ; SELECT IT - LDIR ; COPY ROM -> BUFFER - POP DE ; RESTORE SOURCE AS NEW DESTINATION - POP HL ; RESTORE DESTINATION AS NEW SOURCE - POP BC ; RESTORE COPY SIZE - LD A,BID_HB ; HBIOS RAM PAGE - CALL PGSEL ; SELECT IT - LDIR ; COPY BUFFER -> RAM - EX DE,HL ; GET LOMEM POINTER BACK TO HL - LD A,H ; HIGH BYTE OF POINTER TO A - CP $80 ; HIGH BYTE WILL BE 80H WHEN WE ARE DONE - JP NZ,LOOP ; IF NOT DONE, LOOP TO DO NEXT 4K CHUNK -; - LD A,BID_USR ; RAM PAGE WITH NEW HBIOS IMAGE - CALL PGSEL ; SELECT IT - CALL XIO_DOT ; MARK PROGRESS -; -; INITIALIZE HBIOS AND JUMP TO LOADER -; - ; CALL HBIOS HARDWARE INITIALIZATION - ; CALL HBIOS HARDWARE INITIALIZATION - LD A,BID_HB ; HBIOS RAM PAGE - CALL PGSEL ; SELECT IT - CALL $1000 ; CALL HBIOS INITIALIZATION -; - ; CALL HBIOS PROXY INITIALIZATION - LD A,BID_USR ; USER RAM PAGE - CALL PGSEL ; SELECT IT - CALL HBX_LOC ; CALL HBIOS PROXY INITIALIZATION -; - LD DE,$0000 ; ASSUME WE WANT DEFAULT DRIVE TO BE ROM - JP CPM_ENT ; JUMP TO OS -;______________________________________________________________________________________________________________________ -; -; NOTE THAT MEMORY MANAGER CODE IS IN UPPER MEMORY! -; -#INCLUDE "memmgr.asm" -; -#ENDIF - -;______________________________________________________________________________________________________________________ -; -; PAD OUT REMAINDER OF PAGE -; - .FILL $8200 - $,$FF ; PAD OUT REMAINDER OF PAGE -; -STACK .EQU $ ; STACK IN HIMEM SLACK SPACE -; - .END diff --git a/Source/HBIOS/Old/bootgen.asm b/Source/HBIOS/Old/bootgen.asm deleted file mode 100644 index 973d476e..00000000 --- a/Source/HBIOS/Old/bootgen.asm +++ /dev/null @@ -1,424 +0,0 @@ -;___BOOTGEN___________________________________________________________________________________________________________ -; -; COPY THE SYSTEM TO THE BOOT SECTORS OF AN IDE HDD -; -; CREATED BY : DAN WERNER 09 12.2009 -; -; -; -; -;__CONSTANTS_________________________________________________________________________________________________________________________ -; -CR: .EQU 0DH ; ASCII CARRIAGE RETURN CHARACTER -LF: .EQU 0AH ; ASCII LINE FEED CHARACTER -ESC: .EQU 1BH ; ASCII ESCAPE CHARACTER -BS: .EQU 08H ; ASCII BACKSPACE CHARACTER - -; -; -; -;__MAIN_PROGRAM_____________________________________________________________________________________________________________________ -; - .ORG 00100h ; FOR DEBUG IN CP/M (AS .COM) - - - LD HL,(0001H) ; GET WBOOT ADDRESS - LD BC,1603H ; GET CP/M TOP - SBC HL,BC ; - LD (CPMSTART),HL ; SET IT - DEC HL ; - LD SP,HL ; SETUP STACK - - -; PARSE COMMAND LINE - LD HL,0081H ; SET INDEX POINTER - LD B,(0080H) ; NUMBER OF BYTES -PARSECMD: - LD A,(HL) ; GET DRIVE LETTER ON COMMAND LINE - INC HL - CP 20H ; IS SPACE? - JP NZ,PARSEGOT ; JUMP ON NON-BLANK - DJNZ PARSECMD ; LOOP -PARSEERR: - LD DE,MSG_VALID ; - LD C,09H ; CP/M WRITE START STRING TO CONSOLE CALL - CALL 0005H - JP EXIT ; EXIT -PARSEGOT: - SUB 'A' ; TURN IT INTO A NUMERIC - JP C,PARSEERR ; - CP 16 ; VALID CP/M DRIVE? - JP P,PARSEERR ; - LD (DEVICENUMBER),A ; DEVICE ID - ; GET NUMBER OF SECTORS PER TRACK - LD L,A ; L=DISK NUMBER 0,1,2,3,4 - LD H,0 ; HIGH ORDER ZERO - ADD HL,HL ; *2 - ADD HL,HL ; *4 - ADD HL,HL ; *8 - ADD HL,HL ; *16 (SIZE OF EACH HEADER) - PUSH HL ; - POP DE - LD HL,(0001H) ; - LD BC,0058 ; - ADD HL,BC ; - ADD HL,DE ; HL= DPBASE(DISKNO*16) - EX DE,HL ; - LD A,(DE) ; - LD L,A ; - INC DE ; - LD A,(DE) ; - LD H,A ; - EX DE,HL ; - LD A,(DE) ; - LD (SECTRACK),A ; - INC DE ; - LD A,(DE) ; - LD (SECTRACK+1),A ; - - LD DE,DRIVE_MSG ; - LD C,09H ; CP/M WRITE START STRING TO CONSOLE CALL - CALL 0005H - LD A,(DEVICENUMBER) ; - ADD A,'A' ; - CALL COUT ; - LD A,':' ; - CALL COUT ; - CALL CRLF ; - - - LD DE,BASE_MSG ; - LD C,09H ; CP/M WRITE START STRING TO CONSOLE CALL - CALL 0005H - LD HL,(CPMSTART) ; - CALL PHL ; - LD DE,END_MSG ; - LD C,09H ; CP/M WRITE START STRING TO CONSOLE CALL - CALL 0005H - LD HL,(CPMEND) ; - CALL PHL ; - CALL CRLF ; - - LD DE,SECTOR_MSG ; - LD C,09H ; CP/M WRITE START STRING TO CONSOLE CALL - CALL 0005H - LD HL,(SECTRACK) ; - CALL PHL ; - CALL CRLF ; - - -; RUN WITH GOOD OUTPUT - - LD A,(DEVICENUMBER) ; SET DEVICE NUMBER - LD C,A - CALL SELDSK ; SELECT DISK - - LD HL,000CH ; SET INITIAL SECTOR - LD (CURSECTOR),HL - - LD HL,0000H ; SET INITIAL TRACK - LD (CURTRACK),HL ; - - LD HL,(CPMSTART) ; SET BEGINNING OF CPM - LD (CURADDRESS),HL ; - - LD BC,(DMAAD) ; SETUP THE DMA AREA - CALL SETDMA ; - -LOOP: - LD BC,(CURSECTOR) ; SET SECTOR - CALL SETSEC ; - LD BC,(CURTRACK) ; - CALL SETTRK ; - CALL COPYTODMA ; COPY BYTES TO DMA - CALL WRITE ; WRITE SECTOR - - LD HL,(CURADDRESS) ; IF IX>CPMEND, EXIT PROGRAM - LD BC,(CPMEND) ; - LD A,H ; - CP B ; - JP NZ,CONTINUE ; - LD A,L ; - CP C ; - JP M,ENDLOOP ; -CONTINUE: - LD HL,(CURSECTOR) ; GET NEXT TRACK & SECTOR - INC HL ; - LD (CURSECTOR),HL ; - LD BC,(SECTRACK) ; - LD A,H ; - CP B ; - JP NZ,LOOP ; - LD A,L ; - CP C ; - JP NZ,LOOP ; - - LD HL,(CURTRACK) ; - INC HL ; - LD (CURTRACK),HL ; - LD HL,0000H ; - LD (CURSECTOR),HL ; - JP LOOP ; - -ENDLOOP: -; WRITE CP/M BOOT START AND END ADDRESSES IN LAST TWO WORDS OF MEDIA INFO SECTOR - LD BC,000BH ; SET SECTOR - CALL SETSEC ; - LD BC,0000H ; - CALL SETTRK ; - CALL READ ; - LD HL,(DMAAD) ; SET ADDRESS IN BUFFER TO LAST TWO WORDS - LD BC,122 ; - ADD HL,BC ; - LD A,(CPMSTART) ; - LD (HL),A ; - LD A,(CPMSTART+1) ; - INC HL - LD (HL),A ; - LD A,(CPMEND) ; - INC HL - LD (HL),A ; - LD A,(CPMEND+1) ; - INC HL - LD (HL),A ; - LD A,(0001H) ; - DEC A ; - DEC A ; - DEC A ; - INC HL - LD (HL),A ; - LD A,(0002H) ; - INC HL - LD (HL),A ; - CALL WRITE ; WRITE SECTOR - -EXIT: - - LD DE,MSG_END ; - LD C,09H ; CP/M WRITE END STRING TO CONSOLE CALL - CALL 0005H ; - ; - LD C,00H ; CP/M SYSTEM RESET CALL - CALL 0005H ; RETURN TO PROMPT - - - - - -;___COPYTODMA_____________________________________________________________________________________ -; -; COPY CURRENT ADDRESS BLOCK TO DMA -;_________________________________________________________________________________________________ -COPYTODMA: - LD HL,(DMAAD) ; LOAD HL WITH DMA ADDRESS - LD E,L ; - LD D,H ; GET IT INTO DE - LD HL,(CURADDRESS) ; GET RAM ADDRESS TO COPY - LD BC,128 ; BC IS COUNTER FOR FIXED SIZE TRANSFER (128 BYTES) - LDIR ; TRANSFER - LD HL,(CURADDRESS) ; INCREMENT ADDRESS POINTER BY COPY SIZE - LD BC,128 ; - ADD HL,BC ; - LD (CURADDRESS),HL ; - RET - - - - - - - -;__HXOUT_________________________________________________________________________________________________________________________ -; -; PRINT THE ACCUMULATOR CONTENTS AS HEX DATA ON THE SERIAL PORT -;________________________________________________________________________________________________________________________________ -; -HXOUT: - PUSH BC ; SAVE BC - LD B,A ; - RLC A ; DO HIGH NIBBLE FIRST - RLC A ; - RLC A ; - RLC A ; - AND 0FH ; ONLY THIS NOW - ADD A,30H ; TRY A NUMBER - CP 3AH ; TEST IT - JR C,OUT1 ; IF CY SET PRINT 'NUMBER' - ADD A,07H ; MAKE IT AN ALPHA -OUT1: - CALL COUT ; SCREEN IT - LD A,B ; NEXT NIBBLE - AND 0FH ; JUST THIS - ADD A,30H ; TRY A NUMBER - CP 3AH ; TEST IT - JR C,OUT2 ; PRINT 'NUMBER' - ADD A,07H ; MAKE IT ALPHA -OUT2: - CALL COUT ; SCREEN IT - POP BC ; RESTORE BC - RET ; - - -;__SPACE_________________________________________________________________________________________________________________________ -; -; PRINT A SPACE CHARACTER ON THE SERIAL PORT -;________________________________________________________________________________________________________________________________ -; -SPACE: - PUSH AF ; STORE AF - LD A,20H ; LOAD A "SPACE" - CALL COUT ; SCREEN IT - POP AF ; RESTORE AF - RET ; DONE - -;__CRLF_________________________________________________________________________________________________________________________ -; -; PRINT A CR/LF -;________________________________________________________________________________________________________________________________ -; -CRLF: - PUSH AF ; STORE AF - LD A,0DH ; LOAD A "SPACE" - CALL COUT ; SCREEN IT - LD A,0AH ; LOAD A "SPACE" - CALL COUT ; SCREEN IT - POP AF ; RESTORE AF - RET ; DONE - -;__COUT_________________________________________________________________________________________________________________________ -; -; PRINT CONTENTS OF A -;________________________________________________________________________________________________________________________________ -; -COUT: - PUSH BC ; - PUSH AF ; - PUSH HL ; - PUSH DE ; - - LD (COUT_BUFFER),A ; - LD DE,COUT_BUFFER ; - LD C,09H ; CP/M WRITE START STRING TO CONSOLE CALL - CALL 0005H - POP DE ; - POP HL ; - POP AF ; - POP BC ; - RET ; DONE - - - - -;__PHL_________________________________________________________________________________________________________________________ -; -; PRINT THE HL REG ON THE SERIAL PORT -;________________________________________________________________________________________________________________________________ -; -PHL: - LD A,H ; GET HI BYTE - CALL HXOUT ; DO HEX OUT ROUTINE - LD A,L ; GET LOW BYTE - CALL HXOUT ; HEX IT - CALL SPACE ; - RET ; DONE - -COUT_BUFFER: - .DB 00 - .DB "$" - -BASE_MSG: - .TEXT "CP/M IMAGE=" - .db "$" -END_MSG: - .TEXT "TO " - .db "$" -SECTOR_MSG: - .TEXT "SECTORS/TRACK=" - .db "$" - -DRIVE_MSG: - .TEXT "DRIVE=" - .db "$" - - -;__CBIOS_________________________________________________________________________________________________________________________ -; -; CBIOS JUMP TABLE -;________________________________________________________________________________________________________________________________ -; - -SELDSK: ;SELECT DISK - PUSH BC ; - LD HL,(0001H) ; - LD BC,0024 ; - ADD HL,BC ; - POP BC ; - JP (HL) ; -SETTRK: ;SET DISK TRACK ADDR - PUSH BC ; - LD HL,(0001H) ; - LD BC,0027 ; - ADD HL,BC ; - POP BC ; - JP (HL) ; -SETSEC: ;SET DISK SECTOR ADDR - PUSH BC ; - LD HL,(0001H) ; - LD BC,0030 ; - ADD HL,BC ; - POP BC ; - JP (HL) ; -SETDMA: ;SET DMA BUFFER ADDR - PUSH BC ; - LD HL,(0001H) ; - LD BC,0033 ; - ADD HL,BC ; - POP BC ; - JP (HL) ; -READ: ;READ SECTOR - PUSH BC ; - LD HL,(0001H) ; - LD BC,0036 ; - ADD HL,BC ; - POP BC ; - JP (HL) ; -WRITE: ;WRITE SECTOR - PUSH BC ; - LD HL,(0001H) ; - LD BC,0039 ; - ADD HL,BC ; - POP BC ; - JP (HL) ; - - - -CURTRACK: .DW 0 ; CURRENT TRACK -CURSECTOR: .DW 0 ; CURRENT SECTOR -CURADDRESS: .DW 0 ; CURRENT CP/M ADDRESS -DMAAD: .DW 5000H ; DIRECT MEMORY ADDRESS - -CPMEND: .DW 0FDFFH ; END OF CP/M -SECTRACK: .DW 0100H ; SECTORS PER TRACK -CPMSTART: .DW 0D000H ; START OF CP/M -DEVICENUMBER: .DB 2 ; DEVICE ID - - - -MSG_END: - .DB LF, CR ; LINE FEED AND CARRIAGE RETURN - .TEXT "BOOTGEN COMPLETED." - .DB LF, CR ; LINE FEED AND CARRIAGE RETURN - .DB "$" ; LINE TERMINATOR -MSG_VALID: - .DB LF, CR ; LINE FEED AND CARRIAGE RETURN - .TEXT "USAGE: BOOTGEN (DRIVE):" - .DB LF, CR ; LINE FEED AND CARRIAGE RETURN - .TEXT "(DRIVE) IS ANY VALID CP/M DRIVE:" - .DB LF, CR ; LINE FEED AND CARRIAGE RETURN - .DB "$" ; LINE TERMINATOR - - - .END - - - \ No newline at end of file diff --git a/Source/HBIOS/Old/bootrom.asm b/Source/HBIOS/Old/bootrom.asm deleted file mode 100644 index 95646a39..00000000 --- a/Source/HBIOS/Old/bootrom.asm +++ /dev/null @@ -1,177 +0,0 @@ -;___BOOTROM____________________________________________________________________________________________________________ -; -; ROM BOOT MANAGER -; -; HARDWARE COLD START WILL JUMP HERE FOR INITIALIZATION -;______________________________________________________________________________________________________________________ -; -; -#INCLUDE "std.asm" -; - .ORG $100 -; - DI ; NO INTERRUPTS - IM 1 ; INTERRUPT MODE 1 - LD SP,HBX_LOC ; SP IN RAM -; -; -; PERFORM MINIMAL Z180 SPECIFIC INITIALIZATION -; -#IFNDEF UNALOAD -; -#IF ((PLATFORM == PLT_N8) | (PLATFORM == PLT_MK4)) - ; SET BASE FOR CPU IO REGISTERS - LD A,CPU_BASE - OUT0 (CPU_ICR),A - - ; SET DEFAULT CPU CLOCK MULTIPLIERS (XTAL / 2) - XOR A - OUT0 (CPU_CCR),A - OUT0 (CPU_CMR),A - - ; SET DEFAULT WAIT STATES - LD A,$F0 - OUT0 (CPU_DCNTL),A - -#IF (Z180_CLKDIV >= 1) - ; SET CLOCK DIVIDE TO 1 RESULTING IN FULL XTAL SPEED - LD A,$80 - OUT0 (CPU_CCR),A -#ENDIF - -#IF (Z180_CLKDIV >= 2) - ; SET CPU MULTIPLIER TO 1 RESULTINT IN XTAL * 2 SPEED - LD A,$80 - OUT0 (CPU_CMR),A -#ENDIF - ; SET DESIRED WAIT STATES - LD A,0 + (Z180_MEMWAIT << 6) | (Z180_IOWAIT << 4) - OUT0 (CPU_DCNTL),A - - ; MMU SETUP - LD A,$80 - OUT0 (CPU_CBAR),A ; SETUP FOR 32K/32K BANK CONFIG - XOR A - OUT0 (CPU_BBR),A ; BANK BASE = 0 - LD A,(RAMSIZE + RAMBIAS - 64) >> 2 - OUT0 (CPU_CBR),A ; COMMON BASE = LAST (TOP) BANK -#ENDIF -; -#ENDIF -; -; EMIT FIRST SIGN OF LIFE TO SERIAL PORT -; - CALL XIO_INIT ; INIT SERIAL PORT - LD HL,STR_BOOT ; POINT TO MESSAGE - CALL XIO_OUTS ; SAY HELLO -; -; COPY OURSELVES AND LOADER TO HI RAM FOR PHASE 2 -; - LD HL,0 ; COPY FROM START OF ROM IMAGE - LD DE,$8000 ; TO HIMEM $8000 - LD BC,$1000 ; COPY 4K - LDIR -; - CALL XIO_DOT ; MARK PROGRESS -; - JP PHASE2 ; JUMP TO PHASE 2 BOOT IN UPPER MEMORY -; -STR_BOOT .DB "RomWBW$" -; -; IMBED DIRECT SERIAL I/O ROUTINES -; -#INCLUDE "xio.asm" -; -;______________________________________________________________________________________________________________________ -; -; THIS IS THE PHASE 2 CODE THAT MUST EXECUTE IN UPPER MEMORY -; - .ORG $ + $8000 ; WE ARE NOW EXECUTING IN UPPER MEMORY -; -PHASE2: - CALL XIO_DOT ; MARK PROGRESS -; -#IF (PLATFORM == PLT_UNA) - ; SWITCH TO EXEC PAGE IN BANKED MEMORY - LD BC,$01FB ; SET BANK - LD DE,$800E ; EXEC_PAGE (SEE PAGES.INC) - CALL $FFFD ; DO IT -; - ; MARK PROGRESS VIA UNA CHAR OUTPUT - LD BC,$0012 ; UNA UNIT = 0, FUNC WRITE CHAR - LD E,'.' ; DOT - CALL $FFFD ; CALL UNA ENTRY DIRECTLY, RST 08 NOT SETUP YET -; - ; INSTALL UNA INVOCATION VECTOR FOR RST 08 - LD A,$C3 ; JP INSTRUCTION - LD (8),A ; STORE AT 0x0008 - LD HL,($FFFE) ; UNA ENTRY VECTOR - LD (9),HL ; STORE AT 0x0009 -; - LD BC,$0012 ; UNA UNIT = 0, FUNC = WRITE CHAR - LD E,'.' ; DOT - RST 08 ; RST 08 IS NOW POSSIBLE - - ; IF RUNNING UNDER UNA, WE ARE DONE, PROCEED TO LOADER - JP $8400 ; JUMP TO LOADER - -#ELSE - -; -; COPY HBIOS IMAGE FROM ROM TO RAM -; - LD HL,0 ; HL = LOCATION IN LOMEM TO COPY FROM/TO -LOOP: - LD DE,$9000 ; DE = BUFFER ADDRESS - LD BC,$1000 ; BYTES TO COPY (4K CHUNKS) - PUSH BC ; SAVE COPY SIZE - PUSH DE ; SAVE COPY DEST - PUSH HL ; SAVE COPY SOURCE - LD A,BID_HBIMG ; ROM PAGE WITH HBIOS IMAGE - CALL PGSEL ; SELECT IT - LDIR ; COPY ROM -> BUFFER - POP DE ; RESTORE SOURCE AS NEW DESTINATION - POP HL ; RESTORE DESTINATION AS NEW SOURCE - POP BC ; RESTORE COPY SIZE - LD A,BID_HB ; HBIOS RAM PAGE - CALL PGSEL ; SELECT IT - LDIR ; COPY BUFFER -> RAM - EX DE,HL ; GET LOMEM POINTER BACK TO HL - LD A,H ; HIGH BYTE OF POINTER TO A - CP $80 ; HIGH BYTE WILL BE $80 WHEN WE ARE DONE - JP NZ,LOOP ; IF NOT DONE, LOOP TO DO NEXT 4K CHUNK -; - LD A,BID_BOOT ; ROM PAGE WITH BOOT IMAGE - CALL PGSEL ; SELECT IT - CALL XIO_DOT ; MARK PROGRESS -; -; INITIALIZE HBIOS AND JUMP TO LOADER -; - ; CALL HBIOS HARDWARE INITIALIZATION - LD A,BID_HB ; HBIOS RAM PAGE - CALL PGSEL ; SELECT IT - CALL $1000 ; CALL HBIOS INITIALIZATION -; - ; CALL HBIOS PROXY INITIALIZATION - LD A,BID_USR ; USER RAM PAGE - CALL PGSEL ; SELECT IT - CALL HBX_LOC ; CALL HBIOS PROXY INITIALIZATION -; - JP $8400 ; JUMP TO LOADER -;______________________________________________________________________________________________________________________ -; -; NOTE THAT MEMORY MANAGER CODE IS IN UPPER MEMORY! -; -#INCLUDE "memmgr.asm" - -#ENDIF - -;______________________________________________________________________________________________________________________ -; -; PAD OUT REMAINDER OF PAGE -; - .FILL $8200 - $,$FF ; PAD OUT REMAINDER OF PAGE -; -STACK .EQU $ ; STACK IN HIMEM SLACK SPACE -; - .END diff --git a/Source/HBIOS/Old/cbios.asm b/Source/HBIOS/Old/cbios.asm deleted file mode 100644 index 8f0ae584..00000000 --- a/Source/HBIOS/Old/cbios.asm +++ /dev/null @@ -1,2542 +0,0 @@ -;__________________________________________________________________________________________________ -; -; CBIOS FOR SBC -; -; BY ANDREW LYNCH, WITH INPUT FROM MANY SOURCES -; ROMWBW ADAPTATION BY WAYNE WARTHEN -;__________________________________________________________________________________________________ -; -; The std.asm file contains the majority of the standard equates -; that describe data structures, magic values and bit fields used -; by the CBIOS. -; -#INCLUDE "std.asm" -; - .ORG CBIOS_LOC ; DEFINED IN STD.ASM -; -STACK .EQU CBIOS_END ; USE SLACK SPACE FOR STACK AS NEEDED -; -;================================================================================================== -; CP/M JUMP VECTOR TABLE FOR INDIVIDUAL SUBROUTINES -;================================================================================================== -; These jumps are defined in the CP/M-80 v2.2 system guide and comprise -; the invariant part of the BIOS. -; - JP BOOT ; #0 - COLD START -WBOOTE JP WBOOT ; #1 - WARM START - JP CONST ; #2 - CONSOLE STATUS - JP CONIN ; #3 - CONSOLE CHARACTER IN - JP CONOUT ; #4 - CONSOLE CHARACTER OUT - JP LIST ; #5 - LIST CHARACTER OUT - JP PUNCH ; #6 - PUNCH CHARACTER OUT - JP READER ; #7 - READER CHARACTER IN - JP HOME ; #8 - MOVE HEAD TO HOME POSITION - JP SELDSK ; #9 - SELECT DISK - JP SETTRK ; #10 - SET TRACK NUMBER - JP SETSEC ; #11 - SET SECTOR NUMBER - JP SETDMA ; #12 - SET DMA ADDRESS - JP READ ; #13 - READ DISK - JP WRITE ; #14 - WRITE DISK - JP LISTST ; #15 - RETURN LIST STATUS - JP SECTRN ; #16 - SECTOR TRANSLATE -; -;================================================================================================== -; CBIOS STAMP FOR ROMWBW -;================================================================================================== -; -; RomWBW CBIOS places the following stamp data into page zero -; at address $40. The address range $40-$4F is reserved by CP/M -; as a scratch area for CBIOS. This data below is copied there at -; every warm start. It allows applications to identify RomWBW CBIOS. -; Additionally, it contains a pointer to additional CBIOS extension -; data (CBX) specific to RomWBW CBIOS. -; -; RomWBW CBIOS page zero stamp starts at $40 -; $40-$41: Marker ('W', ~'W') -; $42-$43: Version bytes: major/minor, update/patch -; $44-$45: CBIOS Extension Info address -; -STPLOC .EQU $40 -STPIMG: .DB 'W',~'W' ; MARKER - .DB RMJ << 4 | RMN ; FIRST BYTE OF VERSION INFO - .DB RUP << 4 | RTP ; SECOND BYTE OF VERSION INFO - .DW CBX ; ADDRESS OF CBIOS EXT DATA -STPSIZ .EQU $ - STPIMG -; -; The following section contains key information and addresses for the -; RomWBW CBIOS. A pointer to the start of this section is stored with -; with the ZPX data in page zero at $44 (see above). -; -CBX: -DEVMAPADR .DW DEVMAP ; DEVICE MAP ADDRESS -DRVMAPADR .DW 0 ; DRIVE MAP ADDRESS (FILLED IN LATER) -DPBMAPADR .DW DPBMAP ; DPB MAP ADDRESS -; -CBXSIZ .EQU $ - CBX - .ECHO "CBIOS extension info occupies " - .ECHO CBXSIZ - .ECHO " bytes.\n" -; -;================================================================================================== -; CHARACTER DEVICE MAPPING -;================================================================================================== -; -; MAP LOGICAL CHARACTER DEVICES TO PHYSICAL CHARACTER DEVICES -; -; IOBYTE (0003H) -; ============== -; -; Device LST: PUN: RDR: CON: -; Bit position 7 6 5 4 3 2 1 0 -; -; Dec Binary -; -; 0 00 TTY: TTY: TTY: TTY: -; 1 01 CRT: PTP: PTR: CRT: -; 2 10 LPT: UP1: UR1: BAT: -; 3 11 UL1: UP2: UR2: UC1: -; -; TTY: Teletype device (slow speed console) -; CRT: Cathode ray tube device (high speed console) -; BAT: Batch processing (input from RDR:, output to LST:) -; UC1: User-defined console -; PTR: Paper tape reader (high speed reader) -; UR1: User-defined reader #1 -; UR2: User-defined reader #2 -; PTP: Paper tape punch (high speed punch) -; UP1: User-defined punch #1 -; UP2: User-defined punch #2 -; LPT: Line printer -; UL1: User-defined list device #1 -; -#IF (PLATFORM == PLT_UNA) - -LD_TTY .EQU 0 ; -> COM0: -LD_CRT .EQU 0 ; -> COM14: -LD_BAT .EQU CIODEV_BAT -LD_UC1 .EQU 0 ; -> COM1: -LD_PTR .EQU 0 ; -> COM1: -LD_UR1 .EQU 0 ; -> COM2: -LD_UR2 .EQU 0 ; -> COM3: -LD_PTP .EQU 0 ; -> COM1: -LD_UP1 .EQU 0 ; -> COM2: -LD_UP2 .EQU 0 ; -> COM3: -LD_LPT .EQU 0 ; -> LPT0: -LD_UL1 .EQU 0 ; -> LPT1: - -#ELSE - -LD_TTY .EQU CIODEV_CONSOLE ; -> COM0: -LD_CRT .EQU CIODEV_CRT ; -> COM14: -LD_BAT .EQU CIODEV_BAT -LD_UC1 .EQU CIODEV_CONSOLE ; -> COM1: -LD_PTR .EQU CIODEV_CONSOLE ; -> COM1: -LD_UR1 .EQU CIODEV_CONSOLE ; -> COM2: -LD_UR2 .EQU CIODEV_CONSOLE ; -> COM3: -LD_PTP .EQU CIODEV_CONSOLE ; -> COM1: -LD_UP1 .EQU CIODEV_CONSOLE ; -> COM2: -LD_UP2 .EQU CIODEV_CONSOLE ; -> COM3: -LD_LPT .EQU CIODEV_CONSOLE ; -> LPT0: -LD_UL1 .EQU CIODEV_CONSOLE ; -> LPT1: - -#ENDIF -; -DEVMAP: -; - ; CONSOLE - .DB LD_TTY ; CON:=TTY: (IOBYTE XXXXXX00) - .DB LD_CRT ; CON:=CRT: (IOBYTE XXXXXX01) - .DB LD_BAT ; CON:=BAT: (IOBYTE XXXXXX10) - .DB LD_UC1 ; CON:=UC1: (IOBYTE XXXXXX11) - ; READER - .DB LD_TTY ; RDR:=TTY: (IOBYTE XXXX00XX) - .DB LD_PTR ; RDR:=PTR: (IOBYTE XXXX01XX) - .DB LD_UR1 ; RDR:=UR1: (IOBYTE XXXX10XX) - .DB LD_UR2 ; RDR:=UR2: (IOBYTE XXXX11XX) - ; PUNCH - .DB LD_TTY ; PUN:=TTY: (IOBYTE XX00XXXX) - .DB LD_PTP ; PUN:=PTP: (IOBYTE XX01XXXX) - .DB LD_UP1 ; PUN:=UP1: (IOBYTE XX10XXXX) - .DB LD_UP2 ; PUN:=UP2: (IOBYTE XX11XXXX) - ; LIST - .DB LD_TTY ; LST:=TTY: (IOBYTE 00XXXXXX) - .DB LD_CRT ; LST:=CRT: (IOBYTE 01XXXXXX) - .DB LD_LPT ; LST:=LPT: (IOBYTE 10XXXXXX) - .DB LD_UL1 ; LST:=UL1: (IOBYTE 11XXXXXX) -; -;================================================================================================== -; DRIVE MAPPING TABLE -;================================================================================================== -; -; Disk mapping is done using a drive map table (DRVMAP) which is built -; dynamically at cold boot. See the DRV_INIT routine. This table is -; made up of entries as documented below. The table is prefixed with one -; byte indicating the number of entries. The index of the entry indicates -; the drive letter, so the first entry is A:, the second entry is B:, etc. -; -; BYTE: DEVICE/UNIT (OR JUST UNIT FOR UNA) -; BYTE: SLICE -; WORD: ADDRESS OF DPH FOR THE DRIVE -; -;================================================================================================== -; DPB MAPPING TABLE -;================================================================================================== -; -; MAP MEDIA ID'S TO APPROPRIATE DPB ADDRESSEES -; THE ENTRIES IN THIS TABLE MUST CONCIDE WITH THE VALUES -; OF THE MEDIA ID'S (SAME SEQUENCE, NO GAPS) -; - .DB DPBCNT -; -DPBMAP: - .DW 0 ; MID_NONE (NO MEDIA) - .DW DPB_ROM ; MID_MDROM - .DW DPB_RAM ; MID_MDRAM - .DW DPB_RF ; MID_RF - .DW DPB_HD ; MID_HD - .DW DPB_FD720 ; MID_FD720 - .DW DPB_FD144 ; MID_FD144 - .DW DPB_FD360 ; MID_FD360 - .DW DPB_FD120 ; MID_FD120 - .DW DPB_FD111 ; MID_FD111 -; -DPBCNT .EQU ($ - DPBMAP) / 2 -; -;================================================================================================== -; BIOS FUNCTIONS -;================================================================================================== -; -;__________________________________________________________________________________________________ - -BOOT: - ; STANDARD BOOT INVOCATION - DI - IM 1 - LD SP,STACK ; STACK FOR INITIALIZATION -; - CALL INIT ; EXECUTE COLD BOOT CODE ROUTINE -; - LD SP,$100 ; MOVE STACK SO WE CAN INIT BUFFER AREA - LD HL,INIT ; INIT BUFFERS AREA - LD BC,CBIOS_END - INIT ; SIZE OF BUFFER SPACE - CALL FILL ; DO IT -; - LD SP,STACK ; PUT STACK BACK WHERE IT BELONGS - JR GOCPM ; THEN OFF TO CP/M WE GO... -; -;__________________________________________________________________________________________________ -WBOOT: - DI - IM 1 -; - LD SP,STACK ; STACK FOR INITIALIZATION -; -#IF (PLATFORM == PLT_UNA) - ; RESTORE COMMAND PROCESSOR FROM UNA BIOS CACHE - LD BC,$01FB ; UNA FUNC = SET BANK - LD DE,BID_BIOS ; UBIOS_PAGE (SEE PAGES.INC) - RST 08 ; DO IT - PUSH DE ; SAVE PREVIOUS BANK - - LD HL,(CCPBUF) ; ADDRESS OF CCP BUF IN BIOS MEM - LD DE,CPM_LOC ; ADDRESS IN HI MEM OF CCP - LD BC,CCP_SIZ ; SIZE OF CCP - LDIR ; DO IT - - LD BC,$01FB ; UNA FUNC = SET BANK - POP DE ; RECOVER OPERATING BANK - RST 08 ; DO IT -#ELSE - ; RESTORE COMMAND PROCESSOR FROM CACHE IN HB BANK - LD B,BF_SYSXCPY ; HBIOS FUNC: SYSTEM EXTENDED COPY - LD D,BID_USR ; D = DEST BANK = USR BANK = TPA - LD E,BID_BIOS ; E = SRC BANK = HB BANK - RST 08 ; SET BANKS FOR INTERBANK COPY - LD B,BF_SYSCPY ; HBIOS FUNC: SYSTEM COPY - LD HL,(CCPBUF) ; COPY FROM FIXED LOCATION IN HB BANK - LD DE,CPM_LOC ; TO CCP LOCATION IN USR BANK - LD IX,CCP_SIZ ; COPY CONTENTS OF COMMAND PROCESSOR - RST 08 ; DO IT -#ENDIF -; - ; SOME APPLICATIONS STEAL THE BDOS SERIAL NUMBER STORAGE - ; AREA (FIRST 6 BYTES OF BDOS) ASSUMING IT WILL BE RESTORED - ; AT WARM BOOT BY RELOADING OF BDOS. WE DON'T WANT TO RELOAD - ; BDOS, SO INSTEAD THE SERIAL NUMBER STORAGE IS FIXED HERE - ; SO THAT THE DRI SERIAL NUMBER VERIFICATION DOES NOT FAIL - LD HL,BDOS_LOC - LD B,6 -WBOOT1: LD (HL),0 - INC HL - DJNZ WBOOT1 -; - ; FALL THRU TO INVOKE CP/M -; -;__________________________________________________________________________________________________ -GOCPM: -#IF (PLATFORM == PLT_UNA) - ; USE A DEDICATED BUFFER FOR UNA PHYSICAL DISK I/O - LD HL,SECBUF ; ADDRESS OF PHYSICAL SECTOR BUFFER - LD (BUFADR),HL ; SAVE IT IN BUFADR FOR LATER -#ELSE - ; CALL BF_DIOSETBUF WITH A PARM OF ZERO TO CAUSE IT TO RESET - ; THE PHYSICAL DISK BUFFER TO THE DEFAULT LOCATION PRE-ALLOCATED - ; INSIDE OF THE HBIOS BANK. THE ADDRESS IS RETURNED IN HL AND SAVED. - LD B,BF_DIOSETBUF ; GET DISK BUFFER ADR IN HBIOS DRIVER BANK - LD HL,0 - RST 08 ; MAKE HBIOS CALL - LD (BUFADR),HL ; RECORD THE BUFFER ADDRESS -#ENDIF -; - LD A,$C3 ; LOAD A WITH 'JP' INSTRUCTION (USED BELOW) -; - ; CPU RESET / RST 0 / JP 0 -> WARM START CP/M - LD ($0000),A ; JP OPCODE GOES HERE - LD HL,WBOOTE ; GET WARM BOOT ENTRY ADDRESS - LD ($0001),HL ; AND PUT IT AT $0001 - -; ; INT / RST 38 -> INVOKE MONITOR -; LD ($0038),A -; LD HL,GOMON -; LD ($0039),HL - -; ; INT / RST 38 -> PANIC -; LD ($0038),A -; LD HL,PANIC ; PANIC ROUTINE ADDRESS -; LD ($0039),HL ; POKE IT - - ; CALL 5 -> INVOKE BDOS - LD ($0005),A ; JP OPCODE AT $0005 - LD HL,BDOS_LOC + 6 ; GET BDOS ENTRY ADDRESS - LD ($0006),HL ; PUT IT AT $0006 -; - ; INSTALL ROMWBW CBIOS PAGE ZERO STAMP AT $40 - LD HL,STPIMG ; FORM STAMP DATA IMAGE - LD DE,STPLOC ; TO IT'S LOCATION IN PAGE ZERO - LD BC,STPSIZ ; SIZE OF BLOCK TO COPY - LDIR ; DO IT -; - ; RESET (DE)BLOCKING ALGORITHM - CALL BLKRES -; - ; DEFAULT DMA ADDRESS - LD BC,$80 ; DEFAULT DMA ADDRESS IS $80 - CALL SETDMA ; SET IT -; - ; ENSURE VALID DISK AND JUMP TO CCP - LD A,(CDISK) ; GET CURRENT USER/DISK - AND $0F ; ISOLATE DISK PART - LD C,A ; SETUP C WITH CURRENT USER/DISK, ASSUME IT IS OK - CALL DSK_STATUS ; CHECK DISK STATUS - JR Z,CURDSK ; ZERO MEANS OK - LD A,(DEFDRIVE) ; CURRENT DRIVE NOT READY, USE DEFAULT - JR GOCCP ; JUMP TO COMMAND PROCESSOR -CURDSK: - LD A,(CDISK) ; GET CURRENT USER/DISK -GOCCP: - LD C,A ; SETUP C WITH CURRENT USER/DISK, ASSUME IT IS OK - JP CCP_ENT ; JUMP TO COMMAND PROCESSOR -; -;__________________________________________________________________________________________________ -GOMON: - CALL PANIC -; -; DI -; IM 1 -; -; LD SP,STACK -; -; ; RELOAD MONITOR INTO RAM (IN CASE IT HAS BEEN OVERWRITTEN) -; CALL ROMPGZ -; LD HL,MON_IMG -; LD DE,MON_LOC -; LD BC,MON_SIZ -; LDIR -; CALL RAMPGZ - -; ; JUMP TO MONITOR WARM ENTRY -; JP MON_UART -; -; -;================================================================================================== -; CHARACTER BIOS FUNCTIONS -;================================================================================================== -; -;__________________________________________________________________________________________________ -; -;__________________________________________________________________________________________________ -CONST: -; CONSOLE STATUS, RETURN $FF IF CHARACTER READY, $00 IF NOT -; - LD B,BF_CIOIST ; B = FUNCTION - LD HL,CIOST ; HL = ADDRESS OF COMPLETION ROUTINE - JR CONIO -; -;__________________________________________________________________________________________________ -CONIN: -; CONSOLE CHARACTER INTO REGISTER A -; - LD B,BF_CIOIN ; B = FUNCTION - LD HL,CIOIN ; HL = ADDRESS OF COMPLETION ROUTINE - JR CONIO - -;__________________________________________________________________________________________________ -CONOUT: -; CONSOLE CHARACTER OUTPUT FROM REGISTER C -; - LD B,BF_CIOOUT ; B = FUNCTION - POP HL ; NO COMPLETION ROUTINE, SETUP DIRECT RETURN TO CALLER - LD E,C ; E = CHARACTER TO SEND -; JR CONIO ; COMMENTED OUT, FALL THROUGH OK -; -;__________________________________________________________________________________________________ -CONIO: -; - LD A,(IOBYTE) ; GET IOBYTE - AND $03 ; ISOLATE RELEVANT IOBYTE BITS FOR CONSOLE -; OR $00 ; PUT LOGICAL DEVICE IN BITS 2-3 (CON:=$00, RDR:=$04, PUN:=$08, LST:=$0C - JR CIO_DISP -; -;__________________________________________________________________________________________________ -LIST: -; LIST CHARACTER FROM REGISTER C -; - LD B,BF_CIOOUT ; B = FUNCTION - POP HL ; NO COMPLETION ROUTINE, SETUP DIRECT RETURN TO CALLER - LD E,C ; E = CHARACTER TO SEND - JR LISTIO -; -;__________________________________________________________________________________________________ -LISTST: -; RETURN LIST STATUS (0 IF NOT READY, 1 IF READY) -; - LD B,BF_CIOOST ; B = FUNCTION - LD HL,CIOST ; HL = ADDRESS OF COMPLETION ROUTINE -; JR LISTIO ; COMMENTED OUT, FALL THROUGH OK -; -;__________________________________________________________________________________________________ -LISTIO: -; - LD A,(IOBYTE) ; GET IOBYTE - RLCA ; SHIFT RELEVANT BITS TO BITS 0-1 - RLCA - AND $03 ; ISOLATE RELEVANT IOBYTE BITS FOR LST: - OR $0C ; PUT LOGICAL DEVICE IN BITS 2-3 (CON:=$00, RDR:=$04, PUN:=$08, LST:=$0C - JR CIO_DISP -; -;__________________________________________________________________________________________________ -PUNCH: -; PUNCH CHARACTER FROM REGISTER C -; - LD B,BF_CIOOUT ; B = FUNCTION - POP HL ; NO COMPLETION ROUTINE, SETUP DIRECT RETURN TO CALLER - LD E,C ; E = CHARACTER TO SEND -; JR PUNCHIO ; COMMENTED OUT, FALL THROUGH OK -; -;__________________________________________________________________________________________________ -PUNCHIO: -; - LD A,(IOBYTE) ; GET IOBYTE - RLCA ; SHIFT RELEVANT BITS TO BITS 0-1 - RLCA - RLCA - RLCA - AND $03 ; ISOLATE RELEVANT IOBYTE BITS FOR PUN: - OR $08 ; PUT LOGICAL DEVICE IN BITS 2-3 (CON:=$00, RDR:=$04, PUN:=$08, LST:=$0C - JR CIO_DISP -; -;__________________________________________________________________________________________________ -READER: -; READ CHARACTER INTO REGISTER A FROM READER DEVICE -; - LD B,BF_CIOIN ; B = FUNCTION - LD HL,CIOIN ; HL = ADDRESS OF COMPLETION ROUTINE - JR READERIO -; -;__________________________________________________________________________________________________ -READERST: -; RETURN READER STATUS (0 IF NOT READY, 1 IF READY) -; - LD B,BF_CIOIST ; B = FUNCTION - LD HL,CIOST ; HL = ADDRESS OF COMPLETION ROUTINE -; JR READERIO ; COMMENTED OUT, FALL THROUGH OK -; -;__________________________________________________________________________________________________ -READERIO: -; - LD A,(IOBYTE) ; GET IOBYTE - RRCA ; SHIFT RELEVANT BITS TO BITS 0-1 - RRCA - AND $03 ; ISOLATE RELEVANT IOBYTE BITS FOR RDR: - OR $04 ; PUT LOGICAL DEVICE IN BITS 2-3 (CON:=$00, RDR:=$04, PUN:=$08, LST:=$0C - JR CIO_DISP -; -;__________________________________________________________________________________________________ -CIOIN: -; COMPLETION ROUTINE FOR CHARACTER INPUT FUNCTIONS -; - LD A,E ; MOVE CHARACTER RETURNED TO A - RET ; FALL THRU -;; -;;__________________________________________________________________________________________________ -;CIOOUT: -;; COMPLETION ROUTINE FOR CHARACTER OUTPUT FUNCTIONS -;; - RET -; -;__________________________________________________________________________________________________ -CIOST: -; COMPLETION ROUTINE FOR CHARACTER STATUS FUNCTIONS (IST/OST) -; -#IF (PLATFORM == PLT_UNA) - LD A,E -#ENDIF - OR A ; SET FLAGS - RET Z ; NO CHARACTERS WAITING (IST) OR OUTPUT BUF FULL (OST) - OR $FF ; $FF SIGNALS READY TO READ (IST) OR WRITE (OST) - RET -; -;================================================================================================== -; CHARACTER DEVICE INTERFACE -;================================================================================================== -; -; ROUTING FOR CHARACTER DEVICE FUNCTIONS -; A = INDEX INTO DEVICE MAP BASED ON IOBYTE BIOS REQUEST -; B = FUNCTION REQUESTED: BF_CIO(IN/OUT/IST/OST) -; E = CHARACTER (IF APPLICABLE TO FUNCTION) -; HL = ADDRESS OF COMPLETION ROUTINE -; -CIO_DISP: - PUSH HL ; PUT COMPLETION ROUTINE ON STACK - - ; LOOKUP IOBYTE MAPPED DEVICE CODE - AND $0F ; ISOLATE INDEX INTO DEVICE MAP - - LD HL,DEVMAP ; HL = ADDRESS OF DEVICE MAP - CALL ADDHLA ; ADD OFFSET - - LD A,(HL) ; LOOKUP DEVICE CODE -#IF (PLATFORM == PLT_UNA) - LD C,B ; MOVE FUNCTION TO C - LD B,A ; DEVICE GOES IN B -#ELSE - LD C,A ; SAVE IN C FOR BIOS USAGE -#ENDIF - - CP CIODEV_BAT ; CHECK FOR SPECIAL DEVICE (BAT, NUL) - JR NC,CIO_DISP1 ; HANDLE SPECIAL DEVICE - RST 08 ; RETURN VIA COMPLETION ROUTINE SET AT START - RET - -CIO_DISP1: - ; HANDLE SPECIAL DEVICES - AND $F0 ; ISOLATE DEVICE - CP CIODEV_BAT ; BAT: ? - JR Z,CIO_BAT ; YES, GO TO BAT DEVICE HANDLER - CP CIODEV_NUL ; NUL: ? - JR Z,CIO_NUL ; YES, GO TO NUL DEVICE HANDLER - CALL PANIC ; SOMETHING BAD HAPPENED -; -; BAT: IS A PSEUDO DEVICE REDIRECTING INPUT TO READER AND OUTPUT TO LIST -; -CIO_BAT: - LD C,E ; PUT CHAR BACK IN C - LD A,B ; GET REQUESTED FUNCTION - CP BF_CIOIN ; INPUT? - JR Z,READER ; -> READER - CP BF_CIOIST ; INPUT STATUS? - JR Z,READERST ; -> READER - CP BF_CIOOUT ; OUTPUT? - JR Z,LIST ; -> LIST - CP BF_CIOOST ; OUTPUT STATUS? - JR Z,LISTST ; -> LIST - CALL PANIC ; SOMETHING BAD HAPPENED -; -; NUL: IS A DUMMY DEVICE THAT DOES NOTHING -; -CIO_NUL: - LD A,B ; FUNCTION - CP BF_CIOIN - JR Z,NUL_IN - CP BF_CIOIST - JR Z,NUL_IST - CP BF_CIOOUT - JR Z,NUL_OUT - CP BF_CIOOST - JR Z,NUL_OST - CALL PANIC -; -NUL_IN: - LD E,$1B ; RETURN EOF -NUL_OUT: - RET ; SWALLOW CHARACTER -; -NUL_IST: -NUL_OST: - OR $FF ; A=$FF & NZ (READY) - RET -; -;================================================================================================== -; DISK BIOS FUNCTIONS -;================================================================================================== -; -;__________________________________________________________________________________________________ -SELDSK: -; SELECT DISK NUMBER FOR SUBSEQUENT DISK OPS -#IF DSKTRACE - CALL PRTSELDSK ; *DEBUG* -#ENDIF -; - JP DSK_SELECT -; -;__________________________________________________________________________________________________ -HOME: -; SELECT TRACK 0 (BC = 0) AND FALL THRU TO SETTRK -#IF DSKTRACE - CALL PRTHOME ; *DEBUG* -#ENDIF -; - LD A,(HSTWRT) ; CHECK FOR PENDING WRITE - OR A ; SET FLAGS - JR NZ,HOMED ; BUFFER IS DIRTY - LD (HSTACT),A ; CLEAR HOST ACTIVE FLAG -; -HOMED: - LD BC,0 -; -;__________________________________________________________________________________________________ -SETTRK: -; SET TRACK GIVEN BY REGISTER BC - LD (SEKTRK),BC - RET -; -;__________________________________________________________________________________________________ -SETSEC: -; SET SECTOR GIVEN BY REGISTER BC - LD (SEKSEC),BC - RET -; -;__________________________________________________________________________________________________ -SECTRN: -; SECTOR TRANSLATION FOR SKEW, HARD CODED 1:1, NO SKEW IMPLEMENTED - LD H,B - LD L,C - RET -; -;__________________________________________________________________________________________________ -SETDMA: - LD (DMAADR),BC - RET -; -;__________________________________________________________________________________________________ -READ: - LD A,DOP_READ - JR READWRITE -; -;__________________________________________________________________________________________________ -WRITE: - LD A,C - LD (WRTYPE),A ; SAVE WRITE TYPE - LD A,DOP_WRITE - JR READWRITE -; -;__________________________________________________________________________________________________ -READWRITE: - LD (DSKOP),A ; SET THE ACTIVE DISK OPERATION - JR BLKRW -; -;================================================================================================== -; BLOCKED READ/WRITE (BLOCK AND BUFFER FOR 512 BYTE SECTOR) -;================================================================================================== -; -;__________________________________________________________________________________________________ -; -; RESET (DE)BLOCKING ALGORITHM - JUST MARK BUFFER INVALID -; NOTE: BUFFER CONTENTS INVALIDATED, BUT RETAIN ANY PENDING WRITE -; -BLKRES: - XOR A - LD (HSTACT),A ; BUFFER NO LONGER VALID - LD (UNACNT),A ; CLEAR UNALLOC COUNT - - RET - -;__________________________________________________________________________________________________ -; -; FLUSH (DE)BLOCKING ALGORITHM - DO PENDING WRITES -; -BLKFLSH: - ; CHECK FOR BUFFER WRITTEN (DIRTY) - LD A,(HSTWRT) ; GET BUFFER WRITTEN FLAG - OR A - RET Z ; NOT DIRTY, RETURN WITH A=0 AND Z SET - - ; CLEAR THE BUFFER WRITTEN FLAG (EVEN IF A WRITE ERROR OCCURS) - XOR A ; Z = 0 - LD (HSTWRT),A ; SAVE IT - - ; DO THE WRITE AND RETURN RESULT - JP DSK_WRITE - -#IF WRTCACHE - -WRT_ALC .EQU 0 ; WRITE TO ALLOCATED -WRT_DIR .EQU 1 ; WRITE TO DIRECTORY -WRT_UNA .EQU 2 ; WRITE TO UNALLOCATED - -; -;__________________________________________________________________________________________________ -; -; (DE)BLOCKING READ/WRITE ROUTINE. MANAGES PHYSICAL DISK BUFFER AND CALLS -; PHYSICAL READ/WRITE ROUTINES APPROPRIATELY. -; -BLKRW: -#IF DSKTRACE - CALL PRTDSKOP ; *DEBUG* -#ENDIF - - ; FIX!!! WE ABORT ON FIRST ERROR, DRI SEEMS TO PASS ERROR STATUS TO THE END!!! - - ; IF WRITE OPERATION, GO TO SPECIAL WRITE PROCESSING - LD A,(DSKOP) ; GET REQUESTED OPERATION - CP DOP_WRITE ; WRITE - JR Z,BLKRW1 ; GO TO WRITE PROCESSING - - ; OTHERWISE, CLEAR OUT ANY SEQUENTIAL, UNALLOC WRITE PROCESSING - ; AND GO DIRECTLY TO MAIN I/O - XOR A ; ZERO TO A - LD (WRTYPE),A ; SET WRITE TYPE = 0 (WRT_ALC) TO ENSURE READ OCCURS - LD (UNACNT),A ; SET UNACNT TO ABORT SEQ WRITE PROCESSING - - JR BLKRW4 ; GO TO I/O - -BLKRW1: - ; WRITE PROCESSING - ; CHECK FOR FIRST WRITE TO UNALLOCATED BLOCK - LD A,(WRTYPE) ; GET WRITE TYPE - CP WRT_UNA ; IS IT WRITE TO UNALLOC? - JR NZ,BLKRW2 ; NOPE, BYPASS - - ; INITIALIZE START OF SEQUENTIAL WRITING TO UNALLOCATED BLOCK - ; AND THEN TREAT SUBSEQUENT PROCESSING AS A NORMAL WRITE - CALL UNA_INI ; INITIALIZE SEQUENTIAL WRITE TRACKING - XOR A ; A = 0 = WRT_ALC - LD (WRTYPE),A ; NOW TREAT LIKE WRITE TO ALLOCATED - -BLKRW2: - ; IF WRTYPE = WRT_ALC AND SEQ WRITE, GOTO BLKRW7 (SKIP READ) - OR A ; NOTE: A WILL ALREADY HAVE THE WRITE TYPE HERE - JR NZ,BLKRW3 ; NOT TYPE = 0 = WRT_ALC, SO MOVE ON - - CALL UNA_CHK ; CHECK FOR CONTINUATION OF SEQ WRITES TO UNALLOCATED BLOCK - JR NZ,BLKRW3 ; NOPE, ABORT - - ; WE MATCHED EVERYTHING, TREAT AS WRITE TO UNALLOCATED BLOCK - LD A,WRT_UNA ; WRITE TO UNALLOCATED - LD (WRTYPE),A ; SAVE WRITE TYPE - - CALL UNA_INC ; INCREMENT SEQUENTIAL WRITE TRACKING - JR BLKRW4 ; PROCEED TO I/O PROCESSING - -BLKRW3: - ; NON-SEQUENTIAL WRITE DETECTED, STOP ANY FURTHER CHECKING - XOR A ; ZERO - LD (UNACNT),A ; CLEAR UNALLOCATED WRITE COUNT - - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - ; IS A FLUSH NEEDED HERE??? - ; FLUSH CURRENT BUFFER CONTENTS IF NEEDED - ;CALL BLKFLSH ; FLUSH PENDING WRITES - ;RET NZ ; ABORT ON ERROR - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -BLKRW4: - ; START OF ACTUAL I/O PROCESSING - CALL BLK_XLT ; DO THE LOGICAL TO PHYSICAL MAPPING: SEK... -> XLT... - CALL BLK_CMP ; IS THE DESIRED PHYSICAL BLOCK IN BUFFER? - JR Z,BLKRW6 ; BLOCK ALREADY IN ACTIVE BUFFER, NO READ REQUIRED - - ; AT THIS POINT, WE KNOW WE NEED TO READ THE TARGET PHYSICAL SECTOR - ; IT MAY ACTUALLY BE A PREREAD FOR A SUBSEQUENT WRITE, BUT THAT IS OK - - ; FIRST, FLUSH CURRENT BUFFER CONTENTS - CALL BLKFLSH ; FLUSH PENDING WRITES - RET NZ ; ABORT ON ERROR - - ; IMPLEMENT THE TRANSLATED VALUES - CALL BLK_SAV ; SAVE XLAT VALUES: XLT... -> HST... - - ; IF WRITE TO UNALLOC BLOCK, BYPASS READ, LEAVES BUFFER UNDEFINED - LD A,(WRTYPE) - CP 2 - JR Z,BLKRW6 - - ; DO THE ACTUAL READ - CALL DSK_READ ; READ PHYSICAL SECTOR INTO BUFFER - JR Z,BLKRW6 ; GOOD READ, CONTINUE - - ; IF READ FAILED, RESET (DE)BLOCKING ALGORITHM AND RETURN ERROR - PUSH AF ; SAVE ERROR STATUS - CALL BLKRES ; INVALIDATE (DE)BLOCKING BUFFER - POP AF ; RECOVER ERROR STATUS - RET ; ERROR RETURN - -BLKRW6: - ; CHECK TYPE OF OPERATIONS, IF WRITE, THEN GO TO WRITE PROCESSING - LD A,(DSKOP) ; GET PENDING OPERATION - CP DOP_WRITE ; IS IT A WRITE? - JR Z,BLKRW7 ; YES, GO TO WRITE PROCESSING - - ; THIS IS A READ OPERATION, WE ALREADY DID THE I/O, NOW JUST DEBLOCK AND RETURN - CALL BLK_DEBLOCK ; EXTRACT DATA FROM BLOCK - XOR A ; NO ERROR - RET ; ALL DONE - -BLKRW7: - ; THIS IS A WRITE OPERATION, INSERT DATA INTO BLOCK - CALL BLK_BLOCK ; INSERT DATA INTO BLOCK - - ; MARK THE BUFFER AS WRITTEN - LD A,TRUE ; BUFFER DIRTY = TRUE - LD (HSTWRT),A ; SAVE IT - - ; CHECK WRITE TYPE, IF WRT_DIR, FORCE THE PHYSICAL WRITE - LD A,(WRTYPE) ; GET WRITE TYPE - CP WRT_DIR ; 1 = DIRECTORY WRITE - JP Z,BLKFLSH ; FLUSH PENDING WRITES AND RETURN STATUS - - XOR A ; ALL IS WELL, SET RETURN CODE 0 - RET ; RETURN -; -;__________________________________________________________________________________________________ -; -; INITIALIZE TRACKING OF SEQUENTIAL WRITES INTO UNALLOCATED BLOCK -; SETUP UNA... VARIABLES -; -UNA_INI: - ; COPY SEKDSK/TRK/SEC TO UNA... - LD HL,SEK - LD DE,UNA - LD BC,UNASIZ - LDIR - - ; SETUP UNACNT AND UNASPT - LD HL,(SEKDPH) ; HL POINTS TO DPH - LD DE,10 ; OFFSET OF DPB ADDRESS IN DPH - ADD HL,DE ; DPH POINTS TO DPB ADDRESS - LD A,(HL) - INC HL - LD H,(HL) - LD L,A ; HL POINTS TO DPB - LD C,(HL) - INC HL - LD B,(HL) ; BC HAS SPT - LD (UNASPT),BC ; SAVE SECTORS PER TRACK - DEC HL - DEC HL ; HL POINTS TO RECORDS PER BLOCK (BYTE IN FRONT OF DPB) - LD A,(HL) ; GET IT - LD (UNACNT),A ; SAVE IT - - RET -; -;__________________________________________________________________________________________________ -; -; CHECK FOR CONTINUATION OF SEQUENTIAL WRITES TO UNALLOCATED BLOCK -; SEE IF UNACNT > 0 AND UNA... VARIABLES MATCH SEK... VARIABLES -; -UNA_CHK: - LD A,(UNACNT) ; GET THE COUNTER - OR A - JR NZ,UNA_CHK1 ; IF NOT DONE WITH BLOCK, KEEP CHECKING - - ; CNT IS NOW ZERO, EXHAUSTED RECORDS IN ONE BLOCK! - DEC A ; HACK TO SET NZ - RET ; RETURN WITH NZ - -UNA_CHK1: - ; COMPARE UNA... VARIABLES WITH SEK... VARIABLES - LD HL,SEK - LD DE,UNA - LD B,UNASIZ - JR BLK_CMPLOOP -; -;__________________________________________________________________________________________________ -; -; INCREMENT THE SEQUENTIAL WRITE TRACKING VARIABLES -; TO REFLECT THE NEXT RECORD (TRK/SEC) WE EXPECT -; -UNA_INC: - ; DECREMENT THE BLOCK RECORD COUNT - LD HL,UNACNT - DEC (HL) - - ; INCREMENT THE SECTOR - LD DE,(UNASEC) - INC DE - LD (UNASEC),DE - - ; CHECK FOR END OF TRACK - LD HL,(UNASPT) - XOR A - SBC HL,DE - RET NZ - - ; HANDLE END OF TRACK - LD (UNASEC),HL ; SECTOR BACK TO 0 (NOTE: HL=0 AT THIS POINT) - LD HL,(UNATRK) ; GET CURRENT TRACK - INC HL ; BUMP IT - LD (UNATRK),HL ; SAVE IT - - RET -#ELSE -; -;__________________________________________________________________________________________________ -; -; (DE)BLOCKING READ/WRITE ROUTINE. MANAGES PHYSICAL DISK BUFFER AND CALLS -; PHYSICAL READ/WRITE ROUTINES APPROPRIATELY. -; -BLKRW: -#IF DSKTRACE - CALL PRTDSKOP ; *DEBUG* -#ENDIF - - CALL BLK_XLT ; SECTOR XLAT: SEK... -> XLT... - CALL BLK_CMP ; IN BUFFER? - JR Z,BLKRW1 ; YES, BYPASS READ - CALL BLK_SAV ; SAVE XLAT VALUES: XLT... -> HST... - LD A,FALSE ; ASSUME FAILURE, INVALIDATE BUFFER - LD (HSTACT),A ; SAVE IT - CALL DSK_READ ; READ PHYSICAL SECTOR INTO BUFFER - RET NZ ; BAIL OUT ON ERROR - -BLKRW1: - LD A,(DSKOP) ; GET PENDING OPERATION - CP DOP_WRITE ; IS IT A WRITE? - JR Z,BLKRW2 ; YES, GO TO WRITE ROUTINE - - CALL BLK_DEBLOCK ; EXTRACT DATA FROM BLOCK - XOR A ; NO ERROR - RET ; ALL DONE - -BLKRW2: - CALL BLK_BLOCK ; INSERT DATA INTO BLOCK - CALL DSK_WRITE ; WRITE PHYSICAL SECTOR FROM BUFFER - RET NZ ; BAIL OUT ON ERROR - - LD A,TRUE ; BUFFER IS NOW VALID - LD (HSTACT),A ; SAVE IT - - XOR A ; ALL IS WELL, SET RETURN CODE 0 - RET ; RETURN -#ENDIF -; -;__________________________________________________________________________________________________ -; -; TRANSLATE FROM CP/M DSK/TRK/SEC TO PHYSICAL -; SEK... -> XLT... -; -BLK_XLT: - ; FIRST, DO A BYTE COPY OF SEK... TO XLT... - LD HL,SEK - LD DE,XLT - LD BC,XLTSIZ - LDIR - - ; NOW UPDATE XLTSEC BASED ON (DE)BLOCKING FACTOR (ALWAYS 4:1) - LD BC,(SEKSEC) ; SECTOR IS FACTORED DOWN (4:1) DUE TO BLOCKING - SRL B ; 16 BIT RIGHT SHIFT TWICE TO DIVIDE BY 4 - RR C - SRL B - RR C - LD (XLTSEC),BC - - RET -; -;__________________________________________________________________________________________________ -; -; SAVE RESULTS OF TRANSLATION: XLT... -> HST... -; IMPLICITLY SETS HSTACT TO TRUE! -; -BLK_SAV: - LD HL,XLT - LD DE,HST - LD BC,XLTSIZ - LDIR - RET -; -;__________________________________________________________________________________________________ -; -; COMPARE RESULTS OF TRANSLATION TO CURRENT BUF (XLT... TO HST...) -; NOTE THAT HSTACT IS COMPARED TO XLTACT IMPLICITLY! XLTACT IS ALWAYS TRUE, SO -; HSTACT MUST BE TRUE FOR COMPARE TO SUCCEED. -; -BLK_CMP: - LD HL,XLT - LD DE,HST - LD B,XLTSIZ -BLK_CMPLOOP: - LD A,(DE) - CP (HL) - RET NZ ; BAD COMPARE, RETURN WITH NZ - INC HL - INC DE - DJNZ BLK_CMPLOOP - RET ; RETURN WITH Z -; -;__________________________________________________________________________________________________ -; -; BLOCK DATA - INSERT CPM DMA BUF INTO PROPER PART OF PHYSICAL SECTOR BUFFER -; -BLK_BLOCK: -#IF (PLATFORM == PLT_UNA) - CALL BLK_SETUP - EX DE,HL - LD BC,128 - LDIR - RET -#ELSE - LD B,BF_SYSXCPY ; HBIOS FUNC: SYSTEM EXTENDED COPY - LD E,BID_USR ; E=SRC=USER BANK=TPA - LD D,BID_BIOS ; D=DEST=HBIOS - RST 08 ; SET BANKS FOR INTERBANK COPY - CALL BLK_SETUP ; SETUP SOURCE AND DESTINATION - LD B,BF_SYSCPY ; HBIOS FUNC: SYSTEM COPY - EX DE,HL ; SWAP HL/DE FOR BLOCK OPERATION - PUSH IX ; SAVE IX - LD IX,128 ; DMA BUFFER SIZE - RST 08 ; DO IT - POP IX ; RESTORE IX - RET -#ENDIF -; -;__________________________________________________________________________________________________ -; -; DEBLOCK DATA - EXTRACT DESIRED CPM DMA BUF FROM PHYSICAL SECTOR BUFFER -; -BLK_DEBLOCK: -#IF (PLATFORM == PLT_UNA) - CALL BLK_SETUP - LD BC,128 - LDIR - RET -#ELSE - LD B,BF_SYSXCPY ; HBIOS FUNC: SYSTEM EXTENDED COPY - LD E,BID_BIOS ; C=SRC=HBIOS - LD D,BID_USR ; B=DEST=USER BANK=TPA - RST 08 ; DO IT - CALL BLK_SETUP ; SETUP SOURCE AND DESTINATION - LD B,BF_SYSCPY ; HBIOS FUNC: SYSTEM COPY - PUSH IX ; SAVE IX - LD IX,128 ; DMA BUFFER SIZE - RST 08 ; DO IT - POP IX ; RESTORE IX - RET -#ENDIF -; -;__________________________________________________________________________________________________ -; -; SETUP SOURCE AND DESTINATION POINTERS FOR BLOCK COPY OPERATION -; AT EXIT, HL = ADDRESS OF DESIRED BLOCK IN SECTOR BUFFER, DE = DMA -; -BLK_SETUP: - LD BC,(SEKSEC) - LD A,C - AND 3 ; A = INDEX OF CPM BUF IN SEC BUF - RRCA ; MULTIPLY BY 64 - RRCA - LD E,A ; INTO LOW ORDER BYTE OF DESTINATION - LD D,0 ; HIGH ORDER BYTE IS ZERO - LD HL,(BUFADR) ; HL = START OF SEC BUF - ADD HL,DE ; ADD IN COMPUTED OFFSET - ADD HL,DE ; HL NOW = INDEX * 128 (SOURCE) - LD DE,(DMAADR) ; DE = DESTINATION = DMA BUF - RET -; -;================================================================================================== -; PHYSICAL DISK INTERFACE -;================================================================================================== -; -; LOOKUP DISK INFORMATION BASED ON CPM DRIVE IN C -; ON RETURN, D=DEVICE/UNIT, E=SLICE, HL=DPH ADDRESS -; -DSK_GETINF: - LD HL,(DRVMAPADR) ; HL := START OF UNA DRIVE MAP - DEC HL ; POINT TO DRIVE COUNT - LD A,C ; A := CPM DRIVE - CP (HL) ; COMPARE TO NUMBER OF DRIVES CONFIGURED - JR NC,DSK_GETINF1 ; IF OUT OF RANGE, GO TO ERROR RETURN - INC HL ; POINT TO START OF DRIVE MAP -; - RLCA ; MULTIPLY A BY 4... - RLCA ; TO USE AS OFFSET INTO ???? MAP - CALL ADDHLA ; ADD OFFSET - LD D,(HL) ; D := DEVICE/UNIT - INC HL ; BUMP TO SLICE - LD E,(HL) ; E := SLICE - INC HL ; POINT TO DPH LSB - LD A,(HL) ; A := DPH LSB - INC HL ; POINT TO DPH MSB - LD H,(HL) ; H := DPH MSB - LD L,A ; L := DPH LSB - LD A,H ; TEST FOR INVALID DPH - OR L ; ... BY CHECKING FOR ZERO VALUE - JR Z,DSK_GETINF1 ; HANDLE ZERO DPH, DRIVE IS INVALID - XOR A ; SET SUCCESS - RET -; -DSK_GETINF1: ; ERROR RETURN - XOR A - LD H,A - LD L,A - LD D,A - LD E,A - INC A - RET -; -; -; -DSK_SELECT: - LD B,E ; SAVE E IN B FOR NOW - CALL DSK_GETINF ; GET D=DEVICE/UNIT, E=SLICE, HL=DPH ADDRESS - RET NZ ; RETURN IF INVALID DRIVE (A=1, NZ SET, HL=0) - PUSH BC ; WE NEED B LATER, SAVE ON STACK -; - ; SAVE ALL THE NEW STUFF - LD A,C ; A := CPM DRIVE NO - LD (SEKDSK),A ; SAVE IT - LD A,D ; A := DEVICE/UNIT - LD (SEKDU),A ; SAVE DEVICE/UNIT - LD (SEKDPH),HL ; SAVE DPH POINTER -; - ; UPDATE OFFSET FOR ACTIVE SLICE - ; A TRACK IS ASSUMED TO BE 16 SECTORS - ; THE OFFSET REPRESENTS THE NUMBER OF BLOCKS * 256 - ; TO USE AS THE OFFSET - LD H,65 ; H = TRACKS PER SLICE, E = SLICE NO - CALL MULT8 ; HL := H * E (TOTAL TRACK OFFSET) - LD (SEKOFF),HL ; SAVE NEW TRACK OFFSET -; - ; RESTORE DE TO BC (FOR ACCESS TO DRIVE LOGIN BIT) - POP BC ; GET ORIGINAL E INTO B -; -#IF (PLATFORM != PLT_UNA) -; - ; CHECK IF THIS IS LOGIN, IF NOT, BYPASS MEDIA DETECTION - ; FIX: WHAT IF PREVIOUS MEDIA DETECTION FAILED??? - BIT 0,B ; TEST DRIVE LOGIN BIT - JR NZ,DSK_SELECT2 ; BYPASS MEDIA DETECTION -; - ; DETERMINE MEDIA IN DRIVE - LD A,(SEKDU) ; GET DEVICE/UNIT - LD C,A ; STORE IN C - LD B,BF_DIOMED ; DRIVER FUNCTION = DISK MEDIA - RST 08 - OR A ; SET FLAGS - LD HL,0 ; ASSUME FAILURE - RET Z ; BAIL OUT IF NO MEDIA -; - ; A HAS MEDIA ID, SET HL TO CORRESPONDING DPBMAP ENTRY - LD HL,DPBMAP ; HL = DPBMAP - RLCA ; DPBMAP ENTRIES ARE 2 BYTES EACH - CALL ADDHLA ; ADD OFFSET TO HL -; - ; LOOKUP THE ACTUAL DPB ADDRESS NOW - LD E,(HL) ; DEREFERENCE HL... - INC HL ; INTO DE... - LD D,(HL) ; DE = ADDRESS OF DESIRED DPB -; - ; PLUG DPB INTO THE ACTIVE DPH - LD HL,(SEKDPH) - LD BC,10 ; OFFSET OF DPB IN DPH - ADD HL,BC ; HL := DPH.DPB - LD (HL),E ; SET LSB OF DPB IN DPH - INC HL ; BUMP TO MSB - LD (HL),D ; SET MSB OF DPB IN DPH -#ENDIF -; -DSK_SELECT2: - LD HL,(SEKDPH) ; HL = DPH ADDRESS FOR CP/M - XOR A ; FLAG SUCCESS - RET ; NORMAL RETURN -; -; -; -DSK_STATUS: -#IF (PLATFORM == PLT_UNA) - XOR A ; ASSUME OK FOR NOW - RET ; RETURN -#ELSE - ; C HAS CPM DRIVE, LOOKUP DEVICE/UNIT AND CHECK FOR INVALID DRIVE - CALL DSK_GETINF ; B = DEVICE/UNIT - RET NZ ; INVALID DRIVE ERROR - - ; VALID DRIVE, DISPATCH TO DRIVER - LD C,D ; C := DEVICE/UNIT - LD B,BF_DIOST ; B := FUNCTION: STATUS - RST 08 - RET -#ENDIF -; -; -; -DSK_READ: - ; SET B = FUNCTION: READ - LD B,BF_DIORD - JR DSK_IO -; -; -; -DSK_WRITE: - ; SET B = FUNCTION: WRITE - LD B,BF_DIOWR - JR DSK_IO -; -; -; -#IF (PLATFORM == PLT_UNA) - -DSK_IO: -DSK_IO1: - PUSH BC - LD DE,(HSTTRK) ; GET TRACK INTO HL - LD B,4 ; PREPARE TO LEFT SHIFT BY 4 BITS -DSK_IO2: - SLA E ; SHIFT DE LEFT BY 4 BITS - RL D - DJNZ DSK_IO2 ; LOOP TILL ALL BITS DONE - LD A,(HSTSEC) ; GET THE SECTOR INTO A - AND $0F ; GET RID OF TOP NIBBLE - OR E ; COMBINE WITH E - LD E,A ; BACK IN E - LD HL,0 ; HL:DE NOW HAS SLICE RELATIVE LBA - ; APPLY OFFSET NOW - ; OFFSET IS EXPRESSED AS NUMBER OF BLOCKS * 256 TO OFFSET! - LD A,(HSTOFF) ; LSB OF SLICE OFFSET TO A - ADD A,D ; ADD WITH D - LD D,A ; PUT IT BACK IN D - LD A,(HSTOFF+1) ; MSB OF SLICE OFFSET TO A - CALL ADDHLA ; ADD OFFSET - POP BC ; RECOVER FUNCTION IN B - LD A,(HSTDU) ; GET THE DEVICE/UNIT VALUE - LD C,A ; PUT IT IN C - ; DISPATCH TO DRIVER - PUSH BC - EX DE,HL ; DE:HL NOW HAS LBA - LD B,C ; UNIT TO B - LD C,$41 ; UNA SET LBA - RST 08 ; CALL UNA - CALL NZ,PANIC - POP BC ; RECOVER B=FUNC, C=UNIT - LD E,C ; UNIT TO E - LD C,B ; FUNC TO C - LD B,E ; UNIT TO B - LD DE,(BUFADR) ; SET BUFFER ADDRESS - LD HL,1 ; 1 SECTOR - - RST 08 - CALL NZ,PANIC - XOR A ; SET FLAGS BASED ON RESULT - RET - -#ELSE - -DSK_IO: - LD A,(HSTDU) ; GET ACTIVE DEVICE/UNIT BYTE - AND $F0 ; ISOLATE DEVICE PORTION - CP DIODEV_FD ; FLOPPY? - JR NZ,DSK_IO1 ; NO, USE LBA HANDLING - ; SET HL=TRACK (ADD IN TRACK OFFSET) - LD DE,(HSTOFF) ; DE = TRACK OFFSET FOR LU SUPPORT - LD HL,(HSTTRK) ; HL = TRACK # - ADD HL,DE ; APPLY OFFSET FOR ACTIVE SLICE - ; SET DE=SECTOR - LD DE,(HSTSEC) ; DE = SECTOR # - ; SET C = DEVICE/UNIT - LD A,(HSTDU) ; LOAD DEVICE/UNIT VALUE - LD C,A ; SAVE IN C - ; DISPATCH TO DRIVER - RST 08 - OR A ; SET FLAGS BASED ON RESULT - RET - ; NEW LBA HANDLING - ; COERCE TRACK/SECTOR INTO HL:DE AS 0000:TTTS -DSK_IO1: - PUSH BC - LD DE,(HSTTRK) ; GET TRACK INTO HL - LD B,4 ; PREPARE TO LEFT SHIFT BY 4 BITS -DSK_IO2: - SLA E ; SHIFT DE LEFT BY 4 BITS - RL D - DJNZ DSK_IO2 ; LOOP TILL ALL BITS DONE - LD A,(HSTSEC) ; GET THE SECTOR INTO A - AND $0F ; GET RID OF TOP NIBBLE - OR E ; COMBINE WITH E - LD E,A ; BACK IN E - LD HL,0 ; HL:DE NOW HAS SLICE RELATIVE LBA - ; APPLY OFFSET NOW - ; OFFSET IS EXPRESSED AS NUMBER OF BLOCKS * 256 TO OFFSET! - LD A,(HSTOFF) ; LSB OF SLICE OFFSET TO A - ADD A,D ; ADD WITH D - LD D,A ; PUT IT BACK IN D - LD A,(HSTOFF+1) ; MSB OF SLICE OFFSET TO A - CALL ADDHLA ; ADD OFFSET - POP BC ; RECOVER FUNCTION IN B - LD A,(HSTDU) ; GET THE DEVICE/UNIT VALUE - LD C,A ; PUT IT IN C - ; DISPATCH TO DRIVER - RST 08 - OR A ; SET FLAGS BASED ON RESULT - RET - -#ENDIF -; -;================================================================================================== -; UTILITY FUNCTIONS -;================================================================================================== -; -#DEFINE CIOMODE_CBIOS -ORG_UTIL .EQU $ -#INCLUDE "util.asm" -SIZ_UTIL .EQU $ - ORG_UTIL - .ECHO "UTIL occupies " - .ECHO SIZ_UTIL - .ECHO " bytes.\n" -; -;================================================================================================== -; DIAGNOSTICS -;================================================================================================== -; -#IF DSKTRACE -;__________________________________________________________________________________________________ -PRTSELDSK: - CALL NEWLINE - PUSH BC - PUSH DE - LD B,E - LD DE,STR_SELDSK - CALL WRITESTR - CALL PC_SPACE - LD DE,STR_DSK - LD A,C - CALL PRTHEXBYTE - CALL PC_SPACE - CALL PC_LBKT - LD A,B - CALL PRTHEXBYTE - CALL PC_RBKT - POP DE - POP BC - RET -; -;__________________________________________________________________________________________________ -PRTHOME: - CALL NEWLINE - LD DE,STR_HOME - CALL WRITESTR - RET -; -;__________________________________________________________________________________________________ -PRTDSKOP: - - LD (XSTKSAV),SP - LD SP,XSTK - - CALL NEWLINE - LD A,(DSKOP) - LD DE,STR_READ - CP DOP_READ - CALL Z,WRITESTR - LD DE,STR_WRITE - CP DOP_WRITE - CALL Z,WRITESTR - LD A,C - CALL Z,PRTHEXBYTE - LD DE,STR_DSK - CALL WRITESTR - LD A,(SEKDSK) - CALL PRTHEXBYTE - LD DE,STR_TRK - CALL WRITESTR - LD BC,(SEKTRK) - CALL PRTHEXWORD - LD DE,STR_SEC - CALL WRITESTR - LD BC,(SEKSEC) - CALL PRTHEXWORD - - LD SP,(XSTKSAV) - - RET - - RET - -XSTKSAV .DW 0 - .FILL $20 -XSTK .EQU $ -; -STR_SELDSK .DB "SELDSK$" -STR_HOME .DB "HOME$" -STR_READ .DB "READ$" -STR_WRITE .DB "WRITE$" -STR_DSK .DB " DSK=$" -STR_TRK .DB " TRK=$" -STR_SEC .DB " SEC=$" -; -#ENDIF -; -;================================================================================================== -; DATA -;================================================================================================== -; -;STR_READONLY .DB "\r\nCBIOS Err: Read Only Drive$" -;STR_STALE .DB "\r\nCBIOS Err: Stale Drive$" -; -SECADR .DW 0 ; ADDRESS OF SECTOR IN ROM/RAM PAGE -DEFDRIVE .DB 0 ; DEFAULT DRIVE -CCPBUF .DW $7000 ; ADDRESS OF CCP BUF IN BIOS BANK -; -; DOS DISK VARIABLES -; -DSKOP: .DB 0 ; DISK OPERATION (DOP_READ/DOP_WRITE) -WRTYPE: .DB 0 ; WRITE TYPE (0=NORMAL, 1=DIR (FORCE), 2=FIRST RECORD OF BLOCK) -DMAADR: .DW 0 ; DIRECT MEMORY ADDRESS -HSTWRT: .DB 0 ; TRUE = BUFFER IS DIRTY -BUFADR: .DW $8000-$0400 ; ADDRESS OF PHYSICAL SECTOR BUFFER (DEFAULT MATCHES HBIOS) -; -; DISK I/O REQUEST PENDING -; -SEK: -SEKDSK: .DB 0 ; DISK NUMBER 0-15 -SEKTRK: .DW 0 ; TWO BYTES FOR TRACK # (LOGICAL) -SEKSEC: .DW 0 ; TWO BYTES FOR SECTOR # (LOGICAL) -SEKDU: .DB 0 ; DEVICE/UNIT -SEKDPH: .DW 0 ; ADDRESS OF ACTIVE (SELECTED) DPH -SEKOFF: .DW 0 ; TRACK OFFSET IN EFFECT FOR LU -SEKACT: .DB TRUE ; ALWAYS TRUE! -; -; RESULT OF CPM TO PHYSICAL TRANSLATION -; -XLT: -XLTDSK .DB 0 -XLTTRK .DW 0 -XLTSEC .DW 0 -XLTDU .DB 0 -XLTDPH .DW 0 -XLTOFF: .DW 0 -XLTACT .DB TRUE ; ALWAYS TRUE! -; -XLTSIZ .EQU $ - XLT -; -; DSK/TRK/SEC IN BUFFER (VALID WHEN HSTACT=TRUE) -; -HST: -HSTDSK .DB 0 ; DISK IN BUFFER -HSTTRK .DW 0 ; TRACK IN BUFFER -HSTSEC .DW 0 ; SECTOR IN BUFFER -HSTDU .DB 0 ; DEVICE/UNIT IN BUFFER -HSTDPH .DW 0 ; CURRENT DPH ADDRESS -HSTOFF .DW 0 ; TRACK OFFSET IN EFFECT FOR LU -HSTACT .DB 0 ; TRUE = BUFFER HAS VALID DATA -; -; SEQUENTIAL WRITE TRACKING FOR UNALLOCATED BLOCK -; -UNA: -UNADSK: .DB 0 ; DISK NUMBER 0-15 -UNATRK: .DW 0 ; TWO BYTES FOR TRACK # (LOGICAL) -UNASEC: .DW 0 ; TWO BYTES FOR SECTOR # (LOGICAL) -; -UNASIZ .EQU $ - UNA -; -UNACNT: .DB 0 ; COUNT DOWN UNALLOCATED RECORDS IN BLOCK -UNASPT: .DW 0 ; SECTORS PER TRACK -; -;================================================================================================== -; DISK CONTROL STRUCTURES (DPB, DPH) -;================================================================================================== -; -RAMBLKS .EQU (((BID_RAMDN - BID_RAMD0 + 1) * 32) / 2) -CKS_RAM .EQU 0 ; CKS: 0 FOR NON-REMOVABLE MEDIA -ALS_RAM .EQU ((RAMBLKS + 7) / 8) ; ALS: BLKS / 8 (ROUNDED UP) -; -ROMBLKS .EQU (((BID_ROMDN - BID_ROMD0 + 1) * 32) / 2) -CKS_ROM .EQU 0 ; CKS: 0 FOR NON-REMOVABLE MEDIA -ALS_ROM .EQU ((ROMBLKS + 7) / 8) ; ALS: BLKS / 8 (ROUNDED UP) -; -CKS_FD .EQU 64 ; CKS: DIR ENT / 4 = 256 / 4 = 64 -ALS_FD .EQU 128 ; ALS: BLKS / 8 = 1024 / 8 = 128 -; -CKS_HD .EQU 0 ; CKS: 0 FOR NON-REMOVABLE MEDIA -ALS_HD .EQU 256 ; ALS: BLKS / 8 = 2048 / 8 = 256 (ROUNDED UP) -; -; -; DISK PARAMETER BLOCKS -; -; BLS BSH BLM EXM (DSM<256) EXM (DSM>255) -; ---------- --- --- ------------- ------------- -; 1,024 3 7 0 N/A -; 2,048 4 15 1 0 -; 4,096 5 31 3 1 -; 8,192 6 63 7 3 -; 16,384 7 127 15 7 -; -; AL0/1: EACH BIT SET ALLOCATES A BLOCK OF DIR ENTRIES. EACH DIR ENTRY -; IS 32 BYTES. BIT COUNT = (((DRM + 1) * 32) / BLS) -; -; CKS = (DIR ENT / 4), ZERO FOR NON-REMOVABLE MEDIA -; -; ALS = TOTAL BLKS (DSM + 1) / 8 -;__________________________________________________________________________________________________ -; -; ROM DISK: 64 SECS/TRK (LOGICAL), 128 BYTES/SEC -; BLOCKSIZE (BLS) = 2K, DIRECTORY ENTRIES = 256 -; ROM DISK SIZE = TOTAL ROM - 32K RESERVED FOR SYSTEM USE -; - .DW CKS_ROM - .DW ALS_ROM - .DB (2048 / 128) ; RECORDS PER BLOCK (BLS / 128) -DPB_ROM: - .DW 64 ; SPT: SECTORS PER TRACK - .DB 4 ; BSH: BLOCK SHIFT FACTOR - .DB 15 ; BLM: BLOCK MASK -#IF ((ROMBLKS - 1) < 256) - .DB 1 ; EXM: EXTENT MASK -#ELSE - .DB 0 ; EXM: EXTENT MASK -#ENDIF - .DW ROMBLKS - 1 ; DSM: TOTAL STORAGE IN BLOCKS - 1 - .DW 255 ; DRM: DIR ENTRIES - 1 = 255 - .DB 11110000B ; AL0: DIR BLK BIT MAP, FIRST BYTE - .DB 00000000B ; AL1: DIR BLK BIT MAP, SECOND BYTE - .DW 0 ; CKS: ZERO FOR NON-REMOVABLE MEDIA - .DW 0 ; OFF: ROM DISK HAS NO SYSTEM AREA -;__________________________________________________________________________________________________ -; -; RAM DISK: 64 SECS/TRK, 128 BYTES/SEC -; BLOCKSIZE (BLS) = 2K, DIRECTORY ENTRIES = 256 -; RAM DISK SIZE = TOTAL RAM - 64K RESERVED FOR SYSTEM USE -; - .DW CKS_RAM - .DW ALS_RAM - .DB (2048 / 128) ; RECORDS PER BLOCK (BLS / 128) -DPB_RAM: - .DW 64 ; SPT: SECTORS PER TRACK - .DB 4 ; BSH: BLOCK SHIFT FACTOR - .DB 15 ; BLM: BLOCK MASK -#IF ((RAMBLKS - 1) < 256) - .DB 1 ; EXM: EXTENT MASK -#ELSE - .DB 0 ; EXM: EXTENT MASK -#ENDIF - .DW RAMBLKS - 1 ; DSM: TOTAL STORAGE IN BLOCKS - 1 - .DW 255 ; DRM: DIR ENTRIES - 1 = 255 - .DB 11110000B ; AL0: DIR BLK BIT MAP, FIRST BYTE - .DB 00000000B ; AL1: DIR BLK BIT MAP, SECOND BYTE - .DW 0 ; CKS: ZERO FOR NON-REMOVABLE MEDIA - .DW 0 ; OFF: RESERVED TRACKS = 0 TRK -;__________________________________________________________________________________________________ -; -; 4MB RAM FLOPPY DRIVE, 32 TRKS, 1024 SECS/TRK, 128 BYTES/SEC -; BLOCKSIZE (BLS) = 2K, DIRECTORY ENTRIES = 256 -; SEC/TRK ENGINEERED SO THAT AFTER DEBLOCKING, SECTOR NUMBER OCCUPIES 1 BYTE (0-255) -; - .DW CKS_HD - .DW ALS_HD - .DB (2048 / 128) ; RECORDS PER BLOCK (BLS / 128) -DPB_RF: - .DW 1024 ; SPT: SECTORS PER TRACK - .DB 4 ; BSH: BLOCK SHIFT FACTOR - .DB 15 ; BLM: BLOCK MASK - .DB 0 ; EXM: EXTENT MASK - .DW 2047 ; DSM: TOTAL STORAGE IN BLOCKS - 1 BLK = (4MB / 2K BLS) - 1 = 2047 - .DW 255 ; DRM: DIR ENTRIES - 1 = 256 - 1 = 255 - .DB 11110000B ; AL0: DIR BLK BIT MAP, FIRST BYTE - .DB 00000000B ; AL1: DIR BLK BIT MAP, SECOND BYTE - .DW 0 ; CKS: ZERO FOR NON-REMOVABLE MEDIA - .DW 0 ; OFF: RESERVED TRACKS = 0 TRK -;__________________________________________________________________________________________________ -; -; GENERIC HARD DISK DRIVE (8MB DATA SPACE + 128K RESERVED SPACE) -; LOGICAL: 1040 TRKS (16 RESERVED), 64 SECS/TRK, 128 BYTES/SEC -; PHYSICAL: 65 CYLS (1 RESERVED), 16 HEADS/CYL, 16 SECS/TRK, 512 BYTES/SEC -; BLOCKSIZE (BLS) = 4K, DIRECTORY ENTRIES = 512 -; - .DW CKS_HD - .DW ALS_HD - .DB (4096 / 128) ; RECORDS PER BLOCK (BLS / 128) -DPB_HD: - .DW 64 ; SPT: SECTORS PER TRACK - .DB 5 ; BSH: BLOCK SHIFT FACTOR - .DB 31 ; BLM: BLOCK MASK - .DB 1 ; EXM: EXTENT MASK - .DW 2047 ; DSM: TOTAL STORAGE IN BLOCKS - 1 = (8MB / 4K BLS) - 1 = 2047 - .DW 511 ; DRM: DIR ENTRIES - 1 = 512 - 1 = 511 - .DB 11110000B ; AL0: DIR BLK BIT MAP, FIRST BYTE - .DB 00000000B ; AL1: DIR BLK BIT MAP, SECOND BYTE - .DW 0 ; CKS: DIRECTORY CHECK VECTOR SIZE = 256 / 4 - .DW 16 ; OFF: RESERVED TRACKS = 16 TRKS * (16 TRKS * 16 HEADS * 16 SECS * 512 BYTES) = 128K -;__________________________________________________________________________________________________ -; -; IBM 720KB 3.5" FLOPPY DRIVE, 80 TRKS, 36 SECS/TRK, 512 BYTES/SEC -; BLOCKSIZE (BLS) = 2K, DIRECTORY ENTRIES = 128 -; - .DW CKS_FD - .DW ALS_FD - .DB (2048 / 128) ; RECORDS PER BLOCK (BLS / 128) -DPB_FD720: - .DW 36 ; SPT: SECTORS PER TRACK - .DB 4 ; BSH: BLOCK SHIFT FACTOR - .DB 15 ; BLM: BLOCK MASK - .DB 0 ; EXM: EXTENT MASK - .DW 350 ; DSM: TOTAL STORAGE IN BLOCKS - 1 BLK = ((720K - 18K OFF) / 2K BLS) - 1 = 350 - .DW 127 ; DRM: DIR ENTRIES - 1 = 128 - 1 = 127 - .DB 11000000B ; AL0: DIR BLK BIT MAP, FIRST BYTE - .DB 00000000B ; AL1: DIR BLK BIT MAP, SECOND BYTE - .DW 32 ; CKS: DIRECTORY CHECK VECTOR SIZE = 128 / 4 - .DW 4 ; OFF: RESERVED TRACKS = 4 TRKS * (512 B/SEC * 36 SEC/TRK) = 18K -;__________________________________________________________________________________________________ -; -; IBM 1.44MB 3.5" FLOPPY DRIVE, 80 TRKS, 72 SECS/TRK, 512 BYTES/SEC -; BLOCKSIZE (BLS) = 2K, DIRECTORY ENTRIES = 256 -; - .DW CKS_FD - .DW ALS_FD - .DB (2048 / 128) ; RECORDS PER BLOCK (BLS / 128) -DPB_FD144: - .DW 72 ; SPT: SECTORS PER TRACK - .DB 4 ; BSH: BLOCK SHIFT FACTOR - .DB 15 ; BLM: BLOCK MASK - .DB 0 ; EXM: EXTENT MASK - .DW 710 ; DSM: TOTAL STORAGE IN BLOCKS - 1 BLK = ((1,440K - 18K OFF) / 2K BLS) - 1 = 710 - .DW 255 ; DRM: DIR ENTRIES - 1 = 256 - 1 = 255 - .DB 11110000B ; AL0: DIR BLK BIT MAP, FIRST BYTE - .DB 00000000B ; AL1: DIR BLK BIT MAP, SECOND BYTE - .DW 64 ; CKS: DIRECTORY CHECK VECTOR SIZE = 256 / 4 - .DW 2 ; OFF: RESERVED TRACKS = 2 TRKS * (512 B/SEC * 72 SEC/TRK) = 18K -;__________________________________________________________________________________________________ -; -; IBM 360KB 5.25" FLOPPY DRIVE, 40 TRKS, 9 SECS/TRK, 512 BYTES/SEC -; BLOCKSIZE (BLS) = 2K, DIRECTORY ENTRIES = 128 -; - .DW CKS_FD - .DW ALS_FD - .DB (2048 / 128) ; RECORDS PER BLOCK (BLS / 128) -DPB_FD360: - .DW 36 ; SPT: SECTORS PER TRACK - .DB 4 ; BSH: BLOCK SHIFT FACTOR - .DB 15 ; BLM: BLOCK MASK - .DB 1 ; EXM: EXTENT MASK - .DW 170 ; DSM: TOTAL STORAGE IN BLOCKS - 1 BLK = ((360K - 18K OFF) / 2K BLS) - 1 = 170 - .DW 127 ; DRM: DIR ENTRIES - 1 = 128 - 1 = 127 - .DB 11110000B ; AL0: DIR BLK BIT MAP, FIRST BYTE - .DB 00000000B ; AL1: DIR BLK BIT MAP, SECOND BYTE - .DW 32 ; CKS: DIRECTORY CHECK VECTOR SIZE = 128 / 4 - .DW 4 ; OFF: RESERVED TRACKS = 4 TRKS * (512 B/SEC * 36 SEC/TRK) = 18K -;__________________________________________________________________________________________________ -; -; IBM 1.20MB 5.25" FLOPPY DRIVE, 80 TRKS, 15 SECS/TRK, 512 BYTES/SEC -; BLOCKSIZE (BLS) = 2K, DIRECTORY ENTRIES = 256 -; - .DW CKS_FD - .DW ALS_FD - .DB (2048 / 128) ; RECORDS PER BLOCK (BLS / 128) -DPB_FD120: - .DW 60 ; SPT: SECTORS PER TRACK - .DB 4 ; BSH: BLOCK SHIFT FACTOR - .DB 15 ; BLM: BLOCK MASK - .DB 0 ; EXM: EXTENT MASK - .DW 591 ; DSM: TOTAL STORAGE IN BLOCKS - 1 BLK = ((1,200K - 15K OFF) / 2K BLS) - 1 = 591 - .DW 255 ; DRM: DIR ENTRIES - 1 = 256 - 1 = 255 - .DB 11110000B ; AL0: DIR BLK BIT MAP, FIRST BYTE - .DB 00000000B ; AL1: DIR BLK BIT MAP, SECOND BYTE - .DW 64 ; CKS: DIRECTORY CHECK VECTOR SIZE = 256 / 4 - .DW 2 ; OFF: RESERVED TRACKS = 2 TRKS * (512 B/SEC * 60 SEC/TRK) = 15K -;__________________________________________________________________________________________________ -; -; IBM 1.11MB 8" FLOPPY DRIVE, 77 TRKS, 15 SECS/TRK, 512 BYTES/SEC -; BLOCKSIZE (BLS) = 2K, DIRECTORY ENTRIES = 256 -; - .DW CKS_FD - .DW ALS_FD - .DB (2048 / 128) ; RECORDS PER BLOCK (BLS / 128) -DPB_FD111: - .DW 60 ; SPT: SECTORS PER TRACK - .DB 4 ; BSH: BLOCK SHIFT FACTOR - .DB 15 ; BLM: BLOCK MASK - .DB 0 ; EXM: EXTENT MASK - .DW 569 ; DSM: TOTAL STORAGE IN BLOCKS - 1 BLK = ((1,155K - 15K OFF) / 2K BLS) - 1 = 569 - .DW 255 ; DRM: DIR ENTRIES - 1 = 256 - 1 = 255 - .DB 11110000B ; AL0: DIR BLK BIT MAP, FIRST BYTE - .DB 00000000B ; AL1: DIR BLK BIT MAP, SECOND BYTE - .DW 64 ; CKS: DIRECTORY CHECK VECTOR SIZE = 256 / 4 - .DW 2 ; OFF: RESERVED TRACKS = 2 TRKS * (512 B/SEC * 60 SEC/TRK) = 15K -; -#IF (PLATFORM == PLT_UNA) -SECBUF .FILL 512,0 ; PHYSICAL DISK SECTOR BUFFER -#ENDIF -; -;================================================================================================== -; CBIOS BUFFERS -;================================================================================================== -; -;BUFFERS: -; -BUFPOOL .EQU $ ; START OF BUFFER POOL -; -;================================================================================================== -; COLD BOOT INITIALIZATION -; -; THIS CODE IS PLACED IN THE BDOS BUFFER AREA TO CONSERVE SPACE. SINCE -; COLD BOOT DOES NO DISK IO, SO THIS IS SAFE. -; -;================================================================================================== -; - .FILL 16 * 4,0 ; RESERVED FOR DRVMAP TABLE - .FILL 16 * 16,0 ; RESERVED FOR DPH TABLE -; -INIT: - ; THIS INIT CODE WILL BE OVERLAID, SO WE ARE GOING - ; TO MODIFY THE BOOT ENTRY POINT TO CAUSE A PANIC - ; TO EASILY IDENTIFY IF SOMETHING TRIES TO INVOKE - ; THE BOOT ENTRY POINT AFTER INIT IS DONE. - LD A,$CD ; "CALL" INSTRUCTION - LD (BOOT),A ; STORE IT BOOT ENTRY POINT - LD HL,PANIC ; ADDRESS OF PANIC ROUTINE - LD (BOOT+1),HL ; STORE IT AT BOOT ENTRY + 1 - -#IF (PLATFORM == PLT_UNA) - ; MAKE SURE UNA EXEC PAGE IS ACTIVE - LD BC,$01FB ; UNA FUNC = SET BANK - LD DE,BID_USR ; SWITCH BACK TO EXEC BANK - CALL $FFFD ; DO IT (RST 08 NOT SAFE HERE) - - ; INSTALL UNA INVOCATION VECTOR FOR RST 08 - LD A,$C3 ; JP INSTRUCTION - LD (8),A ; STORE AT 0x0008 - LD HL,($FFFE) ; UNA ENTRY VECTOR - LD (9),HL ; STORE AT 0x0009 -#ELSE - ; MAKE SURE USER BANK IS ACTIVE - LD B,BF_SYSSETBNK - LD C,BID_USR - CALL $FFF0 - - ; INSTALL HBIOS INVOCATION VECTOR FOR RST 08 - LD A,$C3 ; JP INSTRUCTION - LD (8),A ; STORE AT 0x0008 - LD HL,($FFF1) ; HBIOS ENTRY VECTOR - LD (9),HL ; STORE AT 0x0009 -#ENDIF - - ; PARAMETER INITIALIZATION - LD A,DEFIOBYTE ; LOAD DEFAULT IOBYTE - LD (IOBYTE),A ; STORE IT - -#IF ((PLATFORM != PLT_N8) & (PLATFORM != PLT_MK4) & (PLATFORM != PLT_UNA)) - IN A,(RTC) ; RTC PORT, BIT 6 HAS STATE OF CONFIG JUMPER - BIT 6,A ; BIT 6 HAS CONFIG JUMPER STATE - LD A,DEFIOBYTE ; ASSUME WE WANT DEFAULT IOBYTE VALUE - JR NZ,INIT1 ; IF BIT6=1, NOT SHORTED, CONTINUE WITH DEFAULT - LD A,ALTIOBYTE ; LOAD ALT IOBYTE VALUE -INIT1: - LD (IOBYTE),A ; SET THE ACTIVE IOBYTE -#ENDIF - - ; INIT DEFAULT DRIVE TO A: FOR NOW - XOR A ; ZERO - LD (DEFDRIVE),A ; STORE IT - - ; STARTUP MESSAGE - CALL NEWLINE ; FORMATTING - LD DE,STR_CPM ; DEFAULT TO CP/M LABEL - LD A,(BDOS_LOC) ; GET FIRST BYTE OF BDOS - CP 'Z' ; IS IT A 'Z' (FOR ZSDOS)? - JR NZ,INIT2 ; NOPE, CP/M IS RIGHT - LD DE,STR_ZSDOS ; SWITCH TO ZSDOS LABEL -INIT2: - CALL WRITESTR ; DISPLAY OS LABEL - LD DE,STR_BANNER ; POINT TO BANNER - CALL WRITESTR ; DISPLAY IT - CALL NEWLINE ; FORMATTING - -#IF (PLATFORM == PLT_UNA) - ; SAVE COMMAND PROCESSOR IMAGE TO MALLOCED CACHE IN UNA BIOS PAGE - LD C,$F7 ; UNA MALLOC - LD DE,CCP_SIZ ; SIZE OF CCP - RST 08 ; DO IT - CALL NZ,PANIC ; BIG PROBLEM - LD (CCPBUF),HL ; SAVE THE ADDRESS (IN BIOS MEM) - - LD BC,$01FB ; UNA FUNC = SET BANK - LD DE,BID_BIOS ; UBIOS_PAGE (SEE PAGES.INC) - RST 08 ; DO IT - PUSH DE ; SAVE PREVIOUS BANK - - LD HL,CPM_LOC ; ADDRESS IN HI MEM OF CCP - LD DE,(CCPBUF) ; ADDRESS OF CCP BUF IN BIOS MEM - LD BC,CCP_SIZ ; SIZE OF CCP - LDIR ; DO IT - - LD BC,$01FB ; UNA FUNC = SET BANK - POP DE ; RECOVER OPERATING BANK - RST 08 ; DO IT -#ELSE - ; SAVE COMMAND PROCESSOR TO DEDICATED CACHE IN RAM BANK 1 - LD B,BF_SYSXCPY ; HBIOS FUNC: SYSTEM EXTENDED COPY - LD E,BID_USR ; E = SRC BANK = USR BANK = TPA - LD D,BID_BIOS ; D = DEST BANK = HB BANK - RST 08 ; DO IT - LD B,BF_SYSCPY ; HBIOS FUNC: SYSTEM COPY - LD HL,CPM_LOC ; COPY FROM CCP LOCATION IN USR BANK - LD DE,(CCPBUF) ; TO FIXED LOCATION IN HB BANK - LD IX,CCP_SIZ ; COPY CONTENTS OF COMMAND PROCESSOR - RST 08 ; DO IT -#ENDIF - - ; DISK SYSTEM INITIALIZATION - CALL BLKRES ; RESET DISK (DE)BLOCKING ALGORITHM - CALL DEV_INIT ; INITIALIZE CHARACTER DEVICE MAP - CALL MD_INIT ; INITIALIZE MEMORY DISK DRIVER (RAM/ROM) - CALL DRV_INIT ; INITIALIZE DRIVE MAP - CALL DPH_INIT ; INITIALIZE DPH TABLE AND BUFFERS - CALL NEWLINE ; FORMATTING -; - ; DISPLAY FREE MEMORY - LD DE,STR_LDR ; FORMATTING - CALL WRITESTR ; AND PRINT IT - LD HL,CBIOS_END ; SUBTRACT HIGH WATER - LD DE,(BUFTOP) ; ... FROM TOP OF CBIOS - OR A ; ... WITH CF CLEAR - SBC HL,DE ; ... SO HL GETS BYTES FREE - CALL PRTDEC ; PRINT IT - LD DE,STR_MEMFREE ; ADD DESCRIPTION - CALL WRITESTR ; AND PRINT IT -; - LD A,(DEFDRIVE) ; GET DEFAULT DRIVE - LD (CDISK),A ; ... AND SETUP CDISK -; - ; SETUP AUTOSTART COMMAND - LD HL,CMD ; ADDRESS OF STARTUP COMMAND - LD DE,CCP_LOC + 7 ; START OF COMMAND BUFFER IN CCP - LD BC,CMDLEN ; LENGTH OF AUTOSTART COMMAND - LDIR ; INSTALL IT -; - RET -; -CMD .DB CMDLEN - 1 -#IFDEF AUTOCMD - .TEXT AUTOCMD -#ENDIF - .DB 0 -CMDLEN .EQU $ - CMD -; -STR_CPM .DB "CP/M-80 2.2$" -STR_ZSDOS .DB "ZSDOS 1.1$" -STR_BANNER .DB " for ", PLATFORM_NAME, ", CBIOS v", BIOSVER, "$" -STR_MEMFREE .DB " Disk Buffer Bytes Free\r\n$" -; -; -;__________________________________________________________________________________________________ -DEV_INIT: -; -#IF (PLATFORM != PLT_UNA) -; - ; ACTIVATE BIOS BANK - LD B,BF_SYSSETBNK - LD C,BID_BIOS - CALL $FFF0 -; - ; PATCH IN COM0: DEVICE ENTRIES - LD A,(HCB_LOC + HCB_CDL + 1) ; COM0: - CP $FF - JR Z,DEV_INIT1 - LD (DEVMAP + 0),A ; CONSOLE TTY - LD (DEVMAP + 4),A ; READER TTY - LD (DEVMAP + 8),A ; PUNCH TTY - LD (DEVMAP + 12),A ; LIST TTY -; - ; PATCH IN COM1: DEVICE ENTRIES - LD A,(HCB_LOC + HCB_CDL + 2) ; COM1: - CP $FF - JR Z,DEV_INIT1 - LD (DEVMAP + 3),A ; CONSOLE UC1 - LD (DEVMAP + 5),A ; READER PTR - LD (DEVMAP + 9),A ; PUNCH PTP -; - ; PATCH IN COM2: DEVICE ENTRIES - LD A,(HCB_LOC + HCB_CDL + 3) ; COM2: - CP $FF - JR Z,DEV_INIT1 - LD (DEVMAP + 6),A ; READER UR1 - LD (DEVMAP + 10),A ; PUNCH PT1 -; - ; PATCH IN COM3: DEVICE ENTRIES - LD A,(HCB_LOC + HCB_CDL + 4) ; COM3: - CP $FF - JR Z,DEV_INIT1 - LD (DEVMAP + 7),A ; READER UR2 - LD (DEVMAP + 11),A ; PUNCH PT2 -; -DEV_INIT1: -; - ; REACTIVATE USER BANK - LD B,BF_SYSSETBNK - LD C,BID_USR - CALL $FFF0 -; - RET -; -#ENDIF -; -; -;__________________________________________________________________________________________________ -MD_INIT: -; -#IF (PLATFORM == PLT_UNA) -; -; INITIALIZE RAM DISK BY FILLING DIRECTORY WITH 'E5' BYTES -; FILL FIRST 8K OF RAM DISK TRACK 1 WITH 'E5' -; -#IF (CLRRAMDISK != CLR_NEVER) - LD BC,$01FB ; UNA FUNC = SET BANK - LD DE,BID_RAMD0 ; FIRST BANK OF RAM DISK - CALL $FFFD ; DO IT (RST 08 NOT SAFE HERE) - -#IF (CLRRAMDISK == CLR_AUTO) - ; CHECK FIRST 32 DIRECTORY ENTRIES. IF ANY START WITH AN INVALID - ; VALUE, INIT THE RAM DISK. VALID ENTRIES ARE E5 (EMPTY ENTRY) OR - ; 0-15 (USER NUMBER). - LD HL,0 - LD DE,32 - LD B,32 -CLRRAM0: - LD A,(HL) - CP $E5 - JR Z,CLRRAM1 ; E5 IS VALID - CP 16 - JR C,CLRRAM1 ; 0-15 IS ALSO VALID - JR CLRRAM2 ; INVALID ENTRY! JUMP TO INIT -CLRRAM1: - ADD HL,DE ; LOOP FOR 32 ENTRIES - DJNZ CLRRAM0 -; JR CLRRAM2 ; *DEBUG* - JR CLRRAM3 ; ALL ENTRIES VALID, BYPASS INIT -CLRRAM2: -#ENDIF - LD BC,$01FB ; UNA FUNC = SET BANK - LD DE,BID_USR ; SWITCH BACK TO EXEC BANK FOR WRITESTR - CALL $FFFD ; DO IT (RST 08 NOT SAFE HERE) - - LD DE,STR_INITRAMDISK ; RAM DISK INIT MESSAGE - CALL WRITESTR ; DISPLAY IT - - LD BC,$01FB ; UNA FUNC = SET BANK - LD DE,BID_RAMD0 ; FIRST BANK OF RAM DISK - CALL $FFFD ; DO IT (RST 08 NOT SAFE HERE) - - LD HL,0 ; SOURCE ADR FOR FILL - LD BC,$2000 ; LENGTH OF FILL IS 8K - LD A,$E5 ; FILL VALUE - CALL FILL ; DO IT -CLRRAM3: - LD BC,$01FB ; UNA FUNC = SET BANK - LD DE,BID_USR ; SWITCH BACK TO EXEC BANK - CALL $FFFD ; DO IT (RST 08 NOT SAFE HERE) - -#ENDIF - -#ELSE -; -; INITIALIZE RAM DISK BY FILLING DIRECTORY WITH 'E5' BYTES -; FILL FIRST 8K OF RAM DISK TRACK 1 WITH 'E5' -; -#IF (CLRRAMDISK != CLR_NEVER) - LD B,BF_SYSSETBNK ; HBIOS FUNC: SET BANK - LD C,BID_RAMD0 ; FIRST BANK OF RAM DISK - CALL $FFF0 ; DO IT (RST 08 NOT SAFE) - -#IF (CLRRAMDISK == CLR_AUTO) - ; CHECK FIRST 32 DIRECTORY ENTRIES. IF ANY START WITH AN INVALID - ; VALUE, INIT THE RAM DISK. VALID ENTRIES ARE E5 (EMPTY ENTRY) OR - ; 0-15 (USER NUMBER). - LD HL,0 - LD DE,32 - LD B,32 -CLRRAM0: - LD A,(HL) - CP $E5 - JR Z,CLRRAM1 ; E5 IS VALID - CP 16 - JR C,CLRRAM1 ; 0-15 IS ALSO VALID - JR CLRRAM2 ; INVALID ENTRY! JUMP TO INIT -CLRRAM1: - ADD HL,DE ; LOOP FOR 32 ENTRIES - DJNZ CLRRAM0 -; JR CLRRAM2 ; *DEBUG* - JR CLRRAM3 ; ALL ENTRIES VALID, BYPASS INIT -CLRRAM2: -#ENDIF - LD B,BF_SYSSETBNK ; HBIOS FUNC: SET BANK - LD C,BID_USR ; SWITCH BACK TO USR BANK - CALL $FFF0 ; DO IT (RST 08 NOT SAFE) - LD DE,STR_INITRAMDISK ; RAM DISK INIT MESSAGE - CALL WRITESTR ; DISPLAY IT - LD B,BF_SYSSETBNK ; HBIOS FUNC: SET BANK - LD C,BID_RAMD0 ; SWITCH BACK TO FIRST BANK - CALL $FFF0 ; DO IT (RST 08 NOT SAFE) - LD HL,0 ; SOURCE ADR FOR FILL - LD BC,$2000 ; LENGTH OF FILL IS 8K - LD A,$E5 ; FILL VALUE - CALL FILL ; DO IT -CLRRAM3: - LD B,BF_SYSSETBNK ; HBIOS FUNC: SET BANK - LD C,BID_USR ; USR BANK (TPA) - CALL $FFF0 ; DO IT (RST 08 NOT SAFE) -#ENDIF -; -#ENDIF -; - RET -; -; -;__________________________________________________________________________________________________ -#IF (PLATFORM == PLT_UNA) -; -DRV_INIT: -; -; PERFORM UBIOS SPECIFIC INITIALIZATION -; BUILD DRVMAP BASED ON AVAILABLE UBIOS DISK DEVICE LIST -; - ; GET BOOT DEVICE/UNIT/LU INFO - LD BC,$00FC ; UNA FUNC: GET BOOTSTRAP HISTORY - RST 08 ; CALL UNA - LD D,L ; SAVE L AS DEVICE/UNIT - LD E,0 ; LU IS ZERO - LD (BOOTVOL),DE ; D -> DEVICE/UNIT, E -> LU -; -; PERFORM UNA BIOS SPECIFIC INITIALIZATION -; UPDATE DRVMAP BASED ON AVAILABLE UNA UNITS -; - ; SETUP THE DRVMAP STRUCTURE - LD HL,(BUFTOP) ; GET CURRENT BUFFER TOP - INC HL ; SKIP 1 BYTE FOR ENTRY COUNT PREFIX - LD (DRVMAPADR),HL ; SAVE AS DRIVE MAP ADDRESS - LD (BUFTOP),HL ; ... AND AS NEW BUFTOP -; - LD B,0 ; START WITH UNIT 0 -; -DRV_INIT1: ; LOOP THRU ALL UNITS AVAILABLE - LD C,$48 ; UNA FUNC: GET DISK TYPE - LD L,0 ; PRESET UNIT COUNT TO ZERO - CALL $FFFD ; CALL UNA, B IS ASSUMED TO BE UNTOUCHED!!! - LD A,L ; UNIT COUNT TO A - OR A ; PAST END? - JR Z,DRV_INIT2 ; WE ARE DONE - PUSH BC ; SAVE UNIT - CALL DRV_INIT3 ; PROCESS THE UNIT - POP BC ; RESTORE UNIT - INC B ; NEXT UNIT - JR DRV_INIT1 ; LOOP -; -DRV_INIT2: ; FINALIZE THE DRIVE MAP - RET ; DONE -; -DRV_INIT3: ; PROCESS CURRENT UNIT (SEE UNA PROTOIDS.INC) - LD A,D ; MOVE DISK TYPE TO A -; CALL PC_LBKT ; *DEBUG* -; CALL PRTHEXBYTE ; *DEBUG* -; CALL PC_RBKT ; *DEBUG* -; - CALL DRV_INIT4 ; MAKE A DRIVE MAP ENTRY - LD A,D ; LOAD DRIVE TYPE - CP $40 ; RAM/ROM? - RET Z ; DONE IF SO -; CP $?? ; FLOPPY DRIVE? -; RET Z ; DONE IF SO - CALL DRV_INIT4 ; ANOTHER ENTRY FOR HARD DISK - LD A,1 ; BUT WITH SLICE VALUE OF 1 - INC HL ; BUMP TO SLICE POSITION - LD (HL),A ; SAVE IT - RET ; DONE -; -DRV_INIT4: - ; ALLOCATE SPACE IN DRVMAP - PUSH BC ; SAVE INCOMING UNIT NUM - LD BC,4 ; 4 BYTES PER ENTRY - CALL ALLOC ; ALLOCATE - CALL NZ,PANIC ; SHOULD NEVER ERROR HERE - PUSH BC ; MOVE MEM PTR - POP HL ; ... TO HL - POP BC ; RECOVER UNIT NUM - LD (HL),B ; SAVE IT IN FIRST BYTE OF DRV MAP ENTRY - PUSH HL ; SAVE HL - LD HL,(DRVMAPADR) ; POINT TO DRIVE MAP - DEC HL ; BACK TO ENTRY COUNT - INC (HL) ; INCREMENT THE ENTRY COUNT - POP HL ; RECOVER HL - RET ; DONE -; -#ELSE -; -DRV_INIT: -; -; PERFORM HBIOS SPECIFIC INITIALIZATION -; BUILD DRVMAP BASED ON AVAILABLE HBIOS DISK DEVICE LIST -; - ; GET BOOT DEVICE/UNIT/LU INFO - LD B,BF_SYSHCBGETW ; HB FUNC: GET HCB WORD - LD C,HCB_BOOTVOL ; BOOT VOLUME (DEV/UNIT, SLICE) - RST 08 ; GET THE VALUE - LD (BOOTVOL),DE ; D -> DEVICE/UNIT, E -> LU -; - ; SETUP THE DRVMAP STRUCTURE - LD HL,(BUFTOP) ; GET CURRENT BUFFER TOP - INC HL ; SKIP 1 BYTE FOR ENTRY COUNT PREFIX - LD (DRVMAPADR),HL ; SAVE AS DRVMAP ADDRESS - LD (BUFTOP),HL ; AND AS NEW BUFTOP -; - ; SETUP TO LOOP THROUGH AVAILABLE DEVICES - LD B,BF_DIOGETCNT ; HBIOS FUNC: DEVICE COUNT - RST 08 ; CALL HBIOS, DEVICE COUNT TO B - LD A,B ; COUNT TO A - OR A ; SET FLAGS - RET Z ; HANDLE ZERO DEVICES (ALBEIT POORLY) - LD C,0 ; USE C AS DEVICE LIST INDEX -; -DRV_INIT1: ; DEVICE ENUMERATION LOOP - PUSH BC ; PRESERVE LOOP CONTROL - LD B,BF_DIOGETINF ; HBIOS FUNC: DEVICE INFO - RST 08 ; CALL HBIOS, DEVICE/UNIT TO C - CALL DRV_INIT3 ; MAKE DRIVE MAP ENTRY(S) - POP BC ; RESTORE LOOP CONTROL - INC C ; INCREMENT LIST INDEX - DJNZ DRV_INIT1 ; LOOP AS NEEDED - RET ; FINISHED -; -DRV_INIT3: ; PROCESS DEVICE/UNIT - LD A,C ; DEVICE/UNIT TO A - PUSH AF ; SAVE DEVICE/UNIT - CALL DRV_INIT4 ; MAKE A DRIVE MAP ENTRY - POP AF ; RESTORE DEVICE/UNIT - CP DIODEV_IDE ; FIRST SLICE CAPABLE DEVICE? - RET C ; DONE IF NOT SLICE WORTHY - CALL DRV_INIT4 ; MAKE ANOTHER ENTRY IF HARD DISK - LD A,1 ; ... BUT WITH SLICE = 1 - INC HL ; BUMP TO SLICE POSITION - LD (HL),A ; SAVE IT - RET ; DONE -; -DRV_INIT4: ; MAKE A DRIVE MAP ENTRY - ; ALLOCATE SPACE FOR ENTRY - PUSH AF ; SAVE INCOMING DEVICE/UNIT - LD BC,4 ; 4 BYTES PER ENTRY - CALL ALLOC ; ALLOCATE SPACE - CALL NZ,PANIC ; SHOULD NEVER ERROR HERE - PUSH BC ; MOVE MEM PTR - POP HL ; ... TO HL - POP AF ; RECOVER DEVICE/UNIT - LD (HL),A ; SAVE IT IN FIRST BYTE OF DRVMAP - PUSH HL ; SAVE ENTRY PTR - LD HL,(DRVMAPADR) ; POINT TO DRIVE MAP - DEC HL ; BACKUP TO ENTRY COUNT - INC (HL) ; INCREMENT THE ENTRY COUNT - POP HL ; RECOVER ENTRY POINTER - RET ; DONE -; -#ENDIF -; -; -;__________________________________________________________________________________________________ -; -DPH_INIT: -; -; ITERATE THROUGH DRIVE MAP TO BUILD DPH ENTRIES DYNAMICALLY -; - LD DE,STR_DPHINIT ; POINT TO MSG - CALL WRITESTR ; DISPLAY IT - CALL NEWLINE ; FORMATTING -; - ; ALLOCATE DPH POOL SPACE BASED ON DRIVE COUNT - LD HL,(DRVMAPADR) ; LOAD DRIVE MAP POINTER - DEC HL ; BACKUP TO ENTRY COUNT - LD A,(HL) ; GET THE ENTRY COUNT - LD L,A ; PUT DRIVE COUNT - LD H,0 ; ... INTO HL - ADD HL,HL ; MULTIPLY - ADD HL,HL ; ... BY SIZE - ADD HL,HL ; ... OF DPH (16) - ADD HL,HL ; ... FOR TOTAL SIZE - PUSH HL ; MOVE POOL SIZE - POP BC ; ... INTO BC FOR MEM ALLOC - CALL ALLOC ; ALLOCATE THE SPACE - CALL NZ,PANIC ; SHOULD NEVER ERROR -; - ; SET DPHTOP TO START OF ALLOCATED SPACE - PUSH BC ; MOVE MEM POINTER - POP HL ; ... TO HL - LD (DPHTOP),HL ; ... AND SAVE IN DPHTOP -; - ; ALLOCATE DIRECTORY BUFFER - LD BC,128 ; SIZE OF DIRECTORY BUFFER - CALL ALLOC ; ALLOCATE THE SPACE - CALL NZ,PANIC ; SHOULD NEVER ERROR - PUSH BC ; MOVE MEM POINTER - POP HL ; ... TO HL - LD (DIRBUF),HL ; ... AND SAVE IN DIRBUF -; - ; SETUP FOR DPH BUILD LOOP - LD HL,(DRVMAPADR) ; POINT TO DRIVE MAP - DEC HL ; BACKUP TO ENTRY COUNT - LD B,(HL) ; LOOP DRVCNT TIMES - LD C,0 ; DRIVE INDEX - INC HL ; BUMP TO START OF DRIVE MAP -; -DPH_INIT1: - ; DISPLAY DRIVE LETTER - LD A,C ; LOAD DRIVE INDEX - ADD A,'A' ; MAKE IT A DISPLAY LETTER - LD DE,STR_LDR ; LEADER STRING - CALL WRITESTR ; DISPLAY IT - CALL COUT ; DISPLAY DRIVE LETTER - CALL PC_COLON ; DISPLAY COLON - LD A,'=' ; SEPARATOR - CALL COUT ; DISPLAY IT - ; SETUP FOR DPH BUILD ROUTINE INCLUDING DPH BLOCK ALLOCATION - LD D,(HL) ; D := DEV/UNIT - INC HL ; BUMP - LD E,(HL) ; E := SLICE - INC HL ; BUMP - CALL PRTDUS ; PRINT DEVICE/UNIT/SLICE - LD A,D ; A := DEV/UNIT - PUSH HL ; SAVE DRIVE MAP POINTER - PUSH AF ; SAVE DEV/UNIT - ; MATCH AND SAVE DEFAULT DRIVE BASED ON BOOT DEVICE/UNIT/SLICE - LD HL,BOOTVOL + 1 ; POINT TO BOOT DEVICE/UNIT - LD A,D ; LOAD CURRENT DEVICE/UNIT - CP (HL) ; MATCH? - JR NZ,DPH_INIT1A ; BYPASS IF NOT BOOT DEVICE/UNIT - DEC HL ; POINT TO BOOT SLICE - LD A,E ; LOAD CURRENT SLICE - CP (HL) ; MATCH? - JR NZ,DPH_INIT1A ; BYPASS IF NOT BOOT SLICE - LD A,C ; LOAD THE CURRENT DRIVE NUM - LD (DEFDRIVE),A ; SAVE AS DEFAULT -DPH_INIT1A: - POP AF ; RESTORE DEV/UNIT - LD DE,(DPHTOP) ; GET ADDRESS OF NEXT DPH - PUSH DE ; ... AND SAVE IT - ; INVOKE THE DPH BUILD ROUTINE - PUSH BC ; SAVE LOOP CONTROL - CALL MAKDPH ; MAKE THE DPH AT DE, DEV/UNIT IN A - ;CALL NZ,PANIC ; FOR NOW, PANIC ON ANY ERROR - POP BC ; RESTORE LOOP CONTROL - ; STORE THE DPH POINTER IN DRIVE MAP - POP DE ; RESTORE DPH ADDRESS TO DE - POP HL ; RESTORE DRIVE MAP POINTER TO HL - JR Z,DPH_INIT2 ; IF MAKDPH OK, CONTINUE - LD DE,0 ; ... OTHERWISE ZERO OUT THE DPH POINTER -DPH_INIT2: - LD (HL),E ; SAVE DPH POINTER - INC HL ; ... IN - LD (HL),D ; ... DRIVE MAP - INC HL ; AND BUMP TO START OF NEXT ENTRY - ; UPDATE DPH ALLOCATION TOP - LD A,16 ; SIZE OF A DPH ENTRY - EX DE,HL ; HL := DPH POINTER - CALL ADDHLA ; CALC NEW DPHTOP - LD (DPHTOP),HL ; SAVE IT - ; HANDLE THE NEXT DRIVE MAP ENTRY - EX DE,HL ; HL := NEXT DRIVE MAP ENTRY - INC C ; NEXT DRIVE - DJNZ DPH_INIT1 ; LOOP AS NEEDED - RET ; DONE -; -MAKDPH: -; -; MAKE A DPH AT ADDRESS IN DE FOR DEV/UNIT IN A -; - PUSH DE ; SAVE INCOMING DPH ADDRESS -; -#IF (PLATFORM == PLT_UNA) -; - LD B,A ; UNIT NUM TO B - LD C,$48 ; UNA FUNC: GET DISK TYPE - CALL $FFFD ; CALL UNA - LD A,D ; MOVE DISK TYPE TO A -; - ; DERIVE DPB ADDRESS BASED ON DISK TYPE - CP $40 ; RAM/ROM DRIVE? - JR Z,MAKDPH0 ; HANDLE RAM/ROM DRIVE IF SO -; CP $?? ; FLOPPY DRIVE? -; JR Z,XXXXX ; HANDLE FLOPPY - LD DE,DPB_HD ; ASSUME HARD DISK - JR MAKDPH1 ; CONTINUE -; -MAKDPH0: ; HANDLE RAM/ROM - LD C,$45 ; UNA FUNC: GET DISK INFO - LD DE,$9000 ; 512 BYTE BUFFER *** FIX!!! *** - CALL $FFFD ; CALL UNA - BIT 7,B ; TEST RAM DRIVE BIT - LD DE,DPB_ROM ; ASSUME ROM - JR Z,MAKDPH1 ; NOT SET, ROM DRIVE, CONTINUE - LD DE,DPB_RAM ; OTHERWISE, MUST BE RAM DRIVE - JR MAKDPH1 ; CONTINUE -; -#ELSE -; - ; DETERMINE APPROPRIATE DPB - LD DE,DPB_ROM ; ASSUME ROM - CP DIODEV_MD+0 ; ROM? - JR Z,MAKDPH1 ; YES, JUMP AHEAD - LD DE,DPB_RAM ; ASSUME ROM - CP DIODEV_MD+1 ; ROM? - JR Z,MAKDPH1 ; YES, JUMP AHEAD - AND $F0 ; IGNORE UNIT NIBBLE NOW - LD DE,DPB_FD144 ; ASSUME FLOPPY - CP DIODEV_FD ; FLOPPY? - JR Z,MAKDPH1 ; YES, JUMP AHEAD - LD DE,DPB_RF ; ASSUME RAM FLOPPY - CP DIODEV_RF ; RAM FLOPPY? - JR Z,MAKDPH1 ; YES, JUMP AHEAD - LD DE,DPB_HD ; EVERYTHING ELSE IS ASSUMED TO BE HARD DISK - JR MAKDPH1 ; JUMP AHEAD -; -#ENDIF -; -MAKDPH1: -; - ; BUILD THE DPH - POP HL ; HL := START OF DPH - LD A,8 ; SIZE OF DPH RESERVED AREA - CALL ADDHLA ; LEAVE IT ALONE (ZERO FILLED) - - LD BC,(DIRBUF) ; ADDRESS OF DIRBUF - LD (HL),C ; PLUG DIRBUF - INC HL ; ... INTO DPH - LD (HL),B ; ... AND BUMP - INC HL ; ... TO NEXT DPH ENTRY - - LD (HL),E ; PLUG DPB ADDRESS - INC HL ; ... INTO DPH - LD (HL),D ; ... AND BUMP - INC HL ; ... TO NEXT ENTRY - DEC DE ; POINT - DEC DE ; ... TO START - DEC DE ; ... OF - DEC DE ; ... DPB - DEC DE ; ... PREFIX DATA (CKS & ALS BUF SIZES) - CALL MAKDPH2 ; HANDLE CKS BUF, THEN FALL THRU FOR ALS BUF - RET NZ ; BAIL OUT ON ERROR -MAKDPH2: - EX DE,HL ; POINT HL TO CKS/ALS SIZE ADR - LD C,(HL) ; BC := CKS/ALS SIZE - INC HL ; ... AND BUMP - LD B,(HL) ; ... PAST - INC HL ; ... CKS/ALS SIZE - EX DE,HL ; BC AND HL ROLES RESTORED - LD A,B ; CHECK TO SEE - OR C ; ... IF BC IS ZERO - JR Z,MAKDPH3 ; IF ZERO, BYPASS ALLOC, USE ZERO FOR ADDRESS - CALL ALLOC ; ALLOC BC BYTES, ADDRESS RETURNED IN BC - JR NZ,ERR_BUFOVF ; HANDLE OVERFLOW ERROR -MAKDPH3: - LD (HL),C ; SAVE CKS/ALS BUF - INC HL ; ... ADDRESS IN - LD (HL),B ; ... DPH AND BUMP - INC HL ; ... TO NEXT DPH ENTRY - XOR A ; SIGNAL SUCCESS - RET -; -ALLOC: -; -; ALLOCATE BC BYTES FROM BUF POOL, RETURN STARTING -; ADDRESS IN BC. LEAVE ALL OTHER REGS ALONE EXCEPT A -; Z FOR SUCCESS, NZ FOR FAILURE -; - PUSH DE ; SAVE ORIGINAL DE - PUSH HL ; SAVE ORIGINAL HL - LD HL,(BUFTOP) ; HL := CURRENT BUFFER TOP - PUSH HL ; SAVE AS START OF NEW BUFFER - PUSH BC ; GET BYTE COUNT - POP DE ; ... INTO DE - ADD HL,DE ; ADD IT TO BUFFER TOP - LD A,$FF ; ASSUME OVERFLOW FAILURE - JR C,ALLOC1 ; IF OVERFLOW, BYPASS WITH A == $FF - PUSH HL ; SAVE IT - LD DE,$10000 - CBIOS_END ; SETUP DE FOR OVERFLOW TEST - ADD HL,DE ; CHECK FOR OVERFLOW - POP HL ; RECOVER HL - LD A,$FF ; ASSUME FAILURE - JR C,ALLOC1 ; IF OVERFLOW, CONTINUE WITH A == $FF - LD (BUFTOP),HL ; SAVE NEW TOP - INC A ; SIGNAL SUCCESS -; -ALLOC1: - POP BC ; BUF START ADDRESS TO BC - POP HL ; RESTORE ORIGINAL HL - POP DE ; RESTORE ORIGINAL DE - OR A ; SIGNAL SUCCESS - RET -; -ERR_BUFOVF: - LD DE,STR_BUFOVF - JR ERR -; -ERR_INVMED: - LD DE,STR_INVMED - JR ERR -; -ERR: - CALL WRITESTR - OR $FF - RET -; -PRTDUS: -; -; PRINT THE DEVICE/UNIT/SLICE INFO -; ON INPUT D HAS DEVICE/UNIT, E HAS SLICE -; DESTROY NO REGISTERS OTHER THAN A -; -#IF (PLATFORM == PLT_UNA) -; - PUSH BC ; PRESERVE BC - PUSH DE ; PRESERVE DE - PUSH HL ; PRESERVE HL - - LD B,D ; B := UNIT - LD C,$48 ; UNA FUNC: GET DISK TYPE - CALL $FFFD ; CALL UNA - LD A,D ; DISK TYPE TO A - - CP $40 - JR Z,PRTDUS1 ; IF SO, HANDLE RAM/ROM - - LD DE,DEVIDE ; IDE STRING - CP $41 ; IDE? - JR Z,PRTDUSX ; IF YES, PRINT - LD DE,DEVPPIDE ; PPIDE STRING - CP $42 ; PPIDE? - JR Z,PRTDUSX ; IF YES, PRINT - LD DE,DEVSD ; SD STRING - CP $43 ; SD? - JR Z,PRTDUSX ; IF YES, PRINT - LD DE,DEVDSD ; DSD STRING - CP $44 ; DSD? - JR Z,PRTDUSX ; IF YES, PRINT - - LD DE,DEVUNK ; OTHERWISE, UNKNOWN - JR PRTDUSX ; PRINT IT - -PRTDUS1: - LD C,$45 ; UNA FUNC: GET DISK INFO - LD DE,$9000 ; 512 BYTE BUFFER *** FIX!!! *** - CALL $FFFD ; CALL UNA - BIT 7,B ; TEST RAM DRIVE BIT - LD DE,DEVROM ; ASSUME ROM - JR Z,PRTDUSX ; IF SO, DISPLAY ROM - LD DE,DEVRAM ; ELSE RAM - JR Z,PRTDUSX ; DO IT - -PRTDUSX: - CALL WRITESTR ; PRINT DEVICE NAME - POP HL ; RECOVER HL - POP DE ; RECOVER DE - POP BC ; RECOVER BC - LD A,D ; LOAD DEVICE/UNIT - CALL PRTDECB ; PRINT IT - CALL PC_COLON ; FORMATTING - LD A,E ; LOAD SLICE - CALL PRTDECB ; PRINT IT - RET -; -DEVRAM .DB "RAM$" -DEVROM .DB "ROM$" -DEVIDE .DB "IDE$" -DEVPPIDE .DB "PPIDE$" -DEVSD .DB "SD$" -DEVDSD .DB "DSD$" -DEVUNK .DB "UNK$" -; -#ELSE -; - PUSH DE ; PRESERVE DE - PUSH HL ; PRESERVE HL - LD A,D ; LOAD DEVICE/UNIT - RRCA ; ROTATE DEVICE - RRCA ; ... BITS - RRCA ; ... INTO - RRCA ; ... LOWEST 4 BITS - AND $0F ; ISOLATE DEVICE BITS - ADD A,A ; MULTIPLE BY TWO FOR WORD TABLE - LD HL,DEVTBL ; POINT TO START OF DEVICE NAME TABLE - CALL ADDHLA ; ADD A TO HL TO POINT TO TABLE ENTRY - LD A,(HL) ; DEREFERENCE HL TO LOC OF DEVICE NAME STRING - INC HL ; ... - LD D,(HL) ; ... - LD E,A ; ... - CALL WRITESTR ; PRINT THE DEVICE NMEMONIC - POP HL ; RECOVER HL - POP DE ; RECOVER DE - LD A,D ; LOAD DEVICE/UNIT - AND $0F ; ISOLATE UNIT - CALL PRTDECB ; PRINT IT - CALL PC_COLON ; FORMATTING - LD A,E ; LOAD SLICE - CALL PRTDECB ; PRINT IT - RET -; -DEVTBL: ; DEVICE TABLE - .DW DEV00, DEV01, DEV02, DEV03 - .DW DEV04, DEV05, DEV06, DEV07 - .DW DEV08, DEV09, DEV10, DEV11 - .DW DEV12, DEV13, DEV14, DEV15 -; -DEVUNK .DB "???$" -DEV00 .DB "MD$" -DEV01 .DB "FD$" -DEV02 .DB "RAMF$" -DEV03 .DB "IDE$" -DEV04 .DB "ATAPI$" -DEV05 .DB "PPIDE$" -DEV06 .DB "SD$" -DEV07 .DB "PRPSD$" -DEV08 .DB "PPPSD$" -DEV09 .DB "HDSK$" -DEV10 .EQU DEVUNK -DEV11 .EQU DEVUNK -DEV12 .EQU DEVUNK -DEV13 .EQU DEVUNK -DEV14 .EQU DEVUNK -DEV15 .EQU DEVUNK -; -#ENDIF -; -DPHTOP .DW 0 ; CURRENT TOP OF DPH POOL -DIRBUF .DW 0 ; DIR BUF POINTER -BUFTOP .DW BUFPOOL ; CURRENT TOP OF BUF POOL -BOOTVOL .DW ; BOOT VOLUME, MSB=BOOT DEVICE/UNIT, LSB=BOOT LU -; -STR_INITRAMDISK .DB "\r\nFormatting RAMDISK...$" -STR_LDR .DB "\r\n $" -STR_DPHINIT .DB "\r\n\r\nConfiguring Drives...$" -STR_BUFOVF .DB " *** Insufficient Memory ***$" -STR_INVMED .DB " *** Invalid Device ID ***$" -; -;================================================================================================== -; -;================================================================================================== -; - .FILL CBIOS_END - $,$00 -; -SLACK .EQU (CBIOS_END - BUFPOOL) - .ECHO "CBIOS buffer space: " - .ECHO SLACK - .ECHO " bytes.\n" -; - .ECHO "CBIOS total space used: " - .ECHO $ - CBIOS_LOC - .ECHO " bytes.\n" -; - ; PAD OUT AREA RESERVED FOR HBIOS PROXY - .FILL $10000 - $ -; - .END diff --git a/Source/HBIOS/Old/comldr.asm b/Source/HBIOS/Old/comldr.asm deleted file mode 100644 index 46729e51..00000000 --- a/Source/HBIOS/Old/comldr.asm +++ /dev/null @@ -1,19 +0,0 @@ -; -;================================================================================================== -; APPLICATION LOADER (COM FILE) -; -; CREATES A STANDARD CP/M COM APPLICATION FILE TO LOAD ROMWBW -; FROM A COMMAND PROMPT. -;================================================================================================== -; -#define MODE LM_COM -; -#INCLUDE "std.asm" -#INCLUDE "hbios.exp" -; - .ORG $100 - JP START -; -#INCLUDE "loader.asm" -; - .END diff --git a/Source/HBIOS/Old/fill1k.asm b/Source/HBIOS/Old/fill1k.asm deleted file mode 100644 index fbed1e65..00000000 --- a/Source/HBIOS/Old/fill1k.asm +++ /dev/null @@ -1,10 +0,0 @@ -; -;================================================================================================== -; FILLER FOR HBIOS PROXY, JUST A 256 BYTE FILLER -;================================================================================================== -; -#INCLUDE "std.asm" -; - .FILL HBX_SIZ,0FFH -; - .END diff --git a/Source/HBIOS/Old/hbfill.asm b/Source/HBIOS/Old/hbfill.asm deleted file mode 100644 index 1bb34c26..00000000 --- a/Source/HBIOS/Old/hbfill.asm +++ /dev/null @@ -1,12 +0,0 @@ -; -;================================================================================================== -; HBIOS FILLER -;================================================================================================== -; -; CREATES A CORRECTLY SIZED FILLER TO FILL SPACE BETWEEN END OF HBIOS -; IMAGE AND END OF BANK ($8000) -; -#INCLUDE "hbios.exp" -; - .FILL $8000 - HB_END,$FF - .END diff --git a/Source/HBIOS/Old/imgldr.asm b/Source/HBIOS/Old/imgldr.asm deleted file mode 100644 index 25978023..00000000 --- a/Source/HBIOS/Old/imgldr.asm +++ /dev/null @@ -1,60 +0,0 @@ -; -;================================================================================================== -; IMAGE LOADER -; -; CREATES A BINARY IMAGE THAT WILL LAUNCH ROMWBW ASSUMING IMAGE -; HAS BEEN PRE-LOADED INTO THE USER BANK. INTENDED FOR USE WITH -; UNA FATFS. -;================================================================================================== -; -#define MODE LM_IMG -; -#INCLUDE "std.asm" -#INCLUDE "hbios.exp" -; - .ORG 0 -; -;================================================================================================== -; NORMAL PAGE ZERO SETUP, RET/RETI/RETN AS APPROPRIATE -;================================================================================================== -; - .FILL (000H - $),0FFH ; RST 0 - JP START ; JUMP TO BOOT CODE - .DW ROM_SIG - .FILL (008H - $),0FFH ; RST 8 - RET - .FILL (010H - $),0FFH ; RST 10 - RET - .FILL (018H - $),0FFH ; RST 18 - RET - .FILL (020H - $),0FFH ; RST 20 - RET - .FILL (028H - $),0FFH ; RST 28 - RET - .FILL (030H - $),0FFH ; RST 30 - RET - .FILL (038H - $),0FFH ; INT - RETI - .FILL (066H - $),0FFH ; NMI - RETN -; - .FILL (070H - $),0FFH ; SIG STARTS AT $80 -; -ROM_SIG: - .DB $76, $B5 ; 2 SIGNATURE BYTES - .DB 1 ; STRUCTURE VERSION NUMBER - .DB 7 ; ROM SIZE (IN MULTIPLES OF 4KB, MINUS ONE) - .DW NAME ; POINTER TO HUMAN-READABLE ROM NAME - .DW AUTH ; POINTER TO AUTHOR INITIALS - .DW DESC ; POINTER TO LONGER DESCRIPTION OF ROM - .DB 0, 0, 0, 0, 0, 0 ; RESERVED FOR FUTURE USE; MUST BE ZERO -; -NAME .DB "ROMWBW v", BIOSVER, ", ", TIMESTAMP, 0 -AUTH .DB "WBW",0 -DESC .DB "ROMWBW v", BIOSVER, ", Copyright 2015, Wayne Warthen, GNU GPL v3", 0 -; - .FILL ($100 - $),$FF ; PAD REMAINDER OF PAGE ZERO -; -#INCLUDE "loader.asm" -; - .END diff --git a/Source/HBIOS/Old/infolist.inc b/Source/HBIOS/Old/infolist.inc deleted file mode 100644 index 99969348..00000000 --- a/Source/HBIOS/Old/infolist.inc +++ /dev/null @@ -1,24 +0,0 @@ -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -; infolist.inc 6/ 7/2012 dwg - removed DSK_MAP pointer ; -; infolist.inc 5/16/2012 dwg - BIOS information pointers ; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -; The putpose of this table is to provide pointers that can -; be used by utility programs to access BIOS internals for -; debugging and informative purposes. Any time the format -; changes, the first word should be incremented to the Apps -; can determine the lineage of a specific BIOS. This table -; was created in support of the 2.0.0.0 banked BIOS. - -INFOLIST: - .DW 2 ; INFOLIST version 2 6/7/2012 - .DW STR_BANNER - .DW STR_BUILD - .DW STR_TIMESTAMP - .DW DPB_MAP - .DW DPH_MAP - .DW CIO_MAP - -;;;;;;;;;;;;;;;;;;;;;; -; eof - infolist.inc ; -;;;;;;;;;;;;;;;;;;;;;; \ No newline at end of file diff --git a/Source/HBIOS/Old/loader.asm b/Source/HBIOS/Old/loader.asm deleted file mode 100644 index dc9e88f2..00000000 --- a/Source/HBIOS/Old/loader.asm +++ /dev/null @@ -1,186 +0,0 @@ -; -;================================================================================================== -; LOADER -;================================================================================================== -; -P2LOC .EQU $F000 ; PHASE 2 RUN LOCATION -; -#IFDEF ROMLOAD -CURBNK .EQU BID_BOOT -#ELSE -CURBNK .EQU BID_USR -#ENDIF -; -;================================================================================================== -; COLD START -;================================================================================================== -; -START: - DI ; NO INTERRUPTS - IM 1 ; INTERRUPT MODE 1 - LD SP,HBX_LOC ; SETUP INITIAL STACK JUST BELOW HBIOS PROXY -; -; HARDWARE BOOTSTRAP FOR Z180 -; FOR N8, ACR & RMAP ARE ASSUMED TO BE ALREADY SET OR THIS CODE -; WOULD NOT BE EXECUTING -; -#IF ((PLATFORM == PLT_N8) | (PLATFORM == PLT_MK4)) - ; SET BASE FOR CPU IO REGISTERS - LD A,Z180_BASE - OUT0 (Z180_ICR),A - - ; DISABLE REFRESH - XOR A - OUT0 (Z180_RCR),A - - ; SET DEFAULT CPU CLOCK MULTIPLIERS (XTAL / 2) - XOR A - OUT0 (Z180_CCR),A - OUT0 (Z180_CMR),A - - ; SET DEFAULT WAIT STATES - LD A,$F0 - OUT0 (Z180_DCNTL),A - - ; MMU SETUP - LD A,$80 - OUT0 (Z180_CBAR),A ; SETUP FOR 32K/32K BANK CONFIG -#IFDEF ROMLOAD - XOR A - OUT0 (Z180_BBR),A ; BANK BASE = 0 -#ENDIF - LD A,(RAMSIZE + RAMBIAS - 64) >> 2 - OUT0 (Z180_CBR),A ; COMMON BASE = LAST (TOP) BANK - -#IF (Z180_CLKDIV >= 1) - ; SET CLOCK DIVIDE TO 1 RESULTING IN FULL XTAL SPEED - LD A,$80 - OUT0 (Z180_CCR),A -#ENDIF - -#IF (Z180_CLKDIV >= 2) - ; SET CPU MULTIPLIER TO 1 RESULTING IN XTAL * 2 SPEED - LD A,$80 - OUT0 (Z180_CMR),A -#ENDIF - - ; SET DESIRED WAIT STATES - LD A,0 + (Z180_MEMWAIT << 6) | (Z180_IOWAIT << 4) - OUT0 (Z180_DCNTL),A -#ENDIF -; -; HARDWARE BOOTSTRAP FOR ZETA 2 -; -#IF (PLATFORM == PLT_ZETA2) - ; SET PAGING REGISTERS -#IFDEF ROMLOAD - XOR A - OUT (MPGSEL_0),A - INC A - OUT (MPGSEL_1),A -#ENDIF - LD A,62 - OUT (MPGSEL_2),A - INC A - OUT (MPGSEL_3),A - ; ENABLE PAGING - LD A,1 - OUT (MPGENA),A -#ENDIF -; -; COPY OURSELVES AND LOADER TO HI RAM FOR PHASE 2 -; - LD HL,0 ; COPY FROM START OF ROM IMAGE - LD DE,P2LOC ; TO HIMEM RUN LOCATION - LD BC,LDR_END ; COPY FULL IMAGE - LDIR - JP PHASE2 ; JUMP TO PHASE 2 BOOT IN UPPER MEMORY -; -; THIS IS THE PHASE 2 CODE THAT MUST EXECUTE IN UPPER MEMORY -; - .ORG $ + P2LOC ; WE ARE NOW EXECUTING IN UPPER MEMORY -; -PHASE2: -; -; INSTALL HBIOS PROXY IN UPPER MEMORY -; - -;#IFDEF ROMLOAD -; LD A,BID_BIOSIMG ; HBIOS IMAGE ROM BANK -; CALL BNKSEL ; SELECT IT -;#ENDIF - LD HL,HBX_IMG ; HL := SOURCE OF HBIOS PROXY IMAGE -#IFNDEF ROMLOAD - LD BC,LDR_END ; SIZE OF LOADER - ADD HL,BC ; OFFSET SOURCE ADDRESS -#ENDIF - LD DE,HBX_LOC ; DE := DESTINATION TO INSTALL IT - LD BC,HBX_SIZ ; SIZE - LDIR ; DO THE COPY - LD A,CURBNK ; BOOT/SETUP BANK - LD (HB_CURBNK),A ; INIT CURRENT BANK - -;#IFDEF ROMLOAD -; CALL BNKSEL ; SELECT IT -;#ENDIF - -; -; INSTALL HBIOS CODE BANK -; -;#IFDEF ROMLOAD -; LD A,BID_BIOSIMG ; SOURCE BANK -;#ELSE - LD A,(HB_CURBNK) ; SOURCE BANK -;#ENDIF - LD (HB_SRCBNK),A ; SET IT - LD A,BID_BIOS ; DESTINATION BANK - LD (HB_DSTBNK),A ; SET IT - LD HL,0 ; SOURCE ADDRESS IS ZERO -#IFNDEF ROMLOAD - LD BC,LDR_END ; SIZE OF LOADER - ADD HL,BC ; OFFSET SOURCE ADDRESS -#ENDIF - LD DE,0 ; TARGET ADDRESS IS ZERO - LD BC,HB_END ; COPY ALL OF HBIOS IMAGE - CALL HB_BNKCPY ; DO IT -; -; INITIALIZE HBIOS -; - LD A,BID_BIOS ; HBIOS BANK - LD HL,0 ; ADDRESS 0 IS HBIOS INIT ENTRY ADDRESS - CALL HB_BNKCALL ; DO IT -; -; CHAIN TO OS LOADER -; -#IFDEF ROMLOAD - ; PERFORM BANK CALL TO OS IMAGES BANK - LD A,BID_OSIMG ; CHAIN TO OS IMAGES BANK - LD HL,0 ; ENTER AT ADDRESS 0 - CALL HB_BNKCALL ; GO THERE - HALT ; WE SHOULD NEVER COME BACK! -#ELSE - ; SLIDE OS IMAGES BLOB DOWN TO $0000 - LD HL,LDR_END ; SOURCE IS LOADER END - LD BC,HB_END ; PLUS HBIOS IMAGE SIZE - ADD HL,BC ; FINAL SOURCE ADDRESS - LD DE,0 ; TARGET ADDRESS IS ZERO - LD BC,BNKTOP ; MAX SIZE OF OS IMAGES - LDIR ; DO IT - ; JUMP TO START - JP 0 ; AND CHAIN -#ENDIF -; -;================================================================================================== -; MEMORY MANAGER -;================================================================================================== -; -#IFDEF ROMLOAD -#INCLUDE "memmgr.asm" -#ENDIF -; -;================================================================================================== -; CLEAN UP -;================================================================================================== -; - .ORG $ - P2LOC ; BACK TO IMAGE-BASED ADDRESSING -LDR_END .EQU $ ; MARK END OF LOADER diff --git a/Source/HBIOS/Old/makefile b/Source/HBIOS/Old/makefile deleted file mode 100644 index b4f3bc39..00000000 --- a/Source/HBIOS/Old/makefile +++ /dev/null @@ -1,289 +0,0 @@ -# -# GCC based makefile -# -# 05/24/2012 2.3 wbw - changed to handle revised build parms -# -# 05/24/2012 2.0 wbw - changed to handle HBIOS -# -# 01/11/2011 1.4 wbw - added support for ZSDOS/ZDDOS/ZCPR -# -# 12/22/2011 1.3 wbw - removed all built-in config stuff, operation is now entirely -# dependent on variables CONFIG, ROMSIZE, and CPU -# -# 12/02/2011 1.3 wbw - replaced makever functionality with built-in makefile stuff -# -# 11/29/2011 1.3 dwg - uses makever to generate stdincl.inc from the version.hpp file -# -# 11/19/2011 1.3 dwg - added n8vem_vdu to "usage" and "all" rules -# enhanced clean to get files in $(OUTDIR) -# added custom to "all" rule - -# -# The operation of this makefile is entirely dependent on the setting -# of five variables: PLATFORM, CONFIG, ROMSIZE, SYS, and optionally ROMNAME: -# -# PLATFORM specifies the base hardware platform you are targeting -# and must be one of N8VEM, ZETA, N8, S2I, or S100 -# -# CONFIG determines which configuration to build which means that -# it will determine the config_xxxx_yyyy.asm config settings file to -# include as well as the output file names. So, for example, -# if PLATFORM is "n8vem" and CONFIG is "cvdu", the config_N8VEM_cvdu.asm -# file will be used for BIOS configuration settings and the output -# files will be N8VEM_cvdu.rom, N8VEM_cvdu.sys, and N8VEM_cvdu.com. -# -# ROMSIZE specifies the size of the ROM image to be produced and -# currently must be either "1024" for a 1MB ROM or "512" for a -# 512KB ROM. -# -# SYS specifies the system variant to build in. CPM will -# build traditional CP/M. ZSYS will build ZSystem which -# currently means ZSDOS 1.2 & ZCPR 1.0 -# -# ROMNAME names the output file. It defaults to -# CONFIG. The output of the build will be: -# .rom, .sys, and .com. -# -# These variables can be passed into the makefile by the command -# line, hardcoded in this file, or set as environment variables -# in the OS. To use a command line, use the following format: -# -# make PLATFORM= CONFIG= ROMSIZE= SYS= -# -# An example of this is: -# -# make PLATFORM=N8VEM CONFIG=cvdu ROMSIZE=512 SYS=CPM -# -# Alternatively, you can specify the variables by hardcoding them -# in this file. To do so, uncomment the five lines after these -# comments and change the values as desired. -# If the variables are specified this way, you would then invoke -# the make by simply using "make" -# -# If you want to set them as environment variables, you can -# do this with commands like the following at an OS command -# prompt or in a batch file: -# -# SET PLATFORM=N8VEM -# SET CONFIG=cvdu -# SET ROMSIZE=512 -# SET SYS=CPM -# SET ROMNAME=n8vem -# -# Note: use "make clean" to delete temporary and output files -# -# A good idea is to do a clean with every build and this can be -# accomplished on one command line doing something like this: -# -# make clean all PLATFORM=N8VEM CONFIG=std ROMSIZE=512 SYS=CPM -# -# or, if you are using hard coded variables above: -# -# make clean all -# -# Uncomment and update values below to hardcode settings: -# -#PLATFORM := N8VEM -#CONFIG := std -#ROMSIZE := 512 -#SYS := CPM -#ROMNAME := n8vem - -ifeq "$(PLATFORM)" "N8" -CPU := 180 -else -CPU := 80 -endif - -ifndef ROMNAME -ROMNAME := $(PLATFORM)_$(CONFIG) -endif - -ifndef "windir" -CPMTOOLSPATH := ../tools/cpmtools -CPMCP := $(CPMTOOLSPATH)/cpmcp.exe -else -CPMCP := /usr/bin/cpmcp -endif - -ROMDSKFILES := ../RomDsk/$(SYS)_$(ROMSIZE)KB/*.* ../RomDsk/cfg_$(PLATFORM)_$(CONFIG)/*.* ../Apps/Output/*.* - -ifeq "$(SYS)" "CPM" -DOSBIN := bdosb01.bin -CPBIN := ccpb03.bin -else -DOSBIN := zsdos.bin -CPBIN := zcprw.bin -endif - -OUTDIR := ../Output - -ifndef "windir" -TASMPATH := ../tools/tasm32 -TASM := $(TASMPATH)/tasm.exe -TASMTABS := $(TASMPATH) -else -TASM := /usr/local/bin/tasm -TASMTABS := /usr/local/lib -endif -export TASMTABS - -ASMOPT80 := -t$(CPU) -g3 -ASMOPT85 := -t85 -g3 - -ASM80 := $(TASM) $(ASMOPT80) -ASM85 := $(TASM) $(ASMOPT85) -ASMIMG := $(TASM) $(ASMOPT80) -b -fE5 - -NULL := -SPACE := ${NULL} ${NULL} - -%.bin: %.asm - $(ASM80) $< $@ - -%.com: %.asm - $(ASM80) $< $@ - -%.img: %.asm - $(ASMIMG) $< $@ - -%.exe: %.cpp - $(CC) $< -o $@ - -ifneq ($(MAKECMDGOALS),clean) -ifeq "$(and $(PLATFORM) $(CONFIG), $(ROMSIZE), $(SYS), $(ROMNAME))" "" -$(error Usage: make PLATFORM=[N8VEM|ZETA|N8|S2I|S100] CONFIG= ROMSIZE=[512|1024] SYS=[CPM|ZSYS] [ROMNAME=]) -endif -endif - -all: $(OUTDIR)/$(ROMNAME).rom $(OUTDIR)/$(ROMNAME).sys $(OUTDIR)/$(ROMNAME).com - -ifndef "windir" -build.inc: - echo ; >$@ - echo ; RomWBW Configured for $(PLATFORM) $(CONFIG), %date:~4,10% %time% >>$@ - echo ; >>$@ - echo #DEFINE TIMESTAMP "%date:~4,10%" >>$@ - echo ; >>$@ - echo ; INCLUDE PLATFORM SPECIFIC DEVICE DEFINITIONS >>$@ - echo ; >>$@ - echo ROMSIZE .EQU $(ROMSIZE) >>$@ - echo PLATFORM .EQU PLT_$(PLATFORM) >>$@ - echo ; >>$@ - echo #IF (PLATFORM == PLT_S100) >>$@ - echo #INCLUDE "std-s100.inc" >>$@ - echo #ELSE >>$@ - echo #INCLUDE "std-n8vem.inc" >>$@ - echo #ENDIF >>$@ - echo ; >>$@ - echo #INCLUDE "config_$(PLATFORM)_$(CONFIG).asm" >>$@ - echo ; >>$@ -else - echo ';' >$@ - echo -n '; RomWBW Configured for '$(CONFIG)'' >>$@ - date >> $@ - echo ';' >>$@ - echo -n '#DEFINE TIMESTAMP "' >>$@ - date '+%Y %m %d %H%M"' >>$@ - echo ';' >>$@ - echo '; INCLUDE PLATFORM SPECIFIC DEVICE DEFINITIONS' >>$@ - echo ';' >>$@ - echo 'ROMSIZE .EQU '$(ROMSIZE)'' >>$@ - echo 'PLATFORM .EQU PLT_'$(PLATFORM)'' >>$@ - - echo '#IF (PLATFORM == PLT_S100)' >>$@ - echo ' #INCLUDE "std-s100.inc"' >>$@ - echo '#ELSE' >>$@ - echo ' #INCLUDE "std-n8vem.inc"' >>$@ - echo '#ENDIF' >>$@ - echo ';' >>$@ - echo '#INCLUDE "config_'$(PLATFORM)'_'$(CONFIG)'.asm"' >>$@ - echo ';' >>$@ -endif - -bootrom.bin : bootrom.asm std.asm build.inc ver.inc - $(TASM) $(ASMOPT80) $< $@ - -bootapp.bin : bootapp.asm std.asm build.inc ver.inc - $(TASM) $(ASMOPT80) $< $@ - -pgzero.bin : pgzero.asm std.asm build.inc ver.inc - $(TASM) $(ASMOPT80) $< $@ - -zcprw.bin : zcprw.asm zcpr.asm - $(TASM) $(ASMOPT85) $< $@ - -zsdos.bin : zsdos.asm zsdos.lib zsdos-gp.z80 - $(TASM) $(ASMOPT80) $< $@ - -cbios.bin: cbios.asm fd_dph.asm ide_dph.asm ppide_dph.asm sd_dph.asm prp_dph.asm ppp_dph.asm std.asm ver.inc build.inc - $(TASM) $(ASMOPT80) -dBLD_SYS=SYS_$(SYS) $< $@ - -dbgmon.bin: dbgmon.asm std.asm ver.inc build.inc - -syscfg.bin: syscfg.asm std.asm build.inc ver.inc - -os.bin: $(CPBIN) $(DOSBIN) cbios.bin -ifndef "windir" - copy /B $(subst $(SPACE),+,$(^)) "$@" -else - cat $(CPBIN) $(DOSBIN) cbios.bin >>$@ -endif - -rom0.bin: pgzero.bin bootrom.bin syscfg.bin loader.bin romfill.bin dbgmon.bin os.bin hbfill.bin -ifndef "windir" - copy /B $(subst $(SPACE),+,$(^)) "$@" -else - cat pgzero.bin bootrom.bin syscfg.bin loader.bin romfill.bin dbgmon.bin os.bin hbfill.bin >>$@ -endif - -rom1.bin: pgzero.bin bootrom.bin syscfg.bin loader.bin hbios.bin -ifndef "windir" - copy /B $(subst $(SPACE),+,$(^)) "$@" -else - cat pgzero.bin bootrom.bin syscfg.bin loader.bin hbios.bin >>$@ -endif - -$(OUTDIR)/$(ROMNAME).rom: rom0.bin rom1.bin $(ROMDISKFILES) $(OUTDIR)/$(ROMNAME).sys -ifndef "windir" - copy blank$(ROMSIZE)KB.dat RomDisk.tmp - $(CPMCP) -f rom$(ROMSIZE)KB RomDisk.tmp $(ROMDSKFILES) 0: - $(CPMCP) -f rom$(ROMSIZE)KB RomDisk.tmp ../Output/$(ROMNAME).sys 0:$(SYS).sys - copy /B rom0.bin+rom1.bin+RomDisk.tmp "$@" -else - cp blank$(ROMSIZE)KB.dat RomDisk.tmp - $(CPMCP) -f rom$(ROMSIZE)KB RomDisk.tmp $(ROMDSKFILES) 0: - $(CPMCP) -f rom$(ROMSIZE)KB RomDisk.tmp ../Output/$(ROMNAME).sys 0:$(SYS).sys - cat rom0.bin rom1.bin RomDisk.tmp >>$@ -endif - -$(OUTDIR)/$(ROMNAME).com: bootapp.bin syscfg.bin loader.bin hbios.bin dbgmon.bin os.bin -ifndef "windir" - copy /B $(subst $(SPACE),+,$(^)) "$@" -else - cat bootapp.bin syscfg.bin loader.bin hbios.bin dbgmon.bin os.bin >>$@ -endif - -$(OUTDIR)/$(ROMNAME).sys: prefix.bin os.bin -ifndef "windir" - copy /B $(subst $(SPACE),+,$(^)) "$@" -else - cat prefix.bin os.bin >>$@ -endif - -clean: -ifndef "windir" - if exist *.bin del *.bin - if exist *.com del *.com - if exist *.img del *.img - if exist *.rom del *.rom - if exist *.lst del *.lst - if exist *.exp del *.exp - if exist *.tmp del *.tmp - if exist build.inc del build.inc - if exist "$(OUTDIR)/*.*" erase /Q "$(OUTDIR)/*.*" -else - rm -f *.bin *.com *.img *.rom *.lst *.exp *.tmp - rm -f build.inc - rm -f $(OUTDIR)/*.* -endif \ No newline at end of file diff --git a/Source/HBIOS/Old/memmgr.asm b/Source/HBIOS/Old/memmgr.asm deleted file mode 100644 index a45e54f0..00000000 --- a/Source/HBIOS/Old/memmgr.asm +++ /dev/null @@ -1,78 +0,0 @@ -;================================================================================================== -; MEMORY BANK MANAGEMENT -;================================================================================================== -; -; SELECT THE REQUESTED 32K BANK OF RAM/ROM INTO THE LOWER 32K OF CPU ADDRESS SPACE. -; BANK INDEX IN A, BIT 7 IS SET TO TO SELECT RAM, OTHERWISE ROM -; MUST BE INVOKED FROM HIGH 32K AND STACK MUST BE IN HIGH 32K -;______________________________________________________________________________________________________________________ -; - -#IF ((PLATFORM == PLT_SBC) | (PLATFORM == PLT_ZETA)) -BNKSEL: - OUT (MPCL_ROM),A ; SET ROM PAGE SELECTOR - OUT (MPCL_RAM),A ; SET RAM PAGE SELECTOR - RET -#ENDIF - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -; ZETA SBC V2 USES 16K PAGES. ANY PAGE CAN BE MAPPED TO ONE OF FOUR BANKS: -; BANK_0: 0K - 16K; BANK_1: 16K - 32K; BANK_2: 32K - 48K; BANK_3: 48K - 64K -; THIS BNKSEL EMULATES SBC / ZETA BEHAVIOR BY SETTING BANK_0 and BANK_1 TO -; TWO CONSECUTIVE PAGES - -#IF (PLATFORM == PLT_ZETA2) -BNKSEL: - BIT 7,A ; BIT 7 SET REQUESTS RAM PAGE - JR Z,BNKSEL_ROM ; NOT SET, SELECT ROM PAGE - RES 7,A ; RAM PAGE REQUESTED: CLEAR ROM BIT - ADD A,16 ; ADD 16 x 32K - RAM STARTS FROM 512K -; -BNKSEL_ROM: - RLCA ; TIMES 2 - GET 16K PAGE INSTEAD OF 32K - OUT (MPGSEL_0),A ; BANK_0: 0K - 16K - INC A ; - OUT (MPGSEL_1),A ; BANK_1: 16K - 32K - RET -#ENDIF - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -#IF (PLATFORM == PLT_N8) -BNKSEL: - BIT 7,A ; TEST BIT 7 FOR RAM VS. ROM - JR Z,BNKSEL_ROM ; IF NOT SET, SELECT ROM PAGE -; -BNKSEL_RAM: ; SELECT RAM PAGE - RES 7,A ; CLEAR BIT 7 FROM ABOVE - RLCA ; SCALE SELECTOR TO - RLCA ; ... GO FROM Z180 4K PAGE SIZE - RLCA ; ... TO DESIRED 32K PAGE SIZE - OUT0 (Z180_BBR),A ; WRITE TO BANK BASE - LD A,N8_DEFACR | 80H ; SELECT RAM BY SETTING BIT 7 - OUT0 (N8_ACR),A ; ... IN N8 ACR REGISTER - RET ; DONE -; -BNKSEL_ROM: ; SELECT ROM PAGE - OUT0 (N8_RMAP),A ; BANK INDEX TO N8 RMAP REGISTER - XOR A ; ZERO ACCUM - OUT0 (Z180_BBR),A ; ZERO BANK BASE - LD A,N8_DEFACR ; SELECT ROM BY CLEARING BIT 7 - OUT0 (N8_ACR),A ; ... IN N8 ACR REGISTER - RET ; DONE -; -#ENDIF - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -#IF (PLATFORM == PLT_MK4) -BNKSEL: - RLCA ; RAM FLAG TO CARRY FLAG AND BIT 0 - JR NC,BNKSEL_ROM ; IF NC, WANT ROM PAGE, SKIP AHEAD - XOR %00100001 ; SET BIT FOR HI 512K, CLR BIT 0 -BNKSEL_ROM: - RLCA ; CONTINUE SHIFTING TO SCALE SELECTOR - RLCA ; FOR Z180 4K PAGE -> DESIRED 32K PAGE - OUT0 (Z180_BBR),A ; WRITE TO BANK BASE - RET ; DONE -#ENDIF diff --git a/Source/HBIOS/Old/osldr.asm b/Source/HBIOS/Old/osldr.asm deleted file mode 100644 index 409c912c..00000000 --- a/Source/HBIOS/Old/osldr.asm +++ /dev/null @@ -1,121 +0,0 @@ -;___BOOTAPP____________________________________________________________________________________________________________ -; -; APPLICATION BOOT MANAGER -; -; USED TO LOAD AN APPLICATION IMAGE BASED COPY OF THE SYSTEM -; REFER TO BANKEDBIOS.TXT FOR MORE INFORMATION. -;______________________________________________________________________________________________________________________ -; -; MEMORY MAP -; -; LOC LEN DESC -; ----- ----- -------------- -; $0000 $1000 BOOTAPP CODE -; $1000 $1000 DBGMON IMAGE -; $2000 $3000 CPM IMAGE -; $5000 $3000 ZSYS IMAGE -; $8000 *** END *** -; -#INCLUDE "std.asm" -; - .ORG $100 -; - DI ; NO INTERRUPTS - IM 1 ; INTERRUPT MODE 1 - LD SP,STACK ; PRIVATE STACK -; - ; BANNER - CALL NEWLINE - LD DE,STR_BANNER - CALL WRITESTR -; -MENU: - CALL NEWLINE - CALL NEWLINE - LD DE,STR_BOOTMENU - CALL WRITESTR - CALL CINUC - CP 'M' ; MONITOR - JP Z,GOMON - CP 'C' ; CP/M BOOT FROM ROM - JP Z,GOCPM - CP 'Z' ; ZSYSTEM BOOT FROM ROM - JP Z,GOZSYS -; - LD DE,STR_INVALID - CALL WRITESTR - JR MENU -; -GOMON: - LD DE,STR_BOOTMON - CALL WRITESTR - LD HL,$1000 - LD DE,$C000 - LD BC,$1000 - LDIR - JP MON_SERIAL -; -GOCPM: - LD DE,STR_BOOTCPM - CALL WRITESTR - LD HL,$2000 - LD DE,CPM_LOC - LD BC,$3000 - $400 - LDIR -#IF (PLATFORM == PLT_UNA) - LD DE,$0100 ; BOOT DEV/UNIT/LU=0 (ROM DRIVE) -#ELSE - LD DE,$0000 ; BOOT DEV/UNIT/LU=0 (ROM DRIVE) -#ENDIF - JP CPM_ENT -; -GOZSYS: - LD DE,STR_BOOTZSYS - CALL WRITESTR - LD HL,$5000 - LD DE,CPM_LOC - LD BC,$3000 - $400 - LDIR -#IF (PLATFORM == PLT_UNA) - LD DE,$0100 ; BOOT DEV/UNIT/LU=0 (ROM DRIVE) -#ELSE - LD DE,$0000 ; BOOT DEV/UNIT/LU=0 (ROM DRIVE) -#ENDIF - JP CPM_ENT -; -; READ A CONSOLE CHARACTER AND CONVERT TO UPPER CASE -; -CINUC: - CALL CIN - AND 7FH ; STRIP HI BIT - CP 'A' ; KEEP NUMBERS, CONTROLS - RET C ; AND UPPER CASE - CP 7BH ; SEE IF NOT LOWER CASE - RET NC - AND 5FH ; MAKE UPPER CASE - RET -; -#DEFINE CIOMODE_HBIOS -#INCLUDE "util.asm" -; -; STRINGS -;_____________________________________________________________________________________________________________________________ -; -STR_BOOTMON .DB "START MONITOR\r\n$" -STR_BOOTCPM .DB "BOOT CPM FROM ROM\r\n$" -STR_BOOTZSYS .DB "BOOT ZSYSTEM FROM ROM\r\n$" -STR_INVALID .DB "INVALID SELECTION\r\n$" -; -STR_BANNER .DB "\r\n", PLATFORM_NAME, " Boot Loader$" -STR_BOOTMENU .DB "\r\nBoot: (C)PM, (Z)System, (M)onitor,\r\n" - .DB " (L)ist devices, or Device ID ===> $" -; -;______________________________________________________________________________________________________________________ -; -; PAD OUT REMAINDER -; - .FILL $1000 - $,$FF ; PAD OUT REMAINDER -; -STACK .EQU $ ; STACK IN SLACK SPACE -; - .END diff --git a/Source/HBIOS/Old/pgzero.asm b/Source/HBIOS/Old/pgzero.asm deleted file mode 100644 index ccdbfd17..00000000 --- a/Source/HBIOS/Old/pgzero.asm +++ /dev/null @@ -1,47 +0,0 @@ -;___PGZERO_____________________________________________________________________________________________________________ -; -#INCLUDE "std.asm" -; - - .ORG 0000H -; -; NORMAL PAGE ZERO SETUP, RET/RETI/RETN AS APPROPRIATE -; - .FILL (000H - $),0FFH ; RST 0 - JP 0100H ; JUMP TO BOOT CODE - .FILL (004H - $),0FFH ; FILL TO START OF SIG PTR - .DW ROM_SIG - .FILL (008H - $),0FFH ; RST 8 - RET - .FILL (010H - $),0FFH ; RST 10 - RET - .FILL (018H - $),0FFH ; RST 18 - RET - .FILL (020H - $),0FFH ; RST 20 - RET - .FILL (028H - $),0FFH ; RST 28 - RET - .FILL (030H - $),0FFH ; RST 30 - RET - .FILL (038H - $),0FFH ; INT - RETI - .FILL (066H - $),0FFH ; NMI - RETN -; - .FILL (070H - $),0FFH ; SIG STARTS AT $80 -; -ROM_SIG: - .DB $76, $B5 ; 2 SIGNATURE BYTES - .DB 1 ; STRUCTURE VERSION NUMBER - .DB 7 ; ROM SIZE (IN MULTIPLES OF 4KB, MINUS ONE) - .DW NAME ; POINTER TO HUMAN-READABLE ROM NAME - .DW AUTH ; POINTER TO AUTHOR INITIALS - .DW DESC ; POINTER TO LONGER DESCRIPTION OF ROM - .DB 0, 0, 0, 0, 0, 0 ; RESERVED FOR FUTURE USE; MUST BE ZERO -; -NAME .DB "ROMWBW v", BIOSVER, ", ", BIOSBLD, ", ", TIMESTAMP, 0 -AUTH .DB "WBW",0 -DESC .DB "ROMWBW v", BIOSVER, ", Copyright 2014, Wayne Warthen, GNU GPL v3", 0 - .FILL (100H - $),0FFH -; - .END diff --git a/Source/HBIOS/Old/rom0.asm b/Source/HBIOS/Old/rom0.asm deleted file mode 100644 index 42ad0084..00000000 --- a/Source/HBIOS/Old/rom0.asm +++ /dev/null @@ -1,112 +0,0 @@ -;___ROM0_______________________________________________________________________________________________________________ -; -; HARDWARE BOOTSTRAP -; -; TEMPORARY HARDWARE BOOTSTRAP TO USE UNTIL JOHN COFFMAN'S -; VERSION IS READY. -;______________________________________________________________________________________________________________________ -; -; -#INCLUDE "std.asm" -; - .ORG $0000 -; - DI ; NO INTERRUPTS - IM 1 ; INTERRUPT MODE 1 - LD SP,$HBX_LOC ; START WITH SP BELOW HBIOS PROXY LOCATION -; -#IF ((PLATFORM == PLT_N8) | (PLATFORM == PLT_MK4)) - ; SET BASE FOR CPU IO REGISTERS - LD A,CPU_BASE - OUT0 (CPU_ICR),A - - ; SET DEFAULT CPU CLOCK MULTIPLIERS (XTAL / 2) - XOR A - OUT0 (CPU_CCR),A - OUT0 (CPU_CMR),A - - ; SET DEFAULT WAIT STATES - LD A,$F0 - OUT0 (CPU_DCNTL),A - -#IF (Z180_CLKDIV >= 1) - ; SET CLOCK DIVIDE TO 1 RESULTING IN FULL XTAL SPEED - LD A,$80 - OUT0 (CPU_CCR),A -#ENDIF - -#IF (Z180_CLKDIV >= 2) - ; SET CPU MULTIPLIER TO 1 RESULTINT IN XTAL * 2 SPEED - LD A,$80 - OUT0 (CPU_CMR),A -#ENDIF - ; SET DESIRED WAIT STATES - LD A,0 + (Z180_MEMWAIT << 6) | (Z180_IOWAIT << 4) - OUT0 (CPU_DCNTL),A - - ; MMU SETUP - LD A,$80 - OUT0 (CPU_CBAR),A ; SETUP FOR 32K/32K BANK CONFIG - XOR A - OUT0 (CPU_BBR),A ; BANK BASE = 0 - LD A,(RAMSIZE + RAMBIAS - 64) >> 2 - OUT0 (CPU_CBR),A ; COMMON BASE = LAST (TOP) BANK -#ENDIF -; -; EMIT FIRST SIGN OF LIFE TO SERIAL PORT -; - CALL XIO_INIT ; INIT SERIAL PORT - LD HL,STR_BOOT ; POINT TO MESSAGE - CALL XIO_OUTS ; SAY HELLO -; -; COPY OURSELF TO HIRAM -; -; NOTE: STACK IS WIPED OUT, STACK IS ASSUMED TO BE EMPTY HERE!!!! -; - LD HL,$0000 ; COPY MEMORY FROM LOMEM (0000H) - LD DE,$8000 ; TO HIMEM (8000H) - LD BC,COD_SIZ ; COPY CODE - LDIR -; - CALL XIO_DOT ; MARK PROGRESS -; - JP PHASE2 ; JUMP TO PHASE 2 IN UPPER MEMORY -; -STR_BOOT .DB PLATFORM_NAME, '$' -; -; IMBED DIRECT SERIAL I/O ROUTINES -; -#INCLUDE "xio.asm" -; -;______________________________________________________________________________________________________________________ -; -; THIS IS THE PHASE 2 CODE THAT MUST EXECUTE IN UPPER MEMORY -; - .ORG $ + $8000 ; WE ARE NOW EXECUTING IN UPPER MEMORY -; -PHASE2: - CALL XIO_DOT ; MARK PROGRESS - CALL XIO_CRLF ; FINISH LINE - CALL XIO_CRLF ; A BLANK LINE FOR SPACING -; -; SWAP LOMEM TO BANK 1 AND CHAIN TO $0000 -; -; LD A,1 ; SPECIFY PAGE 1 -; CALL ROMPG ; PUT ROM PAGE 1 IN LOW RAM - LD A,BID_COMIMG ; CHAIN TO COMMON IMAGE IN ROM - CALL PGSEL ; SELECT THE PAGE - JP $0000 ; CHAIN EXECUTION TO IT -;______________________________________________________________________________________________________________________ -; -; NOTE THAT MEMORY MANAGER CODE IS IN UPPER MEMORY! -; -#INCLUDE "memmgr.asm" -;______________________________________________________________________________________________________________________ -; -; PAD OUT REMAINDER OF PAGE -; - .ORG $ - $8000 ; ORG BACK TO LOWER MEMORY -COD_SIZ .EQU $ ; SIZE OF CODE - .FILL $8000 - $,$FF ; PAD OUT REMAINDER OF ROM SPACE -; - .END diff --git a/Source/HBIOS/Old/romfill.asm b/Source/HBIOS/Old/romfill.asm deleted file mode 100644 index e52d3bbf..00000000 --- a/Source/HBIOS/Old/romfill.asm +++ /dev/null @@ -1,8 +0,0 @@ -; -;================================================================================================== -; FILLER FOR ROM PAGE 0 (SEE BANKEDBIOS.TXT) -;================================================================================================== -; - .FILL 3000H -; - .END diff --git a/Source/HBIOS/Old/setup.asm b/Source/HBIOS/Old/setup.asm deleted file mode 100644 index 5ba82379..00000000 --- a/Source/HBIOS/Old/setup.asm +++ /dev/null @@ -1,57 +0,0 @@ -; -;================================================================================================== -; SETUP -;================================================================================================== -; -#INCLUDE "std.asm" -#INCLUDE "hbios.exp" -; - .ORG 0 -; -;================================================================================================== -; NORMAL PAGE ZERO SETUP, RET/RETI/RETN AS APPROPRIATE -;================================================================================================== -; - .FILL (000H - $),0FFH ; RST 0 - JP START ; JUMP TO BOOT CODE - .FILL (004H - $),0FFH ; FILL TO START OF SIG PTR - .DW ROM_SIG - .FILL (008H - $),0FFH ; RST 8 - RET - .FILL (010H - $),0FFH ; RST 10 - RET - .FILL (018H - $),0FFH ; RST 18 - RET - .FILL (020H - $),0FFH ; RST 20 - RET - .FILL (028H - $),0FFH ; RST 28 - RET - .FILL (030H - $),0FFH ; RST 30 - RET - .FILL (038H - $),0FFH ; INT - RETI - .FILL (066H - $),0FFH ; NMI - RETN -; - .FILL (070H - $),0FFH ; SIG STARTS AT $80 -; -ROM_SIG: - .DB $76, $B5 ; 2 SIGNATURE BYTES - .DB 1 ; STRUCTURE VERSION NUMBER - .DB 7 ; ROM SIZE (IN MULTIPLES OF 4KB, MINUS ONE) - .DW NAME ; POINTER TO HUMAN-READABLE ROM NAME - .DW AUTH ; POINTER TO AUTHOR INITIALS - .DW DESC ; POINTER TO LONGER DESCRIPTION OF ROM - .DB 0, 0, 0, 0, 0, 0 ; RESERVED FOR FUTURE USE; MUST BE ZERO -; -NAME .DB "ROMWBW v", BIOSVER, ", ", TIMESTAMP, 0 -AUTH .DB "WBW",0 -DESC .DB "ROMWBW v", BIOSVER, ", Copyright 2014, Wayne Warthen, GNU GPL v3", 0 -; - .FILL ($100 - $),$FF ; PAD REMAINDER OF PAGE ZERO -; -#define ROMLOAD -#INCLUDE "loader.asm" -; - .FILL $8000 - $,$FF - .END diff --git a/Source/HBIOS/Old/syscfg.asm b/Source/HBIOS/Old/syscfg.asm deleted file mode 100644 index 03a10e9c..00000000 --- a/Source/HBIOS/Old/syscfg.asm +++ /dev/null @@ -1,190 +0,0 @@ -;___SYSCFG_____________________________________________________________________________________________________________ -; -; syscfg.asm 3/04/2012 2.0.0.0 dwg - added required configuration information -; -; INCLUDE STANDARD BIOS DEFINITIONS -; -#INCLUDE "std.asm" -; -#IF (PLATFORM != PLT_UNA) -; - .ORG 0 ; ALL ADDRESSES GENERATED WILL BE ZERO BASED -; - .DW $A33A ; MARKER TO VERIFY START OF CONFIG DATA -; -; Reserved for Configuration Information -; - .DW SC_CONFIG ; OFFSET OF CONFIG DATA - .DW SC_TIMESTAMP ; OFFSET OF TIMESTAMP STRING - .DW SC_BUILD ; OFFSET OF VARIANT STRING -; -; BIOS configuration data -; -SC_CONFIG: -; -; BIOS REVISION -; - .DB RMJ, RMN ; MAJOR, MINOR - .DB RUP, RTP ; UPDATE, PATCH - .DW REVISION ; SVN REVISION -; -; LOADER DATA -; -; THIS AREA IS FOR NOTES LEFT BY THE LOADER FROM WHEN THE CCP/BDOS/BIOS WERE -; PLACED IN MEMORY AND KICKED OFF, THIS ALLOWS LOGGING ONTO THE BOOT DRIVE ON STARTUP -; -DISKBOOT .DB FALSE ; FALSE IF ROM BOOT, OTHERWISE TRUE -BOOTDEVICE .DB 0 ; IF NOT ROM BOOT, HAS DEV/UNIT OF BOOT DEVICE -BOOTLU .DW 0 ; LOGICAL UNIT ON DEV/UNIT FOR BOOT -BOOTTIME .DB 0,0,0,0,0,0 ; SYSTEM STARTUP TIME (YY,MM,DD,HH,MM,SS) -; -; BUILD CONFIGURATION OPTIONS -; - .DB PLATFORM - .DB CPUFREQ - .DW RAMSIZE - .DW ROMSIZE - -#IF (PLATFORM == PLT_N8) - .DB Z180_CLKDIV - .DB Z180_MEMWAIT - .DB Z180_IOWAIT - .DB Z180_CNTLB0 - .DB Z180_CNTLB1 -#ELSE - .FILL 5,$FF -#ENDIF - - .DB BOOTTYPE - .DB BOOT_TIMEOUT - .DB BOOT_DEFAULT - - .DB DEFCON - .DB ALTCON - .DW CONBAUD / 10 - .DB DEFVDA - .DB DEFEMU - .DB TERMTYPE - - .DB DEFIOBYTE - .DB ALTIOBYTE - .DB WRTCACHE - .DB DSKTRACE - .DB 0 ; DSKMAP - .DB CLRRAMDISK - - .DB DSKYENABLE - - .DB UARTENABLE - .DB UARTCNT -#IF (UARTENABLE & (UARTCNT >= 1)) - .DB UART0IOB - .DW UART0BAUD / 10 - .DB UART0FIFO - .DB UART0AFC -#ELSE - .FILL 5,$FF -#ENDIF -#IF (UARTENABLE & (UARTCNT >= 2)) - .DB UART1IOB - .DW UART1BAUD / 10 - .DB UART1FIFO - .DB UART1AFC -#ELSE - .FILL 5,$FF -#ENDIF -#IF (UARTENABLE & (UARTCNT >= 3)) - .DB UART2IOB - .DW UART2BAUD / 10 - .DB UART2FIFO - .DB UART2AFC -#ELSE - .FILL 5,$FF -#ENDIF -#IF (UARTENABLE & (UARTCNT >= 4)) - .DB UART3IOB - .DW UART3BAUD / 10 - .DB UART3FIFO - .DB UART3AFC -#ELSE - .FILL 5,$FF -#ENDIF - - .DB ASCIENABLE - .DW ASCI0BAUD / 10 - .DW ASCI1BAUD / 10 - - .DB VDUENABLE - - .DB CVDUENABLE - - .DB UPD7220ENABLE - - .DB N8VENABLE - - .DB FDENABLE - .DB FDMODE - .DB FDTRACE - .DB FDMEDIA - .DB FDMEDIAALT - .DB FDMAUTO - - .DB IDEENABLE - .DB IDEMODE - .DB IDETRACE - .DB IDE8BIT - .DW IDECAPACITY - - .DB PPIDEENABLE - .DB PPIDEIOB - .DB PPIDETRACE - .DB PPIDE8BIT - .DW PPIDECAPACITY - .DB PPIDESLOW - - .DB SDENABLE - .DB SDMODE - .DB SDTRACE - .DW SDCAPACITY - .DB SDCSIOFAST - - .DB PRPENABLE - .DB PRPSDENABLE - .DB PRPSDTRACE - .DW PRPSDCAPACITY - .DB PRPCONENABLE - - .DB PPPENABLE - .DB PPPSDENABLE - .DB PPPSDTRACE - .DW PPPSDCAPACITY - .DB PPPCONENABLE - - .DB HDSKENABLE - .DB HDSKTRACE - .DW HDSKCAPACITY - - .DB PPKENABLE - .DB PPKTRACE - - .DB KBDENABLE - .DB KBDTRACE - - .DB TTYENABLE - - .DB ANSIENABLE - .DB ANSITRACE - -; -; BUILD INFORMATION STRINGS -; -SC_TIMESTAMP .DB TIMESTAMP, "$" -SC_BUILD .DB BIOSBLD, "$" -; -; .EXPORT DISKBOOT,BOOTDEVICE,BOOTLU -; -#ENDIF -; - .FILL $200-$,$FF -; - .END diff --git a/Source/HBIOS/Old/ubios.asm b/Source/HBIOS/Old/ubios.asm deleted file mode 100644 index 02b04b88..00000000 --- a/Source/HBIOS/Old/ubios.asm +++ /dev/null @@ -1,15 +0,0 @@ -; -;================================================================================================== -; UBIOS - JUST FILLER TO REPLACE THE SPACE HBIOS WOULD NORMALLY USE -;================================================================================================== -; - .ORG $1000 -; -; INCLUDE GENERIC STUFF -; -#INCLUDE "std.asm" -; - .FILL (HBX_LOC - $8000 - $),$FF - .ORG HBX_LOC - .FILL HBX_END - $,$FF - .END diff --git a/Source/HBIOS/Config/plt_mk4.asm b/Source/HBIOS/cfg_mk4.asm similarity index 95% rename from Source/HBIOS/Config/plt_mk4.asm rename to Source/HBIOS/cfg_mk4.asm index ce9a1a86..818c6834 100644 --- a/Source/HBIOS/Config/plt_mk4.asm +++ b/Source/HBIOS/cfg_mk4.asm @@ -1,6 +1,6 @@ ; ;================================================================================================== -; ROMWBW 2.X CONFIGURATION FOR N8 2312 +; ROMWBW 2.X CONFIGURATION FOR MARK IV ;================================================================================================== ; ; BUILD CONFIGURATION OPTIONS @@ -27,6 +27,7 @@ VDUENABLE .EQU FALSE ; TRUE FOR VDU BOARD SUPPORT CVDUENABLE .EQU FALSE ; TRUE FOR CVDU BOARD SUPPORT NECENABLE .EQU FALSE ; TRUE FOR uPD7220 BOARD SUPPORT TMSENABLE .EQU FALSE ; TRUE FOR N8 (TMS9918) VIDEO/KBD SUPPORT +VGAENABLE .EQU FALSE ; TRUE FOR VGA VIDEO/KBD SUPPORT ; MDENABLE .EQU TRUE ; TRUE FOR ROM/RAM DISK SUPPORT (ALMOST ALWAYS WANT THIS ENABLED) MDTRACE .EQU 1 ; 0=SILENT, 1=ERRORS, 2=EVERYTHING (ONLY RELEVANT IF MDENABLE = TRUE) @@ -87,7 +88,7 @@ BOOT_DEFAULT .EQU 'Z' ; SELECTION TO INVOKE AT TIMEOUT ; Z180_CLKDIV .EQU 1 ; 0=OSC/2, 1=OSC, 2=OSC*2 Z180_MEMWAIT .EQU 0 ; MEMORY WAIT STATES TO INSERT (0-3) -Z180_IOWAIT .EQU 0 ; IO WAIT STATES TO INSERT (0-3) +Z180_IOWAIT .EQU 1 ; IO WAIT STATES TO INSERT (0-3) ; ; 18.432MHz OSC @ DOUBLE SPEED ; diff --git a/Source/HBIOS/Config/plt_n8.asm b/Source/HBIOS/cfg_n8.asm similarity index 94% rename from Source/HBIOS/Config/plt_n8.asm rename to Source/HBIOS/cfg_n8.asm index 6909c89f..2c956182 100644 --- a/Source/HBIOS/Config/plt_n8.asm +++ b/Source/HBIOS/cfg_n8.asm @@ -1,6 +1,6 @@ ; ;================================================================================================== -; ROMWBW 2.X CONFIGURATION FOR N8 2511 +; ROMWBW 2.X CONFIGURATION FOR N8 ;================================================================================================== ; ; BUILD CONFIGURATION OPTIONS @@ -27,6 +27,7 @@ VDUENABLE .EQU FALSE ; TRUE FOR VDU BOARD SUPPORT CVDUENABLE .EQU FALSE ; TRUE FOR CVDU BOARD SUPPORT NECENABLE .EQU FALSE ; TRUE FOR uPD7220 BOARD SUPPORT TMSENABLE .EQU TRUE ; TRUE FOR N8 (TMS9918) VIDEO/KBD SUPPORT +VGAENABLE .EQU FALSE ; TRUE FOR VGA VIDEO/KBD SUPPORT ; MDENABLE .EQU TRUE ; TRUE FOR ROM/RAM DISK SUPPORT (ALMOST ALWAYS WANT THIS ENABLED) MDTRACE .EQU 1 ; 0=SILENT, 1=ERRORS, 2=EVERYTHING (ONLY RELEVANT IF MDENABLE = TRUE) @@ -53,7 +54,7 @@ PPIDETRACE .EQU 1 ; 0=SILENT, 1=ERRORS, 2=EVERYTHING (ONLY RELEVANT IF PPIDEENA PPIDE8BIT .EQU FALSE ; USE IDE 8BIT TRANSFERS (PROBABLY ONLY WORKS FOR CF CARDS!) ; SDENABLE .EQU TRUE ; TRUE FOR SD SUPPORT -SDMODE .EQU SDMODE_N8 ; SDMODE_JUHA, SDMODE_CSIO, SDMODE_UART, SDMODE_PPI, SDMODE_DSD +SDMODE .EQU SDMODE_CSIO ; SDMODE_JUHA, SDMODE_CSIO, SDMODE_UART, SDMODE_PPI, SDMODE_DSD SDTRACE .EQU 1 ; 0=SILENT, 1=ERRORS, 2=EVERYTHING (ONLY RELEVANT IF IDEENABLE = TRUE) SDCSIOFAST .EQU FALSE ; TABLE-DRIVEN BIT INVERTER ; diff --git a/Source/HBIOS/Config/plt_sbc.asm b/Source/HBIOS/cfg_sbc.asm similarity index 96% rename from Source/HBIOS/Config/plt_sbc.asm rename to Source/HBIOS/cfg_sbc.asm index 3907c884..3dc3e1c9 100644 --- a/Source/HBIOS/Config/plt_sbc.asm +++ b/Source/HBIOS/cfg_sbc.asm @@ -27,6 +27,7 @@ VDUENABLE .EQU FALSE ; TRUE FOR VDU BOARD SUPPORT CVDUENABLE .EQU FALSE ; TRUE FOR CVDU BOARD SUPPORT NECENABLE .EQU FALSE ; TRUE FOR uPD7220 BOARD SUPPORT TMSENABLE .EQU FALSE ; TRUE FOR N8 (TMS9918) VIDEO/KBD SUPPORT +VGAENABLE .EQU FALSE ; TRUE FOR VGA VIDEO/KBD SUPPORT ; MDENABLE .EQU TRUE ; TRUE FOR ROM/RAM DISK SUPPORT (ALMOST ALWAYS WANT THIS ENABLED) MDTRACE .EQU 1 ; 0=SILENT, 1=ERRORS, 2=EVERYTHING (ONLY RELEVANT IF MDENABLE = TRUE) diff --git a/Source/HBIOS/Config/plt_una.asm b/Source/HBIOS/cfg_una.asm similarity index 100% rename from Source/HBIOS/Config/plt_una.asm rename to Source/HBIOS/cfg_una.asm diff --git a/Source/HBIOS/Config/plt_zeta.asm b/Source/HBIOS/cfg_zeta.asm similarity index 96% rename from Source/HBIOS/Config/plt_zeta.asm rename to Source/HBIOS/cfg_zeta.asm index fd05eebd..c83ade49 100644 --- a/Source/HBIOS/Config/plt_zeta.asm +++ b/Source/HBIOS/cfg_zeta.asm @@ -27,6 +27,7 @@ VDUENABLE .EQU FALSE ; TRUE FOR VDU BOARD SUPPORT CVDUENABLE .EQU FALSE ; TRUE FOR CVDU BOARD SUPPORT NECENABLE .EQU FALSE ; TRUE FOR uPD7220 BOARD SUPPORT TMSENABLE .EQU FALSE ; TRUE FOR N8 (TMS9918) VIDEO/KBD SUPPORT +VGAENABLE .EQU FALSE ; TRUE FOR VGA VIDEO/KBD SUPPORT ; MDENABLE .EQU TRUE ; TRUE FOR ROM/RAM DISK SUPPORT (ALMOST ALWAYS WANT THIS ENABLED) MDTRACE .EQU 1 ; 0=SILENT, 1=ERRORS, 2=EVERYTHING (ONLY RELEVANT IF MDENABLE = TRUE) diff --git a/Source/HBIOS/Config/plt_zeta2.asm b/Source/HBIOS/cfg_zeta2.asm similarity index 86% rename from Source/HBIOS/Config/plt_zeta2.asm rename to Source/HBIOS/cfg_zeta2.asm index 30ac5d45..f0bda1ee 100644 --- a/Source/HBIOS/Config/plt_zeta2.asm +++ b/Source/HBIOS/cfg_zeta2.asm @@ -5,7 +5,7 @@ ; ; BUILD CONFIGURATION OPTIONS ; -#INCLUDE "Config/plt_zeta.asm" ; USE ZETA CONFIG TO START +#INCLUDE "cfg_zeta.asm" ; USE ZETA CONFIG TO START ; INTTYPE .SET IT_CTC ; INTERRUPT HANDLING TYPE (IT_NONE, IT_SIMH, IT_Z180, IT_CTC, ...) ; diff --git a/Source/HBIOS/cvdu.asm b/Source/HBIOS/cvdu.asm index ed5ef75e..bc6eafa7 100644 --- a/Source/HBIOS/cvdu.asm +++ b/Source/HBIOS/cvdu.asm @@ -15,9 +15,13 @@ ; CVDU DRIVER - CONSTANTS ;====================================================================== ; -CVDU_STAT .EQU $E4 ; READ M8563 STATUS -CVDU_REG .EQU $E4 ; SELECT M8563 REGISTER -CVDU_DATA .EQU $EC ; READ/WRITE M8563 DATA +CVDU_BASE .EQU $E0 +; +CVDU_KBDDATA .EQU CVDU_BASE + $02 ; KBD CTLR DATA PORT +CVDU_KBDST .EQU CVDU_BASE + $0A ; KBD CTLR STATUS/CMD PORT +CVDU_STAT .EQU CVDU_BASE + $04 ; READ M8563 STATUS +CVDU_REG .EQU CVDU_BASE + $04 ; SELECT M8563 REGISTER +CVDU_DATA .EQU CVDU_BASE + $0C ; READ/WRITE M8563 DATA ; CVDU_ROWS .EQU 25 CVDU_COLS .EQU 80 @@ -29,11 +33,21 @@ TERMENABLE .SET TRUE ; INCLUDE TERMINAL PSEUDODEVICE DRIVER ;====================================================================== ; CVDU_INIT: + LD IY,CVDU_IDAT ; POINTER TO INSTANCE DATA + CALL NEWLINE ; FORMATTING PRTS("CVDU: IO=0x$") LD A,CVDU_STAT CALL PRTHEXBYTE + CALL CVDU_PROBE ; CHECK FOR HW PRESENCE + JR Z,CVDU_INIT1 ; CONTINUE IF HW PRESENT ; + ; HARDWARE NOT PRESENT + PRTS(" NOT PRESENT$") + OR $FF ; SIGNAL FAILURE + RET +; +CVDU_INIT1: PRTS(" VDURAM=$") CALL CVDU_CRTINIT ; SETUP THE CVDU CHIP REGISTERS CALL PRTDEC @@ -43,14 +57,14 @@ CVDU_INIT: CALL KBD_INIT ; INITIALIZE KEYBOARD DRIVER ; ADD OURSELVES TO VDA DISPATCH TABLE - LD B,0 ; PHYSICAL UNIT IS ZERO - LD C,VDADEV_CVDU ; DEVICE TYPE - LD DE,0 ; UNIT DATA BLOB ADDRESS + LD BC,CVDU_DISPATCH ; BC := DISPATCH ADDRESS + LD DE,CVDU_IDAT ; DE := VGA INSTANCE DATA PTR CALL VDA_ADDENT ; ADD ENTRY, A := UNIT ASSIGNED ; INITIALIZE EMULATION LD C,A ; C := ASSIGNED VIDEO DEVICE NUM LD DE,CVDU_DISPATCH ; DE := DISPATCH ADDRESS + LD HL,CVDU_IDAT ; HL := CVDU INSTANCE DATA PTR CALL TERM_ATTACH ; DO IT XOR A ; SIGNAL SUCCESS @@ -266,6 +280,37 @@ CVDU_RDX: RET ; ;---------------------------------------------------------------------- +; PROBE FOR CVDU HARDWARE +;---------------------------------------------------------------------- +; +; ON RETURN, ZF SET INDICATES HARDWARE FOUND +; +CVDU_PROBE: + ; WRITE TEST PATTERN $A5 $5A TO START OF VRAM + LD HL,0 ; POINT TO FIRST BYTE OF VRAM + LD C,18 ; ADDRESS REGISTER PAIR + CALL CVDU_WRX ; UPDATE VRAM ADDRESS POINTER + LD A,$A5 ; INITIAL TEST VALUE + LD B,A ; SAVE IN B + LD C,31 ; DATA REGISTER + CALL CVDU_WR ; WRITE VALUE TO LOC 0, ADR PTR INCREMENTS + CPL ; INVERT TEST VALUE + CALL CVDU_WR ; WRITE INVERTED VALUE TO LOC 1 + + ; READ TEST PATTERN BACK TO CONFIRM HARDWARE EXISTS + LD HL,0 ; POINT TO FIRST BYTE OF VRAM + LD C,18 ; ADDRESS REGISTER PAIR + CALL CVDU_WRX ; UPDATE VRAM ADDRESS POINTER + LD C,31 ; DATA REGISTER + CALL CVDU_RD ; GET BYTE AT LOC 0, ADR PTR INCREMENTS + CP B ; CHECK IT + RET NZ ; ABORT IF BAD COMPARE + CALL CVDU_RD ; GET BYTE AT LOC 1 + CPL ; INVERT IT + CP B ; CHECK FOR INVERTED TEST VALUE + RET ; RETURN WITH ZF SET BASED ON CP +; +;---------------------------------------------------------------------- ; MOS 8563 DISPLAY CONTROLLER CHIP INITIALIZATION ;---------------------------------------------------------------------- ; @@ -330,7 +375,7 @@ CVDU_LOADFONT: LD C,18 ; UPDATE ADDRESS REGISTER PAIR CALL CVDU_WRX ; DO IT - LD HL,CVDU_FONTDATA ; POINTER TO FONT DATA + LD HL,FONT_HI ; POINTER TO FONT DATA LD DE,$2000 ; LENGTH OF FONT DATA LD C,31 ; DATA REGISTER CVDU_LOADFONT1: @@ -701,55 +746,92 @@ CVDU_POS .DW 0 ; CURRENT DISPLAY POSITION ; 35 $23 DEE7 DEE6 DEE5 DEE4 DEE3 DEE2 DEE1 DEE0 Display Enable End ; 36 $24 -- -- -- -- DRR3 DRR2 DRR1 DRR0 DRAM Refresh Rate ; -; EGA 720X368 9-BIT CHARACTERS -; - requires 16.257Mhz oscillator frequency ; CVDU_INIT8563: - .DB 97 ; 0: hor. total - 1 - .DB 80 ; 1: hor. displayed - .DB 90 ; 2: hor. sync position 85 +#IF 1 +; EGA 720X368 9-BIT CHARACTERS +; - requires 16.257Mhz oscillator frequency + .DB $61 ; 0: hor. total - 1 + .DB $50 ; 1: hor. displayed + .DB $5A ; 2: hor. sync position 85 .DB $14 ; 3: vert/hor sync width or 0x4F -- MDA - .DB 26 ; 4: vert total - .DB 2 ; 5: vert total adjust - .DB 25 ; 6: vert. displayed - .DB 26 ; 7: vert. sync postition - .DB 0 ; 8: interlace mode - .DB 13 ; 9: char height - 1 - .DB (2<<5)+12 ; 10: cursor mode, start line - .DB 13 ; 11: cursor end line - .DB 0 ; 12: display start addr hi - .DB 0 ; 13: display start addr lo - .DB 7 ; 14: cursor position hi - .DB 128 ; 15: cursor position lo - .DB 1 ; 16: light pen vertical - .DB 1 ; 17: light pen horizontal - .DB 0 ; 18: update address hi - .DB 0 ; 19: update address lo - .DB 8 ; 20: attribute start addr hi - .DB 0 ; 21: attribute start addr lo + .DB $1A ; 4: vert total + .DB $02 ; 5: vert total adjust + .DB $19 ; 6: vert. displayed + .DB $1A ; 7: vert. sync postition + .DB $00 ; 8: interlace mode + .DB $0D ; 9: char height - 1 + .DB $4C ; 10: cursor mode, start line + .DB $0D ; 11: cursor end line + .DB $00 ; 12: display start addr hi + .DB $00 ; 13: display start addr lo + .DB $00 ; 14: cursor position hi + .DB $00 ; 15: cursor position lo + .DB $00 ; 16: light pen vertical + .DB $00 ; 17: light pen horizontal + .DB $00 ; 18: update address hi + .DB $00 ; 19: update address lo + .DB $08 ; 20: attribute start addr hi + .DB $00 ; 21: attribute start addr lo .DB $89 ; 22: char hor size cntrl 0x78 - .DB 13 ; 23: vert char pixel space - 1, increase to 13 with new font - .DB 0 ; 24: copy/fill, reverse, blink rate; vertical scroll + .DB $0D ; 23: vert char pixel space - 1, increase to 13 with new font + .DB $00 ; 24: copy/fill, reverse, blink rate; vertical scroll .DB $48 ; 25: gr/txt, color/mono, pxl-rpt, dbl-wide; horiz. scroll .DB $E0 ; 26: fg/bg colors (monochr) - .DB 0 ; 27: row addr display incr - .DB $20+(1<<4) ; 28: char set addr; RAM size (64/16) - .DB 13 ; 29: underline position - .DB 0 ; 30: word count - 1 - .DB 0 ; 31: data - .DB 0 ; 32: block copy src hi - .DB 0 ; 33: block copy src lo - .DB 6 ; 34: display enable begin - .DB 88 ; 35: display enable end - .DB 0 ; 36: refresh rate - -; .DB 126,80,102,73,32,224,25,29,252,231,160,231,0,0,7,128 -; .DB 18,23,15,208,8,32,120,232,32,71,240,0,47,231,79,7,15,208,125,100,245 + .DB $00 ; 27: row addr display incr + .DB $30 ; 28: char set addr; RAM size (64/16) + .DB $0D ; 29: underline position + .DB $00 ; 30: word count - 1 + .DB $00 ; 31: data + .DB $00 ; 32: block copy src hi + .DB $00 ; 33: block copy src lo + .DB $06 ; 34: display enable begin + .DB $56 ; 35: display enable end + .DB $00 ; 36: refresh rate +#ELSE + .DB $7E ; 0: hor. total - 1 + .DB $50 ; 1: hor. displayed + .DB $66 ; 2: hor. sync position 85 + .DB $49 ; 3: vert/hor sync width or 0x4F -- MDA + .DB $20 ; 4: vert total + .DB $E0 ; 5: vert total adjust + .DB $19 ; 6: vert. displayed + .DB $1D ; 7: vert. sync postition + .DB $FC ; 8: interlace mode + .DB $E7 ; 9: char height - 1 + .DB $A0 ; 10: cursor mode, start line + .DB $E7 ; 11: cursor end line + .DB $00 ; 12: display start addr hi + .DB $00 ; 13: display start addr lo + .DB $07 ; 14: cursor position hi + .DB $80 ; 15: cursor position lo + .DB $12 ; 16: light pen vertical + .DB $17 ; 17: light pen horizontal + .DB $0F ; 18: update address hi + .DB $D0 ; 19: update address lo + .DB $08 ; 20: attribute start addr hi + .DB $20 ; 21: attribute start addr lo + .DB $78 ; 22: char hor size cntrl 0x78 + .DB $E8 ; 23: vert char pixel space - 1, increase to 13 with new font + .DB $20 ; 24: copy/fill, reverse, blink rate; vertical scroll + .DB $47 ; 25: gr/txt, color/mono, pxl-rpt, dbl-wide; horiz. scroll + .DB $F0 ; 26: fg/bg colors (monochr) + .DB $00 ; 27: row addr display incr + .DB $2F ; 28: char set addr; RAM size (64/16) + .DB $E7 ; 29: underline position + .DB $4F ; 30: word count - 1 + .DB $07 ; 31: data + .DB $0F ; 32: block copy src hi + .DB $D0 ; 33: block copy src lo + .DB $7D ; 34: display enable begin + .DB $64 ; 35: display enable end + .DB $F5 ; 36: refresh rate +#ENDIF ; ;================================================================================================== -; CVDU DRIVER - FONT DATA +; CVDU DRIVER - INSTANCE DATA ;================================================================================================== ; -#INCLUDE "cvdu_font.asm" -; -#INCLUDE "kbd.asm" +CVDU_IDAT: + .DB CVDU_KBDST + .DB CVDU_KBDDATA diff --git a/Source/HBIOS/font_hi.asm b/Source/HBIOS/font_hi.asm new file mode 100644 index 00000000..d4750aae --- /dev/null +++ b/Source/HBIOS/font_hi.asm @@ -0,0 +1,257 @@ +FONT_HI: + .DB $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$7E,$81,$A5,$81,$81,$BD,$99,$81,$81,$7E,$00,$00,$00,$00 + .DB $00,$00,$7C,$FE,$FE,$D6,$FE,$FE,$BA,$C6,$FE,$7C,$00,$00,$00,$00 + .DB $00,$00,$00,$6C,$EE,$FE,$FE,$FE,$FE,$7C,$38,$10,$00,$00,$00,$00 + .DB $00,$00,$00,$10,$38,$7C,$FE,$7C,$38,$10,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$10,$38,$38,$10,$6C,$EE,$6C,$10,$38,$00,$00,$00,$00 + .DB $00,$00,$10,$38,$7C,$7C,$FE,$FE,$FE,$6C,$10,$38,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$18,$3C,$3C,$3C,$18,$00,$00,$00,$00,$00,$00 + .DB $FF,$FF,$FF,$FF,$FF,$E7,$C3,$C3,$C3,$E7,$FF,$FF,$FF,$FF,$FF,$FF + .DB $00,$00,$00,$00,$18,$3C,$66,$66,$66,$3C,$18,$00,$00,$00,$00,$00 + .DB $FF,$FF,$FF,$FF,$E7,$C3,$99,$99,$99,$C3,$E7,$FF,$FF,$FF,$FF,$FF + .DB $00,$00,$1E,$0E,$1E,$36,$78,$CC,$CC,$CC,$CC,$78,$00,$00,$00,$00 + .DB $00,$00,$3C,$66,$66,$66,$3C,$18,$7E,$18,$18,$18,$00,$00,$00,$00 + .DB $00,$00,$1E,$1A,$1E,$18,$18,$18,$18,$78,$F8,$70,$00,$00,$00,$00 + .DB $00,$00,$3E,$36,$3E,$36,$36,$76,$F6,$66,$0E,$1E,$0C,$00,$00,$00 + .DB $00,$00,$18,$DB,$7E,$3C,$66,$66,$3C,$7E,$DB,$18,$00,$00,$00,$00 + .DB $00,$00,$00,$80,$E0,$F0,$FC,$FE,$FC,$F0,$E0,$80,$00,$00,$00,$00 + .DB $00,$00,$00,$02,$0E,$3E,$7E,$FE,$7E,$3E,$0E,$02,$00,$00,$00,$00 + .DB $00,$00,$18,$3C,$7E,$18,$18,$18,$18,$7E,$3C,$18,$00,$00,$00,$00 + .DB $00,$00,$66,$66,$66,$66,$66,$66,$66,$00,$66,$66,$00,$00,$00,$00 + .DB $00,$00,$7F,$DB,$DB,$DB,$DB,$7B,$1B,$1B,$1B,$1B,$00,$00,$00,$00 + .DB $00,$00,$7C,$C6,$C6,$60,$7C,$F6,$DE,$7C,$0C,$C6,$C6,$7C,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00,$FE,$FE,$FE,$FE,$00,$00,$00,$00 + .DB $00,$00,$18,$3C,$7E,$18,$18,$18,$7E,$3C,$18,$7E,$00,$00,$00,$00 + .DB $00,$00,$18,$3C,$7E,$18,$18,$18,$18,$18,$18,$18,$00,$00,$00,$00 + .DB $00,$00,$18,$18,$18,$18,$18,$18,$18,$7E,$3C,$18,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$0C,$0E,$FF,$0E,$0C,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$30,$70,$FE,$70,$30,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$C0,$C0,$C0,$FE,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$24,$66,$FF,$66,$24,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$10,$38,$38,$38,$7C,$7C,$FE,$FE,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$FE,$FE,$7C,$7C,$7C,$38,$38,$10,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$18,$3C,$3C,$3C,$3C,$18,$18,$00,$18,$18,$00,$00,$00,$00 + .DB $00,$36,$36,$36,$36,$14,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$6C,$6C,$6C,$FE,$6C,$6C,$FE,$6C,$6C,$6C,$00,$00,$00,$00 + .DB $00,$00,$18,$18,$7C,$C6,$C0,$78,$3C,$06,$C6,$7C,$18,$18,$00,$00 + .DB $00,$00,$00,$00,$00,$62,$66,$0C,$18,$30,$66,$C6,$00,$00,$00,$00 + .DB $00,$00,$38,$6C,$38,$30,$76,$7E,$CC,$CC,$CC,$76,$00,$00,$00,$00 + .DB $00,$0C,$0C,$0C,$18,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$0C,$18,$30,$30,$30,$30,$30,$30,$18,$0C,$00,$00,$00,$00 + .DB $00,$00,$30,$18,$0C,$0C,$0C,$0C,$0C,$0C,$18,$30,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$6C,$38,$FE,$38,$6C,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$18,$18,$7E,$18,$18,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00,$00,$0C,$0C,$0C,$18,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$FE,$00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$18,$18,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$02,$06,$0C,$18,$30,$60,$C0,$80,$00,$00,$00,$00 + .DB $00,$00,$7C,$C6,$C6,$CE,$DE,$F6,$E6,$C6,$C6,$7C,$00,$00,$00,$00 + .DB $00,$00,$18,$78,$18,$18,$18,$18,$18,$18,$18,$7E,$00,$00,$00,$00 + .DB $00,$00,$7C,$C6,$C6,$06,$0C,$18,$30,$60,$C6,$FE,$00,$00,$00,$00 + .DB $00,$00,$7C,$C6,$06,$06,$3C,$06,$06,$06,$C6,$7C,$00,$00,$00,$00 + .DB $00,$00,$0C,$1C,$3C,$6C,$CC,$CC,$FE,$0C,$0C,$1E,$00,$00,$00,$00 + .DB $00,$00,$FE,$C0,$C0,$C0,$FC,$06,$06,$06,$C6,$7C,$00,$00,$00,$00 + .DB $00,$00,$7C,$C6,$C0,$C0,$FC,$C6,$C6,$C6,$C6,$7C,$00,$00,$00,$00 + .DB $00,$00,$FE,$C6,$06,$0C,$18,$30,$30,$30,$30,$30,$00,$00,$00,$00 + .DB $00,$00,$7C,$C6,$C6,$C6,$7C,$C6,$C6,$C6,$C6,$7C,$00,$00,$00,$00 + .DB $00,$00,$7C,$C6,$C6,$C6,$C6,$7E,$06,$06,$C6,$7C,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$0C,$0C,$00,$00,$0C,$0C,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$0C,$0C,$00,$00,$0C,$0C,$0C,$18,$00,$00,$00 + .DB $00,$00,$00,$0C,$18,$30,$60,$C0,$60,$30,$18,$0C,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$FE,$00,$FE,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$60,$30,$18,$0C,$06,$0C,$18,$30,$60,$00,$00,$00,$00 + .DB $00,$00,$7C,$C6,$C6,$0C,$18,$18,$18,$00,$18,$18,$00,$00,$00,$00 + .DB $00,$00,$7C,$C6,$C6,$C6,$DE,$DE,$DE,$DC,$C0,$7E,$00,$00,$00,$00 + .DB $00,$00,$38,$6C,$C6,$C6,$C6,$FE,$C6,$C6,$C6,$C6,$00,$00,$00,$00 + .DB $00,$00,$FC,$66,$66,$66,$7C,$66,$66,$66,$66,$FC,$00,$00,$00,$00 + .DB $00,$00,$3C,$66,$C2,$C0,$C0,$C0,$C0,$C2,$66,$3C,$00,$00,$00,$00 + .DB $00,$00,$F8,$6C,$66,$66,$66,$66,$66,$66,$6C,$F8,$00,$00,$00,$00 + .DB $00,$00,$FE,$66,$60,$64,$7C,$64,$60,$60,$66,$FE,$00,$00,$00,$00 + .DB $00,$00,$FE,$66,$60,$64,$7C,$64,$60,$60,$60,$F0,$00,$00,$00,$00 + .DB $00,$00,$7C,$C6,$C6,$C0,$C0,$C0,$CE,$C6,$C6,$7C,$00,$00,$00,$00 + .DB $00,$00,$C6,$C6,$C6,$C6,$FE,$C6,$C6,$C6,$C6,$C6,$00,$00,$00,$00 + .DB $00,$00,$3C,$18,$18,$18,$18,$18,$18,$18,$18,$3C,$00,$00,$00,$00 + .DB $00,$00,$3C,$18,$18,$18,$18,$18,$18,$D8,$D8,$70,$00,$00,$00,$00 + .DB $00,$00,$C6,$C6,$CC,$D8,$F0,$F0,$D8,$CC,$C6,$C6,$00,$00,$00,$00 + .DB $00,$00,$F0,$60,$60,$60,$60,$60,$60,$62,$66,$FE,$00,$00,$00,$00 + .DB $00,$00,$C6,$C6,$EE,$EE,$FE,$D6,$D6,$D6,$C6,$C6,$00,$00,$00,$00 + .DB $00,$00,$C6,$C6,$E6,$E6,$F6,$DE,$CE,$CE,$C6,$C6,$00,$00,$00,$00 + .DB $00,$00,$7C,$C6,$C6,$C6,$C6,$C6,$C6,$C6,$C6,$7C,$00,$00,$00,$00 + .DB $00,$00,$FC,$66,$66,$66,$66,$7C,$60,$60,$60,$F0,$00,$00,$00,$00 + .DB $00,$00,$7C,$C6,$C6,$C6,$C6,$C6,$C6,$D6,$D6,$7C,$06,$00,$00,$00 + .DB $00,$00,$FC,$66,$66,$66,$7C,$78,$6C,$66,$66,$E6,$00,$00,$00,$00 + .DB $00,$00,$7C,$C6,$C0,$C0,$70,$1C,$06,$06,$C6,$7C,$00,$00,$00,$00 + .DB $00,$00,$7E,$5A,$18,$18,$18,$18,$18,$18,$18,$3C,$00,$00,$00,$00 + .DB $00,$00,$C6,$C6,$C6,$C6,$C6,$C6,$C6,$C6,$C6,$7C,$00,$00,$00,$00 + .DB $00,$00,$C6,$C6,$C6,$C6,$C6,$C6,$C6,$6C,$38,$10,$00,$00,$00,$00 + .DB $00,$00,$C6,$C6,$C6,$D6,$D6,$D6,$FE,$EE,$C6,$C6,$00,$00,$00,$00 + .DB $00,$00,$C6,$C6,$C6,$6C,$38,$38,$6C,$C6,$C6,$C6,$00,$00,$00,$00 + .DB $00,$00,$66,$66,$66,$66,$66,$3C,$18,$18,$18,$3C,$00,$00,$00,$00 + .DB $00,$00,$FE,$C6,$86,$0C,$18,$30,$60,$C2,$C6,$FE,$00,$00,$00,$00 + .DB $00,$00,$7C,$60,$60,$60,$60,$60,$60,$60,$60,$7C,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$80,$C0,$60,$30,$18,$0C,$06,$02,$00,$00,$00,$00 + .DB $00,$00,$7C,$0C,$0C,$0C,$0C,$0C,$0C,$0C,$0C,$7C,$00,$00,$00,$00 + .DB $00,$10,$38,$6C,$C6,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$FF,$00,$00 + .DB $00,$18,$18,$18,$0C,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$78,$0C,$7C,$CC,$CC,$DC,$76,$00,$00,$00,$00 + .DB $00,$00,$E0,$60,$60,$7C,$66,$66,$66,$66,$66,$FC,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$7C,$C6,$C0,$C0,$C0,$C6,$7C,$00,$00,$00,$00 + .DB $00,$00,$1C,$0C,$0C,$7C,$CC,$CC,$CC,$CC,$CC,$7E,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$7C,$C6,$C6,$FE,$C0,$C6,$7C,$00,$00,$00,$00 + .DB $00,$00,$1C,$36,$30,$30,$FC,$30,$30,$30,$30,$78,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$76,$CE,$C6,$C6,$CE,$76,$06,$C6,$7C,$00,$00 + .DB $00,$00,$E0,$60,$60,$7C,$66,$66,$66,$66,$66,$E6,$00,$00,$00,$00 + .DB $00,$00,$18,$18,$00,$38,$18,$18,$18,$18,$18,$3C,$00,$00,$00,$00 + .DB $00,$00,$0C,$0C,$00,$1C,$0C,$0C,$0C,$0C,$0C,$CC,$CC,$78,$00,$00 + .DB $00,$00,$E0,$60,$60,$66,$66,$6C,$78,$6C,$66,$E6,$00,$00,$00,$00 + .DB $00,$00,$18,$18,$18,$18,$18,$18,$18,$18,$18,$1C,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$6C,$FE,$D6,$D6,$C6,$C6,$C6,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$DC,$66,$66,$66,$66,$66,$66,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$7C,$C6,$C6,$C6,$C6,$C6,$7C,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$DC,$66,$66,$66,$66,$7C,$60,$60,$F0,$00,$00 + .DB $00,$00,$00,$00,$00,$76,$CC,$CC,$CC,$CC,$7C,$0C,$0C,$1E,$00,$00 + .DB $00,$00,$00,$00,$00,$DC,$66,$60,$60,$60,$60,$F0,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$7C,$C6,$C0,$7C,$06,$C6,$7C,$00,$00,$00,$00 + .DB $00,$00,$30,$30,$30,$FC,$30,$30,$30,$30,$36,$1C,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$CC,$CC,$CC,$CC,$CC,$CC,$76,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$C6,$C6,$C6,$C6,$6C,$38,$10,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$C6,$C6,$D6,$D6,$D6,$FE,$6C,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$C6,$C6,$6C,$38,$6C,$C6,$C6,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$C6,$C6,$C6,$C6,$CE,$76,$06,$C6,$7C,$00,$00 + .DB $00,$00,$00,$00,$00,$FE,$86,$0C,$18,$30,$62,$FE,$00,$00,$00,$00 + .DB $00,$00,$0E,$18,$18,$18,$70,$18,$18,$18,$18,$0E,$00,$00,$00,$00 + .DB $00,$00,$18,$18,$18,$18,$00,$18,$18,$18,$18,$18,$00,$00,$00,$00 + .DB $00,$00,$70,$18,$18,$18,$0E,$18,$18,$18,$18,$70,$00,$00,$00,$00 + .DB $00,$00,$76,$DC,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$10,$38,$38,$6C,$6C,$FE,$00,$00,$00,$00,$00 + .DB $00,$00,$3C,$66,$C0,$C0,$C0,$C6,$66,$3C,$18,$0C,$CC,$38,$00,$00 + .DB $00,$00,$C6,$00,$00,$C6,$C6,$C6,$C6,$C6,$CE,$76,$00,$00,$00,$00 + .DB $00,$0C,$18,$30,$00,$7C,$C6,$C6,$FE,$C0,$C6,$7C,$00,$00,$00,$00 + .DB $00,$30,$78,$CC,$00,$78,$0C,$7C,$CC,$CC,$DC,$76,$00,$00,$00,$00 + .DB $00,$00,$CC,$00,$00,$78,$0C,$7C,$CC,$CC,$DC,$76,$00,$00,$00,$00 + .DB $00,$60,$30,$18,$00,$78,$0C,$7C,$CC,$CC,$DC,$76,$00,$00,$00,$00 + .DB $00,$38,$6C,$38,$00,$78,$0C,$7C,$CC,$CC,$DC,$76,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$7C,$C6,$C0,$C0,$C6,$7C,$18,$0C,$6C,$38,$00,$00 + .DB $00,$30,$78,$CC,$00,$7C,$C6,$C6,$FE,$C0,$C6,$7C,$00,$00,$00,$00 + .DB $00,$00,$CC,$00,$00,$7C,$C6,$C6,$FE,$C0,$C6,$7C,$00,$00,$00,$00 + .DB $00,$30,$18,$0C,$00,$7C,$C6,$C6,$FE,$C0,$C6,$7C,$00,$00,$00,$00 + .DB $00,$00,$66,$00,$00,$38,$18,$18,$18,$18,$18,$3C,$00,$00,$00,$00 + .DB $00,$18,$3C,$66,$00,$38,$18,$18,$18,$18,$18,$3C,$00,$00,$00,$00 + .DB $00,$30,$18,$0C,$00,$38,$18,$18,$18,$18,$18,$3C,$00,$00,$00,$00 + .DB $00,$C6,$00,$38,$6C,$C6,$C6,$C6,$FE,$C6,$C6,$C6,$00,$00,$00,$00 + .DB $38,$6C,$38,$00,$38,$6C,$C6,$C6,$FE,$C6,$C6,$C6,$00,$00,$00,$00 + .DB $0C,$18,$30,$00,$FE,$60,$60,$7C,$60,$60,$60,$FE,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$66,$DB,$1B,$7F,$D8,$D8,$DF,$76,$00,$00,$00,$00 + .DB $00,$00,$7E,$D8,$D8,$D8,$D8,$FE,$D8,$D8,$D8,$DE,$00,$00,$00,$00 + .DB $00,$30,$78,$CC,$00,$7C,$C6,$C6,$C6,$C6,$C6,$7C,$00,$00,$00,$00 + .DB $00,$00,$C6,$00,$00,$7C,$C6,$C6,$C6,$C6,$C6,$7C,$00,$00,$00,$00 + .DB $00,$30,$18,$0C,$00,$7C,$C6,$C6,$C6,$C6,$C6,$7C,$00,$00,$00,$00 + .DB $00,$30,$78,$CC,$00,$C6,$C6,$C6,$C6,$C6,$CE,$76,$00,$00,$00,$00 + .DB $00,$60,$30,$18,$00,$C6,$C6,$C6,$C6,$C6,$CE,$76,$00,$00,$00,$00 + .DB $00,$18,$00,$3C,$18,$18,$18,$18,$18,$18,$18,$3C,$00,$00,$00,$00 + .DB $00,$C6,$00,$7C,$C6,$C6,$C6,$C6,$C6,$C6,$C6,$7C,$00,$00,$00,$00 + .DB $00,$C6,$00,$C6,$C6,$C6,$C6,$C6,$C6,$C6,$C6,$7C,$00,$00,$00,$00 + .DB $00,$00,$18,$18,$7C,$C6,$C0,$C0,$C6,$7C,$18,$18,$00,$00,$00,$00 + .DB $00,$38,$6C,$60,$60,$F0,$60,$60,$60,$66,$F6,$6C,$00,$00,$00,$00 + .DB $00,$66,$66,$66,$66,$3C,$18,$7E,$18,$3C,$18,$18,$00,$00,$00,$00 + .DB $00,$00,$3E,$63,$63,$30,$1C,$06,$63,$63,$3E,$00,$1C,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$3E,$63,$38,$0E,$63,$3E,$00,$1C,$00,$00,$00 + .DB $00,$0C,$18,$30,$00,$78,$0C,$7C,$CC,$CC,$DC,$76,$00,$00,$00,$00 + .DB $00,$0C,$18,$30,$00,$38,$18,$18,$18,$18,$18,$3C,$00,$00,$00,$00 + .DB $00,$0C,$18,$30,$00,$7C,$C6,$C6,$C6,$C6,$C6,$7C,$00,$00,$00,$00 + .DB $00,$18,$30,$60,$00,$CC,$CC,$CC,$CC,$CC,$DC,$76,$00,$00,$00,$00 + .DB $00,$00,$76,$DC,$00,$DC,$66,$66,$66,$66,$66,$66,$00,$00,$00,$00 + .DB $00,$76,$DC,$00,$C6,$C6,$E6,$F6,$DE,$CE,$C6,$C6,$00,$00,$00,$00 + .DB $00,$21,$1E,$00,$1E,$33,$60,$60,$67,$63,$33,$1D,$00,$00,$00,$00 + .DB $00,$42,$3C,$00,$3B,$66,$66,$66,$3E,$06,$66,$3C,$00,$00,$00,$00 + .DB $00,$00,$30,$30,$00,$30,$30,$30,$60,$C6,$C6,$7C,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$7E,$60,$60,$60,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$7E,$06,$06,$06,$00,$00,$00,$00,$00 + .DB $00,$60,$60,$62,$66,$6C,$18,$30,$60,$DC,$36,$0C,$18,$3E,$00,$00 + .DB $00,$60,$60,$62,$66,$6C,$18,$36,$6E,$DE,$36,$7E,$06,$06,$00,$00 + .DB $00,$00,$18,$18,$00,$18,$18,$3C,$3C,$3C,$3C,$18,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$36,$6C,$D8,$6C,$36,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$D8,$6C,$36,$6C,$D8,$00,$00,$00,$00,$00,$00 + .DB $11,$44,$11,$44,$11,$44,$11,$44,$11,$44,$11,$44,$11,$44,$11,$44 + .DB $AA,$55,$AA,$55,$AA,$55,$AA,$55,$AA,$55,$AA,$55,$AA,$55,$AA,$55 + .DB $DD,$77,$DD,$77,$DD,$77,$DD,$77,$DD,$77,$DD,$77,$DD,$77,$DD,$77 + .DB $18,$18,$18,$18,$18,$18,$18,$18,$18,$18,$18,$18,$18,$18,$18,$18 + .DB $18,$18,$18,$18,$18,$18,$18,$F8,$18,$18,$18,$18,$18,$18,$18,$18 + .DB $18,$18,$18,$18,$18,$F8,$18,$F8,$18,$18,$18,$18,$18,$18,$18,$18 + .DB $36,$36,$36,$36,$36,$36,$36,$F6,$36,$36,$36,$36,$36,$36,$36,$36 + .DB $00,$00,$00,$00,$00,$00,$00,$FE,$36,$36,$36,$36,$36,$36,$36,$36 + .DB $00,$00,$00,$00,$00,$F8,$18,$F8,$18,$18,$18,$18,$18,$18,$18,$18 + .DB $36,$36,$36,$36,$36,$F6,$06,$F6,$36,$36,$36,$36,$36,$36,$36,$36 + .DB $36,$36,$36,$36,$36,$36,$36,$36,$36,$36,$36,$36,$36,$36,$36,$36 + .DB $00,$00,$00,$00,$00,$FE,$06,$F6,$36,$36,$36,$36,$36,$36,$36,$36 + .DB $36,$36,$36,$36,$36,$F6,$06,$FE,$00,$00,$00,$00,$00,$00,$00,$00 + .DB $36,$36,$36,$36,$36,$36,$36,$FE,$00,$00,$00,$00,$00,$00,$00,$00 + .DB $18,$18,$18,$18,$18,$F8,$18,$F8,$00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$F8,$18,$18,$18,$18,$18,$18,$18,$18 + .DB $18,$18,$18,$18,$18,$18,$18,$1F,$00,$00,$00,$00,$00,$00,$00,$00 + .DB $18,$18,$18,$18,$18,$18,$18,$FF,$00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$FF,$18,$18,$18,$18,$18,$18,$18,$18 + .DB $18,$18,$18,$18,$18,$18,$18,$1F,$18,$18,$18,$18,$18,$18,$18,$18 + .DB $00,$00,$00,$00,$00,$00,$00,$FF,$00,$00,$00,$00,$00,$00,$00,$00 + .DB $18,$18,$18,$18,$18,$18,$18,$FF,$18,$18,$18,$18,$18,$18,$18,$18 + .DB $18,$18,$18,$18,$18,$1F,$18,$1F,$18,$18,$18,$18,$18,$18,$18,$18 + .DB $36,$36,$36,$36,$36,$36,$36,$37,$36,$36,$36,$36,$36,$36,$36,$36 + .DB $36,$36,$36,$36,$36,$37,$30,$3F,$00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$3F,$30,$37,$36,$36,$36,$36,$36,$36,$36,$36 + .DB $36,$36,$36,$36,$36,$F7,$00,$FF,$00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$FF,$00,$F7,$36,$36,$36,$36,$36,$36,$36,$36 + .DB $36,$36,$36,$36,$36,$37,$30,$37,$36,$36,$36,$36,$36,$36,$36,$36 + .DB $00,$00,$00,$00,$00,$FF,$00,$FF,$00,$00,$00,$00,$00,$00,$00,$00 + .DB $36,$36,$36,$36,$36,$F7,$00,$F7,$36,$36,$36,$36,$36,$36,$36,$36 + .DB $18,$18,$18,$18,$18,$FF,$00,$FF,$00,$00,$00,$00,$00,$00,$00,$00 + .DB $36,$36,$36,$36,$36,$36,$36,$FF,$00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$FF,$00,$FF,$18,$18,$18,$18,$18,$18,$18,$18 + .DB $00,$00,$00,$00,$00,$00,$00,$FF,$36,$36,$36,$36,$36,$36,$36,$36 + .DB $36,$36,$36,$36,$36,$36,$36,$3F,$00,$00,$00,$00,$00,$00,$00,$00 + .DB $18,$18,$18,$18,$18,$1F,$18,$1F,$00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$1F,$18,$1F,$18,$18,$18,$18,$18,$18,$18,$18 + .DB $00,$00,$00,$00,$00,$00,$00,$3F,$36,$36,$36,$36,$36,$36,$36,$36 + .DB $36,$36,$36,$36,$36,$36,$36,$FF,$36,$36,$36,$36,$36,$36,$36,$36 + .DB $18,$18,$18,$18,$18,$FF,$18,$FF,$18,$18,$18,$18,$18,$18,$18,$18 + .DB $18,$18,$18,$18,$18,$18,$18,$F8,$00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$1F,$18,$18,$18,$18,$18,$18,$18,$18 + .DB $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF + .DB $F0,$F0,$F0,$F0,$F0,$F0,$F0,$F0,$F0,$F0,$F0,$F0,$F0,$F0,$F0,$F0 + .DB $0F,$0F,$0F,$0F,$0F,$0F,$0F,$0F,$0F,$0F,$0F,$0F,$0F,$0F,$0F,$0F + .DB $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$76,$DC,$D8,$D8,$D8,$D8,$DC,$76,$00,$00,$00,$00 + .DB $00,$00,$78,$CC,$CC,$D8,$FC,$C6,$C6,$C6,$C6,$CC,$00,$00,$00,$00 + .DB $00,$00,$FE,$66,$62,$60,$60,$60,$60,$60,$60,$60,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$FE,$6C,$6C,$6C,$6C,$6C,$6C,$00,$00,$00,$00 + .DB $00,$00,$FE,$C6,$62,$30,$18,$18,$30,$62,$C6,$FE,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$7E,$D8,$CC,$CC,$CC,$D8,$70,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$66,$66,$66,$66,$66,$7C,$60,$C0,$80,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$76,$DC,$18,$18,$18,$18,$18,$00,$00,$00,$00 + .DB $00,$00,$FE,$38,$38,$6C,$C6,$C6,$6C,$38,$38,$FE,$00,$00,$00,$00 + .DB $00,$00,$00,$38,$6C,$C6,$C6,$FE,$C6,$C6,$6C,$38,$00,$00,$00,$00 + .DB $00,$00,$38,$6C,$C6,$C6,$C6,$C6,$6C,$6C,$6C,$EE,$00,$00,$00,$00 + .DB $00,$00,$3E,$60,$60,$3C,$66,$C6,$C6,$C6,$CC,$78,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$7E,$DB,$DB,$DB,$7E,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$02,$06,$7C,$CE,$DE,$F6,$F6,$7C,$60,$C0,$00,$00,$00,$00 + .DB $00,$00,$00,$1C,$30,$60,$60,$7C,$60,$60,$30,$1C,$00,$00,$00,$00 + .DB $00,$00,$7C,$C6,$C6,$C6,$C6,$C6,$C6,$C6,$C6,$C6,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$FE,$00,$00,$FE,$00,$00,$FE,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$18,$18,$7E,$18,$18,$00,$00,$7E,$00,$00,$00,$00 + .DB $00,$00,$30,$18,$0C,$06,$0C,$18,$30,$00,$00,$7E,$00,$00,$00,$00 + .DB $00,$00,$0C,$18,$30,$60,$30,$18,$0C,$00,$00,$7E,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$0C,$1E,$1A,$18,$18,$18,$18,$18,$18,$18,$18,$18 + .DB $18,$18,$18,$18,$18,$18,$18,$18,$18,$18,$58,$78,$30,$00,$00,$00 + .DB $00,$00,$00,$00,$18,$18,$00,$7E,$00,$18,$18,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$76,$DC,$00,$76,$DC,$00,$00,$00,$00,$00 + .DB $00,$00,$78,$CC,$CC,$78,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$18,$18,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00,$18,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$1F,$18,$18,$18,$18,$18,$D8,$D8,$78,$38,$18,$00,$00,$00 + .DB $00,$00,$D8,$6C,$6C,$6C,$6C,$6C,$00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$70,$D8,$18,$30,$60,$F8,$00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$7E,$7E,$7E,$7E,$7E,$7E,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 diff --git a/Source/HBIOS/cvdu_font.asm b/Source/HBIOS/font_lo.asm similarity index 97% rename from Source/HBIOS/cvdu_font.asm rename to Source/HBIOS/font_lo.asm index dadf3465..b43975f2 100644 --- a/Source/HBIOS/cvdu_font.asm +++ b/Source/HBIOS/font_lo.asm @@ -1,4 +1,3 @@ -CVDU_FONTDATA: .DB $18,$18,$18,$FF,$FF,$18,$18,$18 .DB $00,$00,$00,$00,$00,$00,$00,$00 .DB $C0,$C0,$30,$30,$C0,$C0,$30,$30 @@ -511,7 +510,7 @@ CVDU_FONTDATA: .DB $00,$00,$00,$00,$00,$00,$00,$00 .DB $0F,$0F,$0F,$0F,$FF,$FF,$FF,$FF .DB $00,$00,$00,$00,$00,$00,$00,$00 -#IF 1 +#IF 0 .DB $0F,$0F,$0F,$0F,$F0,$F0,$F0,$F0 .DB $00,$00,$00,$00,$00,$00,$00,$00 .DB $3C,$66,$6E,$6E,$60,$62,$3C,$00 diff --git a/Source/HBIOS/tms_font.inc b/Source/HBIOS/font_tms.asm similarity index 98% rename from Source/HBIOS/tms_font.inc rename to Source/HBIOS/font_tms.asm index 4d204d95..c5f3da74 100644 --- a/Source/HBIOS/tms_font.inc +++ b/Source/HBIOS/font_tms.asm @@ -1,4 +1,5 @@ ; tms_font.inc - automatically generated by n8vidtst +FONT_TMS: .DB 000h,000h,000h,000h,000h,000h,000h,000h ; 0x00(0) .DB 030h,030h,030h,03ch,03ch,000h,000h,000h ; 0x01(1) .DB 030h,030h,030h,0f0h,0f0h,000h,000h,000h ; 0x02(2) diff --git a/Source/HBIOS/hbios.asm b/Source/HBIOS/hbios.asm index c112c4f0..1426cc47 100644 --- a/Source/HBIOS/hbios.asm +++ b/Source/HBIOS/hbios.asm @@ -799,13 +799,38 @@ HB_START1: ; BNKCALL ARRIVES HERE, BUT NOW RUNNING IN RAM BANK PRTS(" @ $") LD HL,(CB_CPUKHZ) CALL PRTD3M ; PRINT AS DECIMAL WITH 3 DIGIT MANTISSA - PRTS("MHz ROM=$") + PRTS("MHz$") +; +; DISPLAY CPU CONFIG +; +#IF ((PLATFORM == PLT_N8) | (PLATFORM == PLT_MK4)) +; + CALL PRTSTRD + .TEXT ", $" + LD A,Z180_MEMWAIT + CALL PRTDECB + CALL PRTSTRD + .TEXT " MEM W/S, $" + LD A,Z180_IOWAIT + CALL PRTDECB + CALL PRTSTRD + .TEXT " I/O W/S$" +; +; DISPLAY MEMORY CONFIG +; + CALL NEWLINE + CALL PRTSTRD + .TEXT "MEMORY LAYOUT $" LD HL,ROMSIZE CALL PRTDEC - PRTS("KB RAM=$") + CALL PRTSTRD + .TEXT "KB ROM, $" LD HL,RAMSIZE CALL PRTDEC - PRTS("KB$") + CALL PRTSTRD + .TEXT "KB RAM$" +; +#ENDIF ; ; PERFORM DEVICE INITIALIZATION ; @@ -931,6 +956,9 @@ HB_INITTBL: #IF (CVDUENABLE) .DW CVDU_INIT #ENDIF +#IF (VGAENABLE) + .DW VGA_INIT +#ENDIF #IF (NECENABLE) .DW NEC_INIT #ENDIF @@ -1371,6 +1399,7 @@ VDA_DISPATCH: ; CONVERT C TO THE DEVICE/DRIVER SPECIFIC UNIT ID ; AND GET THE DEVICE TYPE TO A FOR DRIVER DISPATCHING ; + PUSH IY ; SAVE INCOMING IY LD A,C ; INCOMING UNIT INDEX TO A PUSH HL ; SAVE INCOMING HL LD HL,VDA_CNT ; HL := ADDRESS OF TABLE ENTRY COUNT @@ -1384,34 +1413,37 @@ VDA_DISPATCH: RET ; AND RETURN ; VDA_DISPATCH1: - INC HL ; BUMP PAST COUNT PREFIX TO START OF TABLE - RLCA ; MULTIPLY BY 4 TO +; + ; SET HL := TABLE ENTRY ADDRESS + INC HL ; BUMP PAST COUNT PREFIX TO START OF TABLE ENTRIES + RLCA ; MULTIPLY UNIT # BY 4 TO RLCA ; ... TO CALC ENTRY OFFSET - CALL ADDHLA ; HL := ENTRY OFFSET - LD A,(HL) ; GET DEVICE TYPE BYTE - INC HL ; BUMP TO DEVICE UNIT INDEX BYTE - LD C,(HL) ; DEVICE UNIT INDEX TO C - POP HL ; RECOVER INCOMING HL VALUE + CALL ADDHLA ; HL := ADDRESS OF ENTRY IN TABLE ; -; DISPATCH TO DRIVER BASED ON DEVICE TYPE IN A + ; GET FIRST WORD OF TABLE ENTRY AND SAVE FOR DRIVER CALL + LD A,(HL) ; DEREFERENCE + INC HL ; ... + PUSH HL ; SAVE IT FOR BELOW + LD H,(HL) ; ... + LD L,A ; ... SO HL HAS ADDRESS OF DRIVER DISPATCH + LD (VDA_TGTADR),HL ; SAVE THE TARGET ADDRESS TO CALL LATER ; -#IF (VDUENABLE) - CP VDADEV_VDU - JP Z,VDU_DISPATCH -#ENDIF -#IF (CVDUENABLE) - CP VDADEV_CVDU - JP Z,CVDU_DISPATCH -#ENDIF -#IF (NECENABLE) - CP VDADEV_7220 - JP Z,NEC_DISPATCH -#ENDIF -#IF (TMSENABLE) - CP VDADEV_TMS - JP Z,TMS_DISPATCH -#ENDIF - CALL PANIC + ; GET SECOND WORD OF TABLE ENTRY AND PUT IN IY FOR DRIVER CALL + POP HL ; GET TABLE ENTRY ADDRESS BACK + INC HL ; INCREMENT TO DATA WORD + LD A,(HL) ; GET DATA WORD + INC HL ; ... + LD H,(HL) ; ... + LD L,A ; ... INTO HL + PUSH HL ; AND COPY IT + POP IY ; ... TO IY +; + ; CALL DRIVER (ADDRESS BYTES OF CALL INSTRUCTION UPDATED ABOVE) + POP HL ; GET ORIGINAL HL BACK (10) + CALL PANIC ; CALL DRIVER DISPATCH ENTRY +VDA_TGTADR .EQU $ - 2 ; REFERENCE TO ADDRESS OF CALL INSTRUCTION + POP IY ; RESTORE ORIGINAL IY + RET ; AND RETURN ; ; HBIOS VIDEO DEVICE UNIT TABLE ; @@ -1420,8 +1452,7 @@ VDA_DISPATCH1: ; NUMBER OF ENTRIES. TABLE - 2 CONTAINS THE MAXIMUM NUMBER OF ENTRIES. ; EACH ENTRY IS DEFINED AS: ; -; BYTE DEVICE TYPE ID -; BYTE DEVICE/DRIVER UNIT NUMBER +; WORD DRIVER DISPATCH ADDRESS ; WORD UNIT DATA ADDRESS ; VDA_MAX .EQU 16 ; UP TO 16 UNITS @@ -1981,12 +2012,12 @@ SIZ_ASCI .EQU $ - ORG_ASCI .ECHO " bytes.\n" #ENDIF ; -#IF (VDUENABLE) -ORG_VDU .EQU $ - #INCLUDE "vdu.asm" -SIZ_VDU .EQU $ - ORG_VDU - .ECHO "VDU occupies " - .ECHO SIZ_VDU +#IF (VGAENABLE) +ORG_VGA .EQU $ + #INCLUDE "vga.asm" +SIZ_VGA .EQU $ - ORG_VGA + .ECHO "VGA occupies " + .ECHO SIZ_VGA .ECHO " bytes.\n" #ENDIF ; @@ -1999,6 +2030,24 @@ SIZ_CVDU .EQU $ - ORG_CVDU .ECHO " bytes.\n" #ENDIF ; +#IF (VDUENABLE) +ORG_VDU .EQU $ + #INCLUDE "vdu.asm" +SIZ_VDU .EQU $ - ORG_VDU + .ECHO "VDU occupies " + .ECHO SIZ_VDU + .ECHO " bytes.\n" +#ENDIF +; +#IF (TMSENABLE) +ORG_TMS .EQU $ + #INCLUDE "tms.asm" +SIZ_TMS .EQU $ - ORG_TMS + .ECHO "TMS occupies " + .ECHO SIZ_TMS + .ECHO " bytes.\n" +#ENDIF +; #IF (NECENABLE) ORG_NEC .EQU $ ;#INCLUDE "nec.asm" @@ -2008,12 +2057,39 @@ SIZ_NEC .EQU $ - ORG_NEC .ECHO " bytes.\n" #ENDIF ; +#IF (CVDUENABLE | VGAENABLE) +ORG_FONTHI .EQU $ + #INCLUDE "font_hi.asm" +SIZ_FONTHI .EQU $ - ORG_FONTHI + .ECHO "FONTHI occupies " + .ECHO SIZ_FONTHI + .ECHO " bytes.\n" +#ENDIF +; #IF (TMSENABLE) -ORG_TMS .EQU $ - #INCLUDE "tms.asm" -SIZ_TMS .EQU $ - ORG_TMS - .ECHO "TMS occupies " - .ECHO SIZ_TMS +ORG_FONTTMS .EQU $ + #INCLUDE "font_tms.asm" +SIZ_FONTTMS .EQU $ - ORG_FONTTMS + .ECHO "FONTTMS occupies " + .ECHO SIZ_FONTTMS + .ECHO " bytes.\n" +#ENDIF +; +#IF (CVDUENABLE | VGAENABLE) +ORG_KBD .EQU $ + #INCLUDE "kbd.asm" +SIZ_KBD .EQU $ - ORG_KBD + .ECHO "KBD occupies " + .ECHO SIZ_KBD + .ECHO " bytes.\n" +#ENDIF +; +#IF (VDUENABLE | TMSENABLE) +ORG_PPK .EQU $ + #INCLUDE "ppk.asm" +SIZ_PPK .EQU $ - ORG_PPK + .ECHO "PPK occupies " + .ECHO SIZ_PPK .ECHO " bytes.\n" #ENDIF ; @@ -2810,12 +2886,13 @@ PS_STPARMAP .DB "NONENMNS" ; VIDEO DEVICE STRINGS ; PS_VDSTRREF: - .DW PS_VDVDU, PS_VDCVDU, PS_VDNEC, PS_VDTMS + .DW PS_VDVDU, PS_VDCVDU, PS_VDNEC, PS_VDTMS, PS_VDVGA ; PS_VDVDU .TEXT "VDU$" PS_VDCVDU .TEXT "CVDU$" PS_VDNEC .TEXT "NEC$" PS_VDTMS .TEXT "TMS$" +PS_VDVGA .TEXT "VGA$" ; ; VIDEO TYPE STRINGS ; diff --git a/Source/HBIOS/hbios.inc b/Source/HBIOS/hbios.inc index 2b364fd1..0a23d4e5 100644 --- a/Source/HBIOS/hbios.inc +++ b/Source/HBIOS/hbios.inc @@ -104,6 +104,7 @@ VDADEV_VDU .EQU $00 ; ECB VDU - MOTOROLA 6545 VDADEV_CVDU .EQU $10 ; ECB COLOR VDU - MOS 8563 VDADEV_NEC .EQU $20 ; ECB UPD7220 - NEC UPD7220 VDADEV_TMS .EQU $30 ; N8 ONBOARD VDA SUBSYSTEM - TMS 9918 +VDADEV_VGA .EQU $40 ; VGA ; ; EMULATION TYPES ; diff --git a/Source/HBIOS/ide.asm b/Source/HBIOS/ide.asm index 8fa502ac..22c7ad9a 100644 --- a/Source/HBIOS/ide.asm +++ b/Source/HBIOS/ide.asm @@ -218,7 +218,16 @@ IDE_TOFAST .EQU 10 ; FAST TIMEOUT IS 0.5 SECS ; IDE_INIT: CALL NEWLINE ; FORMATTING - PRTS("IDE:$") ; LABEL FOR IO ADDRESS + PRTS("IDE:$") + CALL IDE_DETECT ; CHECK FOR HARDWARE + JR Z,IDE_INIT00 ; CONTINUE IF PRESENT +; + ; HARDWARE NOT PRESENT + PRTS(" NOT PRESENT$") + OR $FF ; SIGNAL FAILURE + RET +; +IDE_INIT00: ; ; SETUP THE DISPATCH TABLE ENTRIES ; @@ -319,6 +328,20 @@ IDE_INIT2: XOR A ; SIGNAL SUCCESS RET ; RETURN WITH A=0, AND Z SET ; +;---------------------------------------------------------------------- +; PROBE FOR IDE HARDWARE +;---------------------------------------------------------------------- +; +; ON RETURN, ZF SET INDICATES HARDWARE FOUND +; +IDE_DETECT: +; +#IF (IDEMODE == IDEMODE_DIDE) +#ENDIF +; + XOR A ; SIGNAL SUCCESS + RET ; AND RETURN +; ;============================================================================= ; FUNCTION DISPATCH ENTRY POINT ;============================================================================= diff --git a/Source/HBIOS/kbd.asm b/Source/HBIOS/kbd.asm index 5dbdca1c..2db34136 100644 --- a/Source/HBIOS/kbd.asm +++ b/Source/HBIOS/kbd.asm @@ -12,13 +12,11 @@ ; DATA CONSTANTS ;__________________________________________________________________________________________________ ; -; IO PORTS +; DRIVER DATA OFFSETS (FROM IY) ; -KBD_IOBASE .EQU $E0 -; -KBD_ST .EQU KBD_IOBASE + $0A -KBD_CMD .EQU KBD_IOBASE + $0A -KBD_DATA .EQU KBD_IOBASE + $02 +KBD_ST .EQU 0 ; BYTE, STATUS PORT NUM (R) +KBD_CMD .EQU KBD_ST ; BYTE, CMD PORT NUM (W) +KBD_DAT .EQU 1 ; BYTE, DATA PORT NUM (R/W) ; ; TIMING CONSTANTS ; @@ -64,7 +62,7 @@ KBD_IDLE .DB 0 ; IDLE COUNT KBD_INIT: CALL NEWLINE ; FORMATTING PRTS("KBD: IO=0x$") - LD A,KBD_IOBASE + LD A,(IY+KBD_DAT) CALL PRTHEXBYTE ; LD A,KBD_DEFRPT ; GET DEFAULT REPEAT RATE @@ -149,7 +147,8 @@ KBD_IST: ; KEYBOARD INPUT STATUS ; A=0, Z SET FOR NOTHING PENDING, OTHERWISE DATA PENDING ; - IN A,(KBD_ST) ; GET STATUS + LD C,(IY+KBD_ST) ; STATUS PORT + IN A,(C) ; GET STATUS AND $01 ; ISOLATE INPUT PENDING BIT RET ; @@ -159,7 +158,8 @@ KBD_OST: ; KEYBOARD OUTPUT STATUS ; A=0, Z SET FOR NOT READY, OTHERWISE READY TO WRITE ; - IN A,(KBD_ST) ; GET STATUS + LD C,(IY+KBD_ST) ; STATUS PORT + IN A,(C) ; GET STATUS AND $02 ; ISOLATE OUTPUT EMPTY BIT XOR $02 ; FLIP IT FOR APPROPRIATE RETURN VALUES RET @@ -185,7 +185,8 @@ KBD_PUTCMD1: CALL PC_GT CALL PRTHEXBYTE #ENDIF - OUT (KBD_CMD),A ; WRITE IT + LD C,(IY+KBD_CMD) ; COMMAND PORT + OUT (C),A ; WRITE IT XOR A ; SIGNAL SUCCESS RET ; @@ -209,7 +210,8 @@ KBD_PUTDATA1: CALL PC_GT CALL PRTHEXBYTE #ENDIF - OUT (KBD_DATA),A ; WRITE IT + LD C,(IY+KBD_DAT) ; DATA PORT + OUT (C),A ; WRITE IT XOR A ; SIGNAL SUCCESS RET ; @@ -227,7 +229,8 @@ KBD_GETDATA0: XOR A ; NO DATA, RETURN ZERO RET KBD_GETDATA1: - IN A,(KBD_DATA) ; GET THE DATA VALUE + LD C,(IY+KBD_DAT) ; DATA PORT + IN A,(C) ; GET THE DATA VALUE #IF (KBDTRACE >= 2) PUSH AF CALL PC_SPACE diff --git a/Source/HBIOS/ppk.asm b/Source/HBIOS/ppk.asm index 0a9bb8b8..48cfd8d1 100644 --- a/Source/HBIOS/ppk.asm +++ b/Source/HBIOS/ppk.asm @@ -12,23 +12,18 @@ ; DATA CONSTANTS ;__________________________________________________________________________________________________ ; -; IO PORTS +; DRIVER DATA OFFSETS (FROM IY) +; +PPK_PPIA .EQU 0 ; PPI PORT A +PPK_PPIB .EQU 1 ; PPI PORT B +PPK_PPIC .EQU 2 ; PPI PORT C +PPK_PPIX .EQU 3 ; PPI CONTROL PORT +; +; DRIVER CONSTANTS ; -#IF (PLATFORM == PLT_N8) -PPK_PPI .EQU 084H ; PPI PORT BASE FOR N8 -#ELSE -PPK_PPI .EQU 0F4H ; PPI PORT BASE FOR VDU -#ENDIF - -PPK_PPIA .EQU PPK_PPI + 0 ; KEYBOARD PPI PORT A -PPK_PPIB .EQU PPK_PPI + 1 ; KEYBOARD PPI PORT B -PPK_PPIC .EQU PPK_PPI + 2 ; KEYBOARD PPI PORT C -PPK_PPIX .EQU PPK_PPI + 3 ; KEYBOARD PPI CONTROL PORT - PPK_DAT .EQU 01111000B ; PPIX MASK TO MANAGE DATA LINE (C:4) PPK_CLK .EQU 01111010B ; PPIX MASK TO MANAGE CLOCK LINE (C:5) - -;PPK_WAITTO .EQU 50 * CPUMHZ ; TUNE!!! WANT SMALL AS POSSIBLE W/O ERRORS +; PPK_WAITRDY .EQU 6 ; TUNE!!! LOOP COUNT TO ENSURE DEVICE READY ; ; STATUS BITS (FOR PPK_STATUS) @@ -72,7 +67,7 @@ PPK_WAITTO .DW 0 ; TIMEOUT WAIT LOOP COUNT (COMPUTED IN INIT) PPK_INIT: CALL NEWLINE ; FORMATTING PRTS("PPK: IO=0x$") - LD A,PPK_PPIA + LD A,(IY+PPK_PPIA) CALL PRTHEXBYTE ; ; PRECOMPUTE TIMEOUT LOOP COUNT (CPU KHZ / 16) @@ -178,7 +173,8 @@ PPK_GETDATA1: PPK_GETDATA2: CALL PPK_WTCLKLO ; WAIT TILL CLOCK GOES LOW - IN A,(PPK_PPIB) ; SAMPLE THE DATA LINE + LD C,(IY+PPK_PPIB) ; C := PPI PORT B + IN A,(C) ; SAMPLE THE DATA LINE RRA ; MOVE THE DATA BIT INTO THE CARRY REGISTER LD A,E ; GET THE BYTE WE ARE BUILDING IN E RRA ; MOVE THE CARRY BIT INTO BIT 7 AND SHIFT RIGHT @@ -244,7 +240,8 @@ PPK_PUTDATA1: RRC E ; ROTATE LOW BIT OF E TO CARRY (NEXT BIT TO SEND) LD A,PPK_DAT >> 1 ; INIT A WITH DATA MASK SHIFTED RIGHT BY ONE BIT RLA ; SHIFT CARRY INTO LOW BIT OF A - OUT (PPK_PPIX),A ; SET/RESET DATA LINE FOR NEXT BIT VALUE + LD C,(IY+PPK_PPIX) ; C := PPI CONTROL PORT + OUT (C),A ; SET/RESET DATA LINE FOR NEXT BIT VALUE CALL PPK_WTCLKHI ; WAIT FOR CLOCK TO TRANSTION HI CALL PPK_WTCLKLO ; THEN LO, BIT HAS NOW BEEN RECEIVED BY DEVICE DJNZ PPK_PUTDATA1 ; LOOP TO SEND 8 DATA BITS @@ -256,7 +253,8 @@ PPK_PUTDATA1: JP PO,PPK_PUTDATA2 ; PARITY IS ALREADY ODD, LEAVE A ALONE INC A ; SET PARITY BIT BY INCREMENTING A PPK_PUTDATA2: - OUT (PPK_PPIX),A ; SET THE DATA LINE + LD C,(IY+PPK_PPIX) ; C := PPI CONTROL PORT + OUT (C),A ; SET THE DATA LINE CALL PPK_WTCLKHI ; WAIT FOR CLOCK TO TRANSITION HI CALL PPK_WTCLKLO ; THEN LO, BIT HAS NOW BEEN RECEIVED BY DEVICE @@ -280,9 +278,11 @@ PPK_INITPORT: ; INITIALIZE PPI ; LD A,10000010B ; A=OUT B=IN, C HIGH=OUT, CLOW=OUT - OUT (PPK_PPIX),A ; SET PPI CONTROL PORT + LD C,(IY+PPK_PPIX) ; C := PPI CONTROL PORT + OUT (C),A ; SET PPI CONTROL PORT XOR A ; A=0 - OUT (PPK_PPIA),A ; PPI PORT A TO ZERO (REQUIRED FOR PAR PRINTER) + LD C,(IY+PPK_PPIA) ; C := PPI PORT A + OUT (C),A ; PPI PORT A TO ZERO (REQUIRED FOR PAR PRINTER) CALL PPK_DATHI ; KBD DATA LINE HI (IDLE) CALL PPK_CLKHI ; KBD CLOCK LINE HI (IDLE) RET @@ -322,7 +322,8 @@ PPK_WTDATHI: ; WAIT FOR DATA LINE TO BE HIGH PPK_WAIT: ; COMPLETE THE WAIT PROCESSING LD HL,(PPK_WAITTO) PPK_WAIT1: - IN A,(PPK_PPIB) ; GET BYTE FROM PORT B + LD C,(IY+PPK_PPIB) ; C := PPI PORT B + IN A,(C) ; GET BYTE FROM PORT B XOR E AND D JR NZ,PPK_WAIT2 ; EXIT IF ANY BIT IS SET @@ -356,7 +357,8 @@ PPK_CLKLO: LD A,PPK_CLK JR PPK_SETBIT PPK_SETBIT: - OUT (PPK_PPIX),A + LD C,(IY+PPK_PPIX) ; C := PPI CONTROL PORT + OUT (C),A RET ; ;__________________________________________________________________________________________________ diff --git a/Source/HBIOS/prp.asm b/Source/HBIOS/prp.asm index 692b4a3a..9f1574d2 100644 --- a/Source/HBIOS/prp.asm +++ b/Source/HBIOS/prp.asm @@ -20,6 +20,9 @@ PRP_INIT: CALL PRP_DETECT LD DE,PRP_STR_NOHW JP NZ,WRITESTR + + CALL PC_SPACE + CALL PRTHEXWORD ; ; RESET INTERFACE, RETURN WITH NZ ON FAILURE #IF (PRPSDTRACE >= 3) @@ -67,7 +70,8 @@ PRP_INIT1: ; ; PRP_DETECT: - LD BC,2000 ; TRY FOR ABOUT 4 SECONDS + ;LD BC,2000 ; TRY FOR ABOUT 4 SECONDS + LD BC,1024 ; TRY FOR ABOUT 2 SECONDS PRP_DETECT1: CALL PRP_DETECT2 RET Z diff --git a/Source/HBIOS/sd.asm b/Source/HBIOS/sd.asm index 03ec6a00..30851796 100644 --- a/Source/HBIOS/sd.asm +++ b/Source/HBIOS/sd.asm @@ -216,6 +216,15 @@ SD_CAPACITY .EQU 2 ; CARD CAPACITY (1 DWORD/4 BYTES) SD_INIT: CALL NEWLINE ; FORMATTING PRTS("SD:$") + CALL SD_PROBE ; CHECK FOR HARDWARE + JR Z,SD_INIT00 ; CONTINUE IF PRESENT +; + ; HARDWARE NOT PRESENT + PRTS(" NOT PRESENT$") + OR $FF ; SIGNAL FAILURE + RET +; +SD_INIT00: ; ; SETUP THE DISPATCH TABLE ENTRIES ; @@ -416,6 +425,25 @@ SD_INITUNIT2: PRTS(" WP$") ; NOTIFY USER RET ; DONE ; +;---------------------------------------------------------------------- +; PROBE FOR SD HARDWARE +;---------------------------------------------------------------------- +; +; ON RETURN, ZF SET INDICATES HARDWARE FOUND +; +SD_PROBE: +; +#IF (SDMODE == SDMODE_DSD) + LD A,$03 ; SET BIT 0 & 1 + OUT (SD_SELREG),A ; WRITE TO SELECT REG + IN A,(SD_SELREG) ; READ BACK, BIT 1 IS ALWAYS 0 + CP $01 ; ... SO SHOULD READ BACK AS $01 + RET +#ENDIF +; + XOR A ; SIGNAL SUCCESS + RET ; AND RETURN +; ;============================================================================= ; FUNCTION DISPATCH ENTRY POINT ;============================================================================= diff --git a/Source/HBIOS/term.asm b/Source/HBIOS/term.asm index 5f1a36fe..9214924b 100644 --- a/Source/HBIOS/term.asm +++ b/Source/HBIOS/term.asm @@ -29,11 +29,13 @@ ; ; C: VIDEO UNIT NUMBER OF CALLING VDA DRIVER ; DE: VDA DRIVER'S DISPATCH ADDRESS +; HL: VDA DRIVER'S INSTANCE DATA ; TERM_ATTACH: ; LD A,(TERM_DEVCNT) ; GET NEXT DEVICE NUMBER TO USE LD B,A ; PUT IT IN B + PUSH HL ; SAVE VDA INSTANCE DATA PTR ; ; SETUP EMULATOR MODULE DISPATCH ADDRESS BASED ON DESIRED EMULATION ; EMULATOR PASSES BACK IT'S DISPATCH ADDRESS IN DE @@ -44,12 +46,14 @@ TERM_ATTACH: #IF (VDAEMU == EMUTYP_ANSI) CALL ANSI_INIT ; INIT ANSI, DE := ANSI_DISPATCH #ENDIF + POP HL ; RECOVER VDA INSTANCE DATA PTR RET NZ ; BAIL OUT ON ERROR ; ; ADD OURSELVES TO CIO DISPATCH TABLE PUSH DE ; COPY EMULATOR DISPATCH ADDRESS POP BC ; ... TO BC - LD DE,0 ; DE := DATA BLOB (NONE AT THIS POINT) + PUSH HL ; COPY VDA INSTANCE DATA PTR + POP DE ; ... TO DE CALL CIO_ADDENT ; ADD ENTRY, A := UNIT ASSIGNED LD (HCB + HCB_CRTDEV),A ; SET OURSELVES AS THE CRT DEVICE ; diff --git a/Source/HBIOS/tms.asm b/Source/HBIOS/tms.asm index 7640b587..c181891e 100644 --- a/Source/HBIOS/tms.asm +++ b/Source/HBIOS/tms.asm @@ -14,8 +14,27 @@ ; TMS DRIVER - CONSTANTS ;====================================================================== ; -TMS_CMDREG .EQU N8_BASE + $19 ; READ STATUS / WRITE REG SEL +#IF (PLATFORM == PLT_N8) + TMS_DATREG .EQU N8_BASE + $18 ; READ/WRITE DATA +TMS_CMDREG .EQU N8_BASE + $19 ; READ STATUS / WRITE REG SEL + +TMS_PPIA .EQU N8_BASE + $04 ; PPI PORT A +TMS_PPIB .EQU N8_BASE + $05 ; PPI PORT B +TMS_PPIC .EQU N8_BASE + $06 ; PPI PORT C +TMS_PPIX .EQU N8_BASE + $07 ; PPI CONTROL PORT + +#ELSE + +TMS_DATREG .EQU $50 ; READ/WRITE DATA +TMS_CMDREG .EQU $51 ; READ STATUS / WRITE REG SEL + +TMS_PPIA .EQU $F4 ; PPI PORT A +TMS_PPIB .EQU $F5 ; PPI PORT B +TMS_PPIC .EQU $F6 ; PPI PORT C +TMS_PPIX .EQU $F7 ; PPI CONTROL PORT + +#ENDIF ; TMS_ROWS .EQU 24 TMS_COLS .EQU 40 @@ -33,6 +52,8 @@ TERMENABLE .SET TRUE ; INCLUDE TERMINAL PSEUDODEVICE DRIVER ;====================================================================== ; TMS_INIT: + LD IY,TMS_IDAT ; POINTER TO INSTANCE DATA +; CALL NEWLINE ; FORMATTING PRTS("TMS: IO=0x$") LD A,TMS_DATREG @@ -44,14 +65,14 @@ TMS_INIT: CALL PPK_INIT ; INITIALIZE KEYBOARD DRIVER ; ; ADD OURSELVES TO VDA DISPATCH TABLE - LD B,0 ; PHYSICAL UNIT IS ZERO - LD C,VDADEV_TMS ; DEVICE TYPE - LD DE,0 ; UNIT DATA BLOB ADDRESS + LD BC,TMS_DISPATCH ; BC := DISPATCH ADDRESS + LD DE,TMS_IDAT ; DE := TMS INSTANCE DATA PTR CALL VDA_ADDENT ; ADD ENTRY, A := UNIT ASSIGNED ; ; INITIALIZE EMULATION LD C,A ; C := ASSIGNED VIDEO DEVICE NUM LD DE,TMS_DISPATCH ; DE := DISPATCH ADDRESS + LD HL,TMS_IDAT ; HL := TMS INSTANCE DATA PTR CALL TERM_ATTACH ; DO IT ; XOR A ; SIGNAL SUCCESS @@ -293,7 +314,7 @@ TMS_LOADFONT: CALL TMS_WR ; ; FILL $800 BYTES FROM FONTDATA - LD HL,TMS_FONTDATA + LD HL,FONT_TMS LD DE,$100 * 8 TMS_LOADFONT1: LD B,8 @@ -662,10 +683,11 @@ TMS_INIT9918: TMS_INIT9918LEN .EQU $ - TMS_INIT9918 ; ;================================================================================================== -; TMS DRIVER - FONT DATA +; TMS DRIVER - INSTANCE DATA ;================================================================================================== ; -TMS_FONTDATA: -#INCLUDE "TMS_font.inc" -; -#INCLUDE "ppk.asm" +TMS_IDAT: + .DB TMS_PPIA + .DB TMS_PPIB + .DB TMS_PPIC + .DB TMS_PPIX diff --git a/Source/HBIOS/vdu.asm b/Source/HBIOS/vdu.asm index 19795236..e1498d53 100644 --- a/Source/HBIOS/vdu.asm +++ b/Source/HBIOS/vdu.asm @@ -17,11 +17,17 @@ ; VDU DRIVER - CONSTANTS ;====================================================================== ; -VDU_RAMRD .EQU 0F0h ; READ VDU -VDU_RAMWR .EQU 0F1h ; WRITE VDU -VDU_STAT .EQU 0F2h ; VDU STATUS/REGISTER -VDU_REG .EQU 0F2h ; VDU STATUS/REGISTER -VDU_DATA .EQU 0F3h ; VDU DATA REGISTER +VDU_BASE .EQU $F0 +; +VDU_RAMRD .EQU VDU_BASE + $00 ; READ VDU +VDU_RAMWR .EQU VDU_BASE + $01 ; WRITE VDU +VDU_STAT .EQU VDU_BASE + $02 ; VDU STATUS/REGISTER +VDU_REG .EQU VDU_BASE + $02 ; VDU STATUS/REGISTER +VDU_DATA .EQU VDU_BASE + $03 ; VDU DATA REGISTER +VDU_PPIA .EQU VDU_BASE + $04 ; PPI PORT A +VDU_PPIB .EQU VDU_BASE + $05 ; PPI PORT B +VDU_PPIC .EQU VDU_BASE + $06 ; PPI PORT C +VDU_PPIX .EQU VDU_BASE + $07 ; PPI CONTROL PORT ; TERMENABLE .SET TRUE ; INCLUDE TERMINAL PSEUDODEVICE DRIVER ; @@ -30,24 +36,34 @@ TERMENABLE .SET TRUE ; INCLUDE TERMINAL PSEUDODEVICE DRIVER ;====================================================================== ; VDU_INIT: + LD IY,VDU_IDAT ; POINTER TO INSTANCE DATA +; CALL NEWLINE ; FORMATTING PRTS("VDU: IO=0x$") LD A,VDU_RAMRD CALL PRTHEXBYTE + CALL VDU_PROBE ; CHECK FOR HW EXISTENCE + JR Z,VDU_INIT1 ; CONTINUE IF HW PRESENT +; + ; HARDWARE NOT PRESENT + PRTS(" NOT PRESENT$") + OR $FF ; SIGNAL FAILURE + RET ; +VDU_INIT1: CALL VDU_CRTINIT ; INIT SY6845 VDU CHIP CALL VDU_VDARES CALL PPK_INIT ; INITIALIZE KEYBOARD DRIVER ; ; ADD OURSELVES TO VDA DISPATCH TABLE - LD B,0 ; PHYSICAL UNIT IS ZERO - LD C,VDADEV_VDU ; DEVICE TYPE - LD DE,0 ; UNIT DATA BLOB ADDRESS + LD BC,VDU_DISPATCH ; BC := DISPATCH ADDRESS + LD DE,VDU_IDAT ; DE := VDU INSTANCE DATA PTR CALL VDA_ADDENT ; ADD ENTRY, A := UNIT ASSIGNED ; ; INITIALIZE EMULATION LD C,A ; ASSIGNED VIDEO UNIT IN C LD DE,VDU_DISPATCH ; DE := DISPATCH ADDRESS + LD HL,VDU_IDAT ; HL := VDU INSTANCE DATA PTR CALL TERM_ATTACH ; DO IT XOR A ; SIGNAL SUCCESS @@ -227,14 +243,36 @@ VDU_RDREG: RET ; VDU_RDREGX: - CALL VDU_RDREG ; GET VALUE FROM REGISTER IN C + CALL VDU_RDREG ; GET VALUE FROM REGISTER IN C LD H,A ; SAVE IN H INC C ; BUMP TO NEXT REGISTER OF PAIR - CALL VDU_RDREG ; READ THE VALUE + CALL VDU_RDREG ; READ THE VALUE LD L,A ; SAVE IT IN L RET ; ;---------------------------------------------------------------------- +; PROBE FOR VDU HARDWARE +;---------------------------------------------------------------------- +; +; ON RETURN, ZF SET INDICATES HARDWARE FOUND +; +VDU_PROBE: + ; WRITE TEST PATTERN $A5 $5A TO VRAM ADDRESS POINTER + LD HL,$A55A ; POINT TO FIRST BYTE OF VRAM + LD C,14 ; ADDRESS REGISTER PAIR + CALL VDU_WRREGX ; UPDATE VRAM ADDRESS POINTER + LD C,14 ; ADDRESS REGISTER PAIR + CALL VDU_RDREGX ; READ IT BACK + ; TOP TWO BITS ARE ZEROED IN COMPARE BECAUSE THE CRTC + ; STORES ONLY A 14 BIT VALUE FOR REGISTER PAIR 14/15 + LD A,$A5 & $3F ; FIRST BYTE TEST VALUE + CP H ; COMPARE + RET NZ ; ABORT IF NOT EQUAL + LD A,$5A ; SECOND BYTE TEST VALUE + CP L ; COMPARE + RET ; RETURN WITH COMPARE RESULTS +; +;---------------------------------------------------------------------- ; SY6845 DISPLAY CONTROLLER CHIP INITIALIZATION ;---------------------------------------------------------------------- ; @@ -506,4 +544,13 @@ VDU_INIT6845: ; NEAREST NUMBER OF LINES IS 312 = (R4+1) * (R9+1) + R5. ; 15625 / 312 = 50.08 FIELDS PER SECOND (NEAR ENOUGH-DGG) ; -#INCLUDE "ppk.asm" +; +;================================================================================================== +; VDU DRIVER - INSTANCE DATA +;================================================================================================== +; +VDU_IDAT: + .DB VDU_PPIA + .DB VDU_PPIB + .DB VDU_PPIC + .DB VDU_PPIX diff --git a/Source/HBIOS/vga.asm b/Source/HBIOS/vga.asm new file mode 100644 index 00000000..29d4dd99 --- /dev/null +++ b/Source/HBIOS/vga.asm @@ -0,0 +1,894 @@ +;====================================================================== +; VGA DRIVER FOR RBC PROJECT +; +; WRITTEN BY: WAYNE WARTHEN -- 5/29/2017 +;====================================================================== +; +; TODO: +; +;====================================================================== +; VGA DRIVER - CONSTANTS +;====================================================================== +; +VGA_BASE .EQU $E0 +; +VGA_KBDDATA .EQU VGA_BASE + $00 ; KBD CTLR DATA PORT +VGA_KBDST .EQU VGA_BASE + $01 ; KBD CTLR STATUS/CMD PORT +VGA_REG .EQU VGA_BASE + $02 ; SELECT CRTC REGISTER +VGA_DATA .EQU VGA_BASE + $03 ; READ/WRITE CRTC DATA +VGA_CFG .EQU VGA_BASE + $04 ; VGA3 BOARD CFG REGISTER +VGA_HI .EQU VGA_BASE + $05 ; BOARD RAM HI ADDRESS +VGA_LO .EQU VGA_BASE + $06 ; BOARD RAM LO ADDRESS +VGA_DAT .EQU VGA_BASE + $07 ; BOARD RAM BYTE R/W +; +VGA_ROWS .EQU 25 +VGA_COLS .EQU 80 +; +#DEFINE DEFREGS REGS_VGA +; +TERMENABLE .SET TRUE ; INCLUDE TERMINAL PSEUDODEVICE DRIVER +; +; DRIVER UTILIZES THE MULTIPLE DISPLAY WINDOW FEATURE OF THE CRTC TO ACCOMPLISH +; FULL SCREEN SCROLLING WITHOUT THE NEED TO MOVE DISPLAY RAM BYTES. +; +; SCREEN 1 IMPLICITLY STARTS AT PHYSICAL ROW 0 +; SCREEN 1 RAM ADDRESS POINTER POINTS TO SCREEN OFFSET (R12/R13) +; SCREEN 2 ROW DEFINES WHERE BUFFER BYTE 0 WILL BE DISPLAYED (R18) +; SCREEN 2 RAM ADDRESS IS ALWAYS ZERO (R19/R20) +; +;====================================================================== +; VGA DRIVER - INITIALIZATION +;====================================================================== +; +VGA_INIT: + LD IY,VGA_IDAT ; POINTER TO INSTANCE DATA +; + CALL NEWLINE ; FORMATTING + PRTS("VGA: IO=0x$") + LD A,VGA_REG + CALL PRTHEXBYTE + CALL VGA_PROBE ; CHECK FOR HW PRESENCE + JR Z,VGA_INIT1 ; CONTINUE IF HW PRESENT +; + ; HARDWARE NOT PRESENT + PRTS(" NOT PRESENT$") + OR $FF ; SIGNAL FAILURE + RET +; +VGA_INIT1: + ; DISPLAY CONSOLE DIMENSIONS + LD A,VGA_COLS + CALL PC_SPACE + CALL PRTDECB + LD A,'X' + CALL COUT + LD A,VGA_ROWS + CALL PRTDECB + PRTS(" TEXT$") + + ; HARDWARE INITIALIZATION + CALL VGA_CRTINIT ; SETUP THE VGA CHIP REGISTERS + CALL VGA_LOADFONT ; LOAD FONT DATA FROM ROM TO VGA STRORAGE + CALL VGA_VDARES + CALL KBD_INIT ; INITIALIZE KEYBOARD DRIVER + + ; ADD OURSELVES TO VDA DISPATCH TABLE + LD BC,VGA_DISPATCH ; BC := DISPATCH ADDRESS + LD DE,VGA_IDAT ; DE := VGA INSTANCE DATA PTR + CALL VDA_ADDENT ; ADD ENTRY, A := UNIT ASSIGNED + + ; INITIALIZE EMULATION + LD C,A ; C := ASSIGNED VIDEO DEVICE NUM + LD DE,VGA_DISPATCH ; DE := DISPATCH ADDRESS + LD HL,VGA_IDAT ; HL := VGA INSTANCE DATA PTR + CALL TERM_ATTACH ; DO IT + + XOR A ; SIGNAL SUCCESS + RET +; +;====================================================================== +; VGA DRIVER - VIDEO DISPLAY ADAPTER (VDA) DISPATCHER AND FUNCTIONS +;====================================================================== +; +VGA_DISPATCH: + LD A,B ; GET REQUESTED FUNCTION + AND $0F ; ISOLATE SUB-FUNCTION + + JP Z,VGA_VDAINI ; $40 + DEC A + JP Z,VGA_VDAQRY ; $41 + DEC A + JP Z,VGA_VDARES ; $42 + DEC A + JP Z,VGA_VDADEV ; $43 + DEC A + JP Z,VGA_VDASCS ; $44 + DEC A + JP Z,VGA_VDASCP ; $45 + DEC A + JP Z,VGA_VDASAT ; $46 + DEC A + JP Z,VGA_VDASCO ; $47 + DEC A + JP Z,VGA_VDAWRC ; $48 + DEC A + JP Z,VGA_VDAFIL ; $49 + DEC A + JP Z,VGA_VDACPY ; $4A + DEC A + JP Z,VGA_VDASCR ; $4B + DEC A + JP Z,KBD_STAT ; $4C + DEC A + JP Z,KBD_FLUSH ; $4D + DEC A + JP Z,KBD_READ ; $4E + CALL PANIC + +VGA_VDAINI: + ; RESET VDA + ; CURRENTLY IGNORES VIDEO MODE AND BITMAP DATA + CALL VGA_VDARES ; RESET VDA + XOR A ; SIGNAL SUCCESS + RET + +VGA_VDAQRY: + LD C,$00 ; MODE ZERO IS ALL WE KNOW + LD D,VGA_ROWS ; ROWS + LD E,VGA_COLS ; COLS + LD HL,0 ; EXTRACTION OF CURRENT BITMAP DATA NOT SUPPORTED YET + XOR A ; SIGNAL SUCCESS + RET + +VGA_VDARES: + LD A,$07 ; ATTRIBUTE IS STANDARD WHITE ON BLACK + LD (VGA_ATTR),A ; SAVE IT + XOR A ; ZERO (REVEVERSE, UNDERLINE, BLINK) + LD (VGA_RUB),A ; SAVE IT + + LD DE,0 ; ROW = 0, COL = 0 + CALL VGA_XY ; SEND CURSOR TO TOP LEFT + LD A,' ' ; BLANK THE SCREEN + LD DE,$800 ; FILL ENTIRE BUFFER + CALL VGA_FILL ; DO IT + LD DE,0 ; ROW = 0, COL = 0 + CALL VGA_XY ; SEND CURSOR TO TOP LEFT + + LD HL,$0404 ; SET VIDEO ENABLE BIT + CALL VGA_SETCFG ; DO IT + + XOR A + RET + +VGA_VDADEV: + LD D,VDADEV_VGA ; D := DEVICE TYPE + LD E,0 ; E := PHYSICAL UNIT IS ALWAYS ZERO + XOR A ; SIGNAL SUCCESS + RET + +VGA_VDASCS: + CALL PANIC ; NOT IMPLEMENTED (YET) + +VGA_VDASCP: + CALL VGA_XY ; SET CURSOR POSITION + XOR A ; SIGNAL SUCCESS + RET + +VGA_VDASAT: + ; INCOMING IS: -----RUB (R=REVERSE, U=UNDERLINE, B=BLINK) + ; + ; JUST SAVE THE VALUE AND FALL THROUGH. ONLY REVERSE IS + ; SUPPORTED WHICH IS IMPLEMENTED BELOW. + LD A,E + LD (VGA_RUB),A ; SAVE IT + JR VGA_VDASCO2 ; IMPLEMENT SETTING + +VGA_VDASCO: + ; INCOMING IS: IBGRIBGR (I=INTENSITY, B=BLUE, G=GREEN, R=RED) + ; TRANSFORM TO: -RGBIRGB (DISCARD INTENSITY BIT IN HIGH NIBBLE) + ; + ; A := INVERTED E, SO A IS RGBIRGBI (F/B) + LD B,8 ; DO 8 BITS +VGA_VDASCO1: + RRC E ; LOW BIT OF E ROTATED RIGHT INTO CF + RLA ; CF ROTATED LEFT INTO LOW BIT OF A + DJNZ VGA_VDASCO1 ; DO FOR ALL 8 BITS + ; LS A X 3 TO SWAP F/B BITS, SO A IS IRGBIRGB (B/F) + RLCA + RLCA + RLCA + ; MASK FOR RELEVANT BITS, SO A IS 0R0B0R0B + AND %01010101 + ; SAVE A IN C AND SET A = E + LD C,A + LD A,E + ; MASK FOR RELEVANT BITS, SO A IS 00G0I0G0 + AND %00101010 + ; COMBINE WITH SAVED + OR E + ; SAVE NEW ATTR VALUE + LD (VGA_ATTR),A ; AND SAVE THE RESULT +VGA_VDASCO2: + ; CHECK FOR REVERSE VIDEO + LD A,(VGA_RUB) ; GET RUB SETTING + BIT 2,A ; REVERSE IS BIT 2 + JR Z,VGA_VDASCO3 ; DONE IF REVERSE VID NOT SET + ; IMPLEMENT REVERSE VIDEO + LD A,(VGA_ATTR) ; GET ATTRIBUTE + PUSH AF ; SAVE IT + AND %00001000 ; ISOLATE INTENSITY BIT + LD E,A ; SAVE IN E + POP AF ; GOT ATTR BACK + RLCA ; SWAP FG/BG COLORS + RLCA + RLCA + RLCA + AND %01110111 ; REMOVE HIGH BITS + OR E ; COMBINE WITH PREVIOUS INTENSITY BIT + LD (VGA_ATTR),A ; SAVE NEW VALUE +VGA_VDASCO3: + XOR A ; SIGNAL SUCCESS + RET + +VGA_VDAWRC: + LD A,E ; CHARACTER TO WRITE GOES IN A + CALL VGA_PUTCHAR ; PUT IT ON THE SCREEN + XOR A ; SIGNAL SUCCESS + RET + +VGA_VDAFIL: + LD A,E ; FILL CHARACTER GOES IN A + EX DE,HL ; FILL LENGTH GOES IN DE + CALL VGA_FILL ; DO THE FILL + XOR A ; SIGNAL SUCCESS + RET + +VGA_VDACPY: + ; LENGTH IN HL, SOURCE ROW/COL IN DE, DEST IS VGA_POS + ; BLKCPY USES: HL=SOURCE, DE=DEST, BC=COUNT + PUSH HL ; SAVE LENGTH + CALL VGA_XY2IDX ; ROW/COL IN DE -> SOURCE ADR IN HL + POP BC ; RECOVER LENGTH IN BC + LD DE,(VGA_POS) ; PUT DEST IN DE + JP VGA_BLKCPY ; DO A BLOCK COPY + +VGA_VDASCR: + LD A,E ; LOAD E INTO A + OR A ; SET FLAGS + RET Z ; IF ZERO, WE ARE DONE + PUSH DE ; SAVE E + JP M,VGA_VDASCR1 ; E IS NEGATIVE, REVERSE SCROLL + CALL VGA_SCROLL ; SCROLL FORWARD ONE LINE + POP DE ; RECOVER E + DEC E ; DECREMENT IT + JR VGA_VDASCR ; LOOP +VGA_VDASCR1: + CALL VGA_RSCROLL ; SCROLL REVERSE ONE LINE + POP DE ; RECOVER E + INC E ; INCREMENT IT + JR VGA_VDASCR ; LOOP +; +;====================================================================== +; VGA DRIVER - PRIVATE DRIVER FUNCTIONS +;====================================================================== +; +;---------------------------------------------------------------------- +; SET BOARD CONFIGURATON REGISTER +; MASK IN H, VALUE IN L +;---------------------------------------------------------------------- +; +VGA_SETCFG: + PUSH AF ; PRESERVE AF + LD A,H ; MASK IN ACCUM + CPL ; INVERT IT + LD H,A ; BACK TO H + LD A,(VGA_CFGV) ; GET CURRENT CONFIG VALUE + AND H ; RESET ALL TARGET BITS + OR L ; SET TARGET BITS + LD (VGA_CFGV),A ; SAVE NEW VALUE + OUT (VGA_CFG),A ; AND WRITE IT TO REGISTER + POP AF ; RESTORE AF + RET +; +;---------------------------------------------------------------------- +; UPDATE CRTC REGISTERS +; VGA_REGWR WRITES VALUE IN A TO VDU REGISTER SPECIFIED IN C +;---------------------------------------------------------------------- +; +VGA_REGWR: + PUSH AF ; SAVE VALUE TO WRITE + LD A,C ; SET A TO VGA REGISTER TO SELECT + OUT (VGA_REG),A ; WRITE IT TO SELECT THE REGISTER + POP AF ; RESTORE VALUE TO WRITE + OUT (VGA_DATA),A ; WRITE IT + RET +; +VGA_REGWRX: + LD A,H ; SETUP MSB TO WRITE + CALL VGA_REGWR ; DO IT + INC C ; NEXT CVDU REGISTER + LD A,L ; SETUP LSB TO WRITE + JR VGA_REGWR ; DO IT & RETURN +; +;---------------------------------------------------------------------- +; READ CRTC REGISTERS +; VGA_REGRD READS VDU REGISTER SPECIFIED IN C AND RETURNS VALUE IN A +;---------------------------------------------------------------------- +; +VGA_REGRD: + LD A,C ; SET A TO VGA REGISTER TO SELECT + OUT (VGA_REG),A ; WRITE IT TO SELECT THE REGISTER + IN A,(VGA_DATA) ; READ IT + RET +; +VGA_REGRDX: + CALL VGA_REGRD ; GET VALUE FROM REGISTER IN C + LD H,A ; SAVE IN H + INC C ; BUMP TO NEXT REGISTER OF PAIR + CALL VGA_REGRD ; READ THE VALUE + LD L,A ; SAVE IT IN L + RET +; +;---------------------------------------------------------------------- +; WRITE VIDEO RAM +; VGA_MEMWR WRITES VALUE IN A TO ADDRESS IN DE +; VGA_MEMWRX WRITES VALUE IN HL TO ADDRESS IN DE +;---------------------------------------------------------------------- +; +VGA_MEMWR: + LD C,VGA_HI + OUT (C),D + INC C + OUT (C),E + INC C + OUT (C),A + RET +; +VGA_MEMWRX: + LD C,VGA_HI + OUT (C),D + INC C + OUT (C),E + INC C + OUT (C),H + INC E + DEC C + OUT (C),E + INC C + OUT (C),L + DEC E + RET +; +;---------------------------------------------------------------------- +; READ VIDEO RAM +; VGA_MEMRD READS VALUE IN DE TO A +; VGA_MEMRDX READS VALUE IN DE TO HL +;---------------------------------------------------------------------- +; +VGA_MEMRD: + LD C,VGA_HI + OUT (C),D + INC C + OUT (C),E + INC C + IN A,(C) + RET +; +VGA_MEMRDX: + LD C,VGA_HI + OUT (C),D + INC C + OUT (C),E + INC C + IN H,(C) + INC E + DEC C + OUT (C),E + INC C + IN L,(C) + DEC E + RET +; +;---------------------------------------------------------------------- +; WAIT FOR VERTICAL RETRACE ACTIVE +;---------------------------------------------------------------------- +; +VGA_WAITSB: + LD A,31 ; CRTC REG 31 IS STATUS REG + OUT (VGA_REG),A ; SETUP TO ACCESS IT +VGA_WAITSB1: + IN A,(VGA_DATA) ; GET STATUS + BIT 1,A ; TEST SB BIT (RETRACE ACTIVE) + RET NZ ; RETURN IF ACTIVE + JR VGA_WAITSB1 ; LOOP +; +;---------------------------------------------------------------------- +; PROBE FOR VGA HARDWARE +;---------------------------------------------------------------------- +; +; ON RETURN, ZF SET INDICATES HARDWARE FOUND +; +VGA_PROBE: + LD DE,0 ; POINT TO FIRST BYTE OF VRAM + LD A,$A5 ; INITIAL TEST VALUE + LD B,A ; SAVE IN B + CALL VGA_MEMWR ; WRITE IT + INC E ; NEXT BYTE OF VRAM + CPL ; INVERT TEST VALUE + CALL VGA_MEMWR ; WRITE IT + DEC E ; BACK TO FIRST BYTE OF VRAM + CALL VGA_MEMRD ; READ IT + CP B ; CHECK FOR TEST VALUE + RET NZ ; RETURN NZ IF FAILURE + INC E ; SECOND VRAM BYTE + CALL VGA_MEMRD ; READ IT + CPL ; INVERT IT + CP B ; CHECK FOR INVERTED TEST VALUE + RET ; RETURN WITH ZF SET BASED ON CP +; +;---------------------------------------------------------------------- +; CRTC DISPLAY CONTROLLER CHIP INITIALIZATION +;---------------------------------------------------------------------- +; +VGA_CRTINIT: + LD HL,$FF00 ; ZERO ALL CFG BITS + CALL VGA_SETCFG ; DO IT + + CALL VGA_RES ; RESET CRTC (ALL REGS TO ZERO) + + LD HL,DEFREGS ; HL = POINTER TO TABLE OF REG VALUES +VGA_CRTINIT1: + LD A,(HL) ; FIRST BYTE IS REG ADR + LD C,A ; PUT IN C FOR LATER + INC A ; TEST FOR END MARKER ($FF) + RET Z ; IF EQUAL, DONE + INC HL ; NEXT BYTE + LD A,(HL) ; SECOND BYTE IS REG VAL + INC HL ; HL TO NEXT ENTRY + CALL VGA_REGWR ; WRITE REGISTER VALUE + JR VGA_CRTINIT1 ; LOOP +; +VGA_RES: + LD C,0 ; START WITH REG ZERO + LD B,40 ; CLEAR 40 REGISTERS +VGA_RES1: + XOR A ; VALUE IS ZERO + CALL VGA_REGWR ; SET VALUE + INC C ; NEXT REGISTER + DJNZ VGA_RES1 ; LOOP TILL DONE + RET ; DONE +; +VGA_CRTCDUMP: + LD C,0 ; START WITH REG ZERO + LD B,40 ; CLEAR 40 REGISTERS +VGA_CRTCDUMP1: + CALL VGA_REGRD ; SET VALUE + CALL PRTHEXBYTE + CALL PC_SPACE + INC C ; NEXT REGISTER + DJNZ VGA_CRTCDUMP1 ; LOOP TILL DONE + RET ; DONE +; +;---------------------------------------------------------------------- +; LOAD FONT DATA +;---------------------------------------------------------------------- +; +VGA_LOADFONT: + LD HL,$7000 ; CLEAR FONT PAGE NUM + CALL VGA_SETCFG + + LD DE,$7000 ; PAGE 7 OF VIDEO RAM + LD HL,FONT_HI ; START OF FONT DATA +VGA_LOADFONT1: + LD A,(HL) ; GET NEXT BYTE + CALL VGA_MEMWR ; MEM(DE) := A + INC HL ; NEXT FONT BYTE + INC DE ; NEXT MEM BYTE + LD A,D + CP $80 ; CHECK FOR END + JR NZ,VGA_LOADFONT1 ; LOOP + LD HL,$7070 ; SET FONT PAGE NUM TO 7 + CALL VGA_SETCFG + RET ; DONE +; +;---------------------------------------------------------------------- +; SET CURSOR POSITION TO ROW IN D AND COLUMN IN E +;---------------------------------------------------------------------- +; +VGA_XY: + CALL VGA_XY2IDX ; CONVERT ROW/COL TO BUF IDX + LD (VGA_POS),HL ; SAVE THE RESULT (DISPLAY POSITION) + LD C,14 ; CURSOR POSITION REGISTER PAIR + JP VGA_REGWRX ; DO IT AND RETURN +; +;---------------------------------------------------------------------- +; CONVERT XY COORDINATES IN DE INTO LINEAR INDEX IN HL +; D=ROW, E=COL +;---------------------------------------------------------------------- +; +VGA_XY2IDX: + LD A,E ; SAVE COLUMN NUMBER IN A + LD H,D ; SET H TO ROW NUMBER + LD E,VGA_COLS ; SET E TO ROW LENGTH + CALL MULT8 ; MULTIPLY TO GET ROW OFFSET + LD E,A ; GET COLUMN BACK + ADD HL,DE ; ADD IT IN + + LD DE,(VGA_OFF) ; SCREEN OFFSET + ADD HL,DE ; ADJUST +; + PUSH HL ; SAVE IT + LD DE,VGA_ROWS * VGA_COLS ; DE := BUF SIZE + OR A ; CLEAR CARRY + SBC HL,DE ; SUBTRACT FROM HL + JR C,VGA_XY2IDX1 ; BYPASS IF NO WRAP + POP DE ; THROW AWAY TOS + RET ; DONE +VGA_XY2IDX1: + POP HL ; NO WRAP, RESTORE + RET ; RETURN +; +;---------------------------------------------------------------------- +; WRITE VALUE IN A TO CURRENT VDU BUFFER POSTION, ADVANCE CURSOR +;---------------------------------------------------------------------- +; +VGA_PUTCHAR: + ; SETUP DE WITH BUFFER ADDRESS + LD DE,(VGA_POS) ; GET CURRENT POSITION + SLA E ; MULTIPLY BY 2 + RL D ; ... 2 BYTES PER CHAR + ; SETUP CHAR/ATTR IN HL + LD H,A ; CHARACTER + LD A,(VGA_ATTR) ; ATTRIBUTE + LD L,A ; ... TO L + ; WRITE CHAR & ATTR + ;CALL VGA_WAITSB ; WAIT FOR RETRACE + CALL VGA_MEMWRX + ; UPDATE CURRENT POSITION + LD HL,(VGA_POS) ; GET CURSOR POSITION + INC HL ; INCREMENT +; + PUSH HL ; SAVE IT + LD DE,VGA_ROWS * VGA_COLS ; DE := BUF SIZE + OR A ; CLEAR CARRY + SBC HL,DE ; SUBTRACT FROM HL + JR C,VGA_PUTCHAR1 ; BYPASS IF NO WRAP + POP DE ; THROW AWAY TOS + JR VGA_PUTCHAR2 ; CONTINUE +VGA_PUTCHAR1: + POP HL ; NO WRAP, RESTORE +VGA_PUTCHAR2: + LD (VGA_POS),HL ; SAVE NEW POSITION + LD C,14 ; CURSOR POSITION REGISTER PAIR + JP VGA_REGWRX ; DO IT AND RETURN +; +;---------------------------------------------------------------------- +; FILL AREA IN BUFFER WITH SPECIFIED CHARACTER AND CURRENT COLOR/ATTRIBUTE +; STARTING AT THE CURRENT FRAME BUFFER POSITION +; A: FILL CHARACTER +; DE: NUMBER OF CHARACTERS TO FILL +;---------------------------------------------------------------------- +; +VGA_FILL: + LD B,A ; CACHE FILL CHAR IN B + + ; SETUP HL WITH INITIAL BUFFER ADDRESS + LD HL,(VGA_POS) ; GET CURRENT POSITION + SLA L ; MULTIPLY BY 2 + RL H ; ... 2 BYTES PER CHAR + +VGA_FILL1: + ; FILL ONE POSITION (CHAR & ATTR) + LD C,VGA_HI ; C := VGA ADR HI + OUT (C),H ; SET HI ADDR + INC C ; C := VGA ADR LO + OUT (C),L ; SET LO ADDR + INC C ; POINT TO DATA REG + OUT (C),B ; OUTPUT FILL CHAR + INC L ; BUMP ADDR (ONLY NEED TO DO LOW BYTE) + DEC C ; C := VGA ADDR LO + OUT (C),L ; UDPATE LO ADDR + INC C ; POINT TO DATA REG + ;CALL VGA_WAITSB ; WAIT FOR RETRACE + LD A,(VGA_ATTR) ; GET CUR ATTR + OUT (C),A ; OUTPUT ATTR + + ; CHECK COUNT + DEC DE ; DECREMENT COUNT + LD A,D ; TEST FOR + OR E ; ... ZERO + RET Z ; DONE IF SO + + ; BUMP BUFFER ADDRESS WITH POSSIBLE WRAP + INC HL ; NEXT POSITION + LD A,0 + (VGA_ROWS * VGA_COLS * 2) & $FF + CP L ; TEST LOW BYTE + JR NZ,VGA_FILL1 ; IF NOT EQ, NO WRAP, LOOP + LD A,0 + ((VGA_ROWS * VGA_COLS * 2) >> 8) & $FF + CP H ; TEST HI BYTE + JR NZ,VGA_FILL1 ; IF NOT EQ, NO WRAP, LOOP + LD HL,0 ; WRAP! + JR VGA_FILL1 ; AND LOOP +; +;---------------------------------------------------------------------- +; SCROLL ENTIRE SCREEN FORWARD BY ONE LINE (CURSOR POSITION UNCHANGED) +;---------------------------------------------------------------------- +; +VGA_SCROLL: + ; CLEAR TOP LINE WHICH IS ABOUT TO BECOME NEW LINE + ; AT BOTTOM OF SCREEN + LD DE,(VGA_POS) ; GET CURRENT POS + PUSH DE ; SAVE IT + LD DE,(VGA_OFF) ; TOP OF SCREEN IS OFFSET VALUE + LD (VGA_POS),DE ; SET POS + LD DE,VGA_COLS ; CLEAR ONE ROW + LD A,' ' ; WITH BLANKS + CALL VGA_FILL ; DO IT + POP DE ; GET ORIG POS VALUE BACK + LD (VGA_POS),DE ; AND SAVE IT +; + ; OFF += ROWLEN, IF OFF >= BUFSIZ, ADR := 0 + LD HL,(VGA_OFF) ; CURRENT SCREEN OFFSET + LD A,VGA_COLS ; ROW LENGTH + CALL ADDHLA ; BUMP TO NEXT ROW + PUSH HL ; SAVE IT + LD DE,VGA_ROWS * VGA_COLS ; DE := BUF SIZE + OR A ; CLEAR CARRY + SBC HL,DE ; SUBTRACT FROM HL + JR C,VGA_SCROLL1 + LD HL,0 ; WRAP AROUND TO 0 + POP DE ; THROW AWAY TOS + JR VGA_SCROLL2 ; CONTINUE +VGA_SCROLL1: + POP HL ; NO WRAP, RESTORE +VGA_SCROLL2: + LD (VGA_OFF),HL ; SAVE IT + CALL VGA_WAITSB + LD C,12 ; SCREEN 1 ADDRESS + CALL VGA_REGWRX ; COMMIT +; + ; S2ROW--, IF S2ROW < 0, THEN S2ROW := MAXROW + LD A,(VGA_S2ROW) ; CURRENT S2 ROW + OR A ; = 0? + JR Z,VGA_SCROLL3 ; IF 0, WRAP + DEC A ; DECREMENT + JR VGA_SCROLL4 ; AND CONTINUE +VGA_SCROLL3: + LD A,VGA_ROWS - 1 ; WRAP BACK TO MAX ROW +VGA_SCROLL4: + LD (VGA_S2ROW),A ; SAVE IT + DEC A ; ADJUST + LD C,18 ; S2 ROW REG + CALL VGA_REGWR ; COMMIT +; + ; POS += ROWLEN; IF POS >= BUFSIZ, POS -= BUFSIZ + LD HL,(VGA_POS) ; CURRENT POSITION + LD A,VGA_COLS ; ROW LENGTH + CALL ADDHLA ; BUMP TO NEXT ROW + PUSH HL ; SAVE IT + LD DE,VGA_ROWS * VGA_COLS ; DE := BUF SIZE + OR A ; CLEAR CARRY + SBC HL,DE ; SUBTRACT FROM HL + JR C,VGA_SCROLL5 ; BYPASS IF NO WRAP + POP DE ; THROW AWAY TOS + JR VGA_SCROLL6 ; CONTINUE +VGA_SCROLL5: + POP HL ; NO WRAP, RESTORE +VGA_SCROLL6: + LD (VGA_POS),HL ; SAVE IT + LD C,14 ; CURSOR 1 POS REG + CALL VGA_REGWRX ; COMMIT + + RET +; +;---------------------------------------------------------------------- +; REVERSE SCROLL ENTIRE SCREEN BY ONE LINE (CURSOR POSITION UNCHANGED) +;---------------------------------------------------------------------- +; +VGA_RSCROLL: + ; OFF -= ROWLEN, IF OFF < 0, OFF := MAXROW ((ROWS - 1) * COLS) + LD HL,(VGA_OFF) ; CURRENT SCREEN OFFSET + LD DE,VGA_COLS ; SUBTRACT ONE ROW + SBC HL,DE ; DO IT + JR NC,VGA_RSCROLL1 ; IF NOT NEGATIVE, CONTINUE + LD HL,0 + ((VGA_ROWS - 1) * VGA_COLS) +VGA_RSCROLL1: + LD (VGA_OFF),HL ; SAVE IT + CALL VGA_WAITSB ; WAIT FOR RETRACE + LD C,12 ; SCREEN 1 ADDRESS + CALL VGA_REGWRX ; COMMIT +; + ; S2ROW++, IF S2ROW >= ROWS, THEN S2ROW := 0 + LD A,(VGA_S2ROW) ; CURRENT S2 ROW + INC A ; BUMP TO NEXT ROW + CP VGA_ROWS ; COMPARE TO ROWS + JR C,VGA_RSCROLL2 ; IF NOT >= ROWS, CONTINUE + XOR A ; SET TO ZERO +VGA_RSCROLL2: + LD (VGA_S2ROW),A ; SAVE IT + DEC A ; ADJUST + LD C,18 ; S2 ROW REG + CALL VGA_REGWR ; COMMIT +; + ; POS -= ROWLEN; IF POS < 0, POS += BUFSIZ + LD HL,(VGA_POS) ; CURRENT SCREEN OFFSET + LD DE,VGA_COLS ; SUBTRACT ONE ROW + OR A ; CLEAR CARRY + SBC HL,DE ; DO IT + JR NC,VGA_RSCROLL3 ; IF NOT NEGATIVE, CONTINUE + LD DE,VGA_ROWS * VGA_COLS ; DE := BUF SIZE + ADD HL,DE ; ADD TO HL +VGA_RSCROLL3: + LD (VGA_POS),HL ; SAVE IT + LD C,14 ; CURSOR 1 POS REG + CALL VGA_REGWRX ; COMMIT +; + ; CLEAR TOP LINE JUST EXPOSED + LD DE,(VGA_POS) ; GET CURRENT POS + PUSH DE ; SAVE IT + LD DE,(VGA_OFF) ; TOP OF SCREEN IS OFFSET VALUE + LD (VGA_POS),DE ; SET POS + LD DE,VGA_COLS ; CLEAR ONE ROW + LD A,' ' ; WITH BLANKS + CALL VGA_FILL ; DO IT + POP DE ; GET ORIG POS VALUE BACK + LD (VGA_POS),DE ; AND SAVE IT +; + RET +; +;---------------------------------------------------------------------- +; BLOCK COPY BC BYTES FROM HL TO DE +;---------------------------------------------------------------------- +; +VGA_BLKCPY: + ; DOUBLE BC TO ACCOUNT FOR 2 BYTE ENTRIES (CHAR & ATTR) + SLA C + RL B + PUSH BC ; COUNT ==> TOS + + ; ADJUST HL & DE FOR SCREEN OFFSET/WRAP + CALL VGA_BLKCPY4 ; DO HL + EX DE,HL ; SWAP + CALL VGA_BLKCPY4 ; DO OTHER + EX DE,HL ; SWAP BACK + +VGA_BLKCPY1: + ;CALL VGA_WAITSB ; WAIT FOR RETRACE + + ; GET NEXT SOURCE BYTE + LD C,VGA_HI ; C := VGA_HI + OUT (C),H ; VGA_HI := SOURCE HI (H) + INC C ; C := VGA_LO + OUT (C),L ; VGA_LO := SOURCE LO (L) + INC C ; C := VGA_DATA + IN A,(C) ; A := (HL) + + ; COPY TO DESTINATION + LD C,VGA_HI ; C := VGA_HI + OUT (C),D ; VGA_HI := SOURCE HI (H) + INC C ; C := VGA_LO + OUT (C),E ; VGA_LO := SOURCE LO (L) + INC C ; C := VGA_DATA + OUT (C),A ; (DE) := A + + ; BUMP SOURCE ADDRESS WITH POSSIBLE WRAP + INC HL ; NEXT POSITION + LD A,0 + (VGA_ROWS * VGA_COLS * 2) & $FF + CP L ; TEST LOW BYTE + JR NZ,VGA_BLKCPY2 ; IF NOT EQ, NO WRAP, CONTINUE + LD A,0 + ((VGA_ROWS * VGA_COLS * 2) >> 8) & $FF + CP H ; TEST HI BYTE + JR NZ,VGA_BLKCPY2 ; IF NOT EQ, NO WRAP, CONTINUE + LD HL,0 ; WRAP! + +VGA_BLKCPY2: + ; BUMP DEST ADDRESS WITH POSSIBLE WRAP + INC DE ; NEXT POSITION + LD A,0 + (VGA_ROWS * VGA_COLS * 2) & $FF + CP E ; TEST LOW BYTE + JR NZ,VGA_BLKCPY3 ; IF NOT EQ, NO WRAP, CONTINUE + LD A,0 + ((VGA_ROWS * VGA_COLS * 2) >> 8) & $FF + CP D ; TEST HI BYTE + JR NZ,VGA_BLKCPY3 ; IF NOT EQ, NO WRAP, CONTINUE + LD DE,0 ; WRAP! + +VGA_BLKCPY3: + ; DECREMENT BYTE COUNT AND CHECK FOR COMPLETION + EX (SP),HL ; GET COUNT, SAVE HL + DEC HL ; DECREMENT + LD A,H ; TEST FOR + CP L ; ... ZERO + EX (SP),HL ; COUNT BACK TO TOS, RESTORE HL + JR NZ,VGA_BLKCPY1 ; LOOP IF NOT ZERO + POP BC ; CLEAN UP STACK + RET ; DONE +; +VGA_BLKCPY4: + ; SUBROUTINE TO ADJUST FOR SCREEN OFFSET/WRAP + PUSH DE ; SAVE DE + LD DE,(VGA_OFF) ; CUR SCRN OFFSET + ;ADD HL,DE ; ADJUST FOR OFFSET + SLA L ; MULTIPLY BY 2 + RL H ; ... FOR TWO BYTES PER ENTRY + PUSH HL ; SAVE IT + LD DE,VGA_ROWS * VGA_COLS * 2 ; DE := BUF SIZE + OR A ; CLEAR CARRY + SBC HL,DE ; SUBTRACT FROM HL + JR C,VGA_BLKCPY4A ; BYPASS IF NO WRAP + POP DE ; THROW AWAY TOS + JR VGA_BLKCPY4B ; CONTINUE +VGA_BLKCPY4A: + POP HL ; NO WRAP, RESTORE +VGA_BLKCPY4B: + POP DE ; RESTORE DE + RET +; +;================================================================================================== +; VGA DRIVER - DATA +;================================================================================================== +; +VGA_ATTR .DB 0 ; CURRENT COLOR +VGA_POS .DW 0 ; CURRENT DISPLAY POSITION +VGA_OFF .DW 0 ; SCREEN START OFFSET INTO CRTC RAM +VGA_S2ROW .DB 0 ; CURRENT S2 ROW +VGA_CFGV .DB 0 ; CURRENT BOARD CONFIG VALUE +VGA_RUB .DB 0 ; REVERSE/UNDERLINE/BLINK (-----RUB) +; +; ATTRIBUTE ENCODING: +; BIT 7: ALT FONT +; BIT 6: BG REG +; BIT 5: BG GREEN +; BIT 4: BG BLUE +; BIT 3: FG INTENSITY +; BIT 2: FG RED +; BIT 1: FG GREEN +; BIT 0: FG BLUE +; +;=============================================================================== +; DEFAULT REGISTER VALUES +;=============================================================================== +; +REGS_VGA: + .DB 0,100 - 1 ; HORZ TOT - 1 + .DB 1,80 ; HORZ DISP + .DB 2,80 + 2 ; HORZ DISP + HORZ FP + .DB 3,(2 << 4) | (12 & $0F) ; VERT SW, HORZ SW + .DB 4,28 - 1 ; VERT TOT - 1 + .DB 5,1 ; VERT TOT ADJ + .DB 6,25 ; VERT DISP + .DB 7,25 + 1 ; VERT DISP + VERT FP + .DB 9,16 - 1 ; CHAR HEIGHT - 1 + .DB 10,(13 | $60) ; CURSOR START & CURSOR BLINK + .DB 11,14 ; CURSOR END + .DB 12,($0000 >> 8) & $FF ; SCRN 1 START (HI) + .DB 13,($0000 & $FF) ; SCRN 1 START (LO) + .DB 18,-1 ; S2 ROW - 1 + .DB 30,$01 ; CONTROL 1, ENABLE 2 WINDOWS + .DB 31,0 ; CONTROL 2 + .DB 33,0 ; CONTROL 3 + + + .DB $FF ; END MARKER +; +;================================================================================================== +; VGA DRIVER - INSTANCE DATA +;================================================================================================== +; +VGA_IDAT: + .DB VGA_KBDST + .DB VGA_KBDDATA + + + + +; PUSH BC +; PUSH DE +; POP BC +; CALL PC_SPACE +; CALL PRTHEXWORD +; POP BC + + + + + diff --git a/Source/HBIOS/vga_old.asm b/Source/HBIOS/vga_old.asm new file mode 100644 index 00000000..ce807594 --- /dev/null +++ b/Source/HBIOS/vga_old.asm @@ -0,0 +1,773 @@ +;====================================================================== +; VGA DRIVER FOR RBC PROJECT +; +; WRITTEN BY: WAYNE WARTHEN -- 5/29/2017 +;====================================================================== +; +; TODO: +; +;====================================================================== +; VGA DRIVER - CONSTANTS +;====================================================================== +; +VGA_BASE .EQU $E0 +; +VGA_KBDDATA .EQU VGA_BASE + $00 ; KBD CTLR DATA PORT +VGA_KBDST .EQU VGA_BASE + $01 ; KBD CTLR STATUS/CMD PORT +VGA_REG .EQU VGA_BASE + $02 ; SELECT CRTC REGISTER +VGA_DATA .EQU VGA_BASE + $03 ; READ/WRITE CRTC DATA +VGA_CFG .EQU VGA_BASE + $04 ; VGA3 BOARD CFG REGISTER +VGA_HI .EQU VGA_BASE + $05 ; BOARD RAM HI ADDRESS +VGA_LO .EQU VGA_BASE + $06 ; BOARD RAM LO ADDRESS +VGA_DAT .EQU VGA_BASE + $07 ; BOARD RAM BYTE R/W +; +VGA_ROWS .EQU 25 +VGA_COLS .EQU 80 +; +#DEFINE DEFREGS REGS_VGA +; +TERMENABLE .SET TRUE ; INCLUDE TERMINAL PSEUDODEVICE DRIVER +; +;====================================================================== +; VGA DRIVER - INITIALIZATION +;====================================================================== +; +VGA_INIT: + LD IY,VGA_IDAT ; POINTER TO INSTANCE DATA +; + CALL NEWLINE ; FORMATTING + PRTS("VGA: IO=0x$") + LD A,VGA_REG + CALL PRTHEXBYTE + CALL VGA_PROBE ; CHECK FOR HW PRESENCE + JR Z,VGA_INIT1 ; CONTINUE IF HW PRESENT +; + ; HARDWARE NOT PRESENT + PRTS(" NOT PRESENT$") + OR $FF ; SIGNAL FAILURE + RET +; +VGA_INIT1: + ; DISPLAY CONSOLE DIMENSIONS + LD A,VGA_COLS + CALL PC_SPACE + CALL PRTDECB + LD A,'X' + CALL COUT + LD A,VGA_ROWS + CALL PRTDECB + PRTS(" TEXT$") + + ; HARDWARE INITIALIZATION + CALL VGA_CRTINIT ; SETUP THE VGA CHIP REGISTERS + CALL VGA_LOADFONT ; LOAD FONT DATA FROM ROM TO VGA STRORAGE + CALL VGA_VDARES + CALL KBD_INIT ; INITIALIZE KEYBOARD DRIVER + + ; ADD OURSELVES TO VDA DISPATCH TABLE + LD BC,VGA_DISPATCH ; BC := DISPATCH ADDRESS + LD DE,VGA_IDAT ; DE := VGA INSTANCE DATA PTR + CALL VDA_ADDENT ; ADD ENTRY, A := UNIT ASSIGNED + + ; INITIALIZE EMULATION + LD C,A ; C := ASSIGNED VIDEO DEVICE NUM + LD DE,VGA_DISPATCH ; DE := DISPATCH ADDRESS + LD HL,VGA_IDAT ; HL := VGA INSTANCE DATA PTR + CALL TERM_ATTACH ; DO IT + + XOR A ; SIGNAL SUCCESS + RET +; +;====================================================================== +; VGA DRIVER - VIDEO DISPLAY ADAPTER (VDA) DISPATCHER AND FUNCTIONS +;====================================================================== +; +VGA_DISPATCH: + LD A,B ; GET REQUESTED FUNCTION + AND $0F ; ISOLATE SUB-FUNCTION + + JP Z,VGA_VDAINI ; $40 + DEC A + JP Z,VGA_VDAQRY ; $41 + DEC A + JP Z,VGA_VDARES ; $42 + DEC A + JP Z,VGA_VDADEV ; $43 + DEC A + JP Z,VGA_VDASCS ; $44 + DEC A + JP Z,VGA_VDASCP ; $45 + DEC A + JP Z,VGA_VDASAT ; $46 + DEC A + JP Z,VGA_VDASCO ; $47 + DEC A + JP Z,VGA_VDAWRC ; $48 + DEC A + JP Z,VGA_VDAFIL ; $49 + DEC A + JP Z,VGA_VDACPY ; $4A + DEC A + JP Z,VGA_VDASCR ; $4B + DEC A + JP Z,KBD_STAT ; $4C + DEC A + JP Z,KBD_FLUSH ; $4D + DEC A + JP Z,KBD_READ ; $4E + CALL PANIC + +VGA_VDAINI: + ; RESET VDA + ; CURRENTLY IGNORES VIDEO MODE AND BITMAP DATA + CALL VGA_VDARES ; RESET VDA + XOR A ; SIGNAL SUCCESS + RET + +VGA_VDAQRY: + LD C,$00 ; MODE ZERO IS ALL WE KNOW + LD D,VGA_ROWS ; ROWS + LD E,VGA_COLS ; COLS + LD HL,0 ; EXTRACTION OF CURRENT BITMAP DATA NOT SUPPORTED YET + XOR A ; SIGNAL SUCCESS + RET + +VGA_VDARES: + LD A,$07 ; ATTRIBUTE IS STANDARD WHITE ON BLACK + LD (VGA_ATTR),A ; SAVE IT + XOR A ; ZERO (REVEVERSE, UNDERLINE, BLINK) + LD (VGA_RUB),A ; SAVE IT + + LD DE,0 ; ROW = 0, COL = 0 + CALL VGA_XY ; SEND CURSOR TO TOP LEFT + LD A,' ' ; BLANK THE SCREEN + LD DE,$800 ; FILL ENTIRE BUFFER + CALL VGA_FILL ; DO IT + LD DE,0 ; ROW = 0, COL = 0 + CALL VGA_XY ; SEND CURSOR TO TOP LEFT + + LD HL,$0404 ; SET VIDEO ENABLE BIT + CALL VGA_SETCFG ; DO IT + + XOR A + RET + +VGA_VDADEV: + LD D,VDADEV_VGA ; D := DEVICE TYPE + LD E,0 ; E := PHYSICAL UNIT IS ALWAYS ZERO + XOR A ; SIGNAL SUCCESS + RET + +VGA_VDASCS: + CALL PANIC ; NOT IMPLEMENTED (YET) + +VGA_VDASCP: + CALL VGA_XY ; SET CURSOR POSITION + XOR A ; SIGNAL SUCCESS + RET + +VGA_VDASAT: + ; INCOMING IS: -----RUB (R=REVERSE, U=UNDERLINE, B=BLINK) + ; + ; JUST SAVE THE VALUE AND FALL THROUGH. ONLY REVERSE IS + ; SUPPORTED WHICH IS IMPLEMENTED BELOW. + LD A,E + LD (VGA_RUB),A ; SAVE IT + JR VGA_VDASCO2 ; IMPLEMENT SETTING + +VGA_VDASCO: + ; INCOMING IS: IBGRIBGR (I=INTENSITY, B=BLUE, G=GREEN, R=RED) + ; TRANSFORM TO: -RGBIRGB (DISCARD INTENSITY BIT IN HIGH NIBBLE) + ; + ; A := INVERTED E, SO A IS RGBIRGBI (F/B) + LD B,8 ; DO 8 BITS +VGA_VDASCO1: + RRC E ; LOW BIT OF E ROTATED RIGHT INTO CF + RLA ; CF ROTATED LEFT INTO LOW BIT OF A + DJNZ VGA_VDASCO1 ; DO FOR ALL 8 BITS + ; LS A X 3 TO SWAP F/B BITS, SO A IS IRGBIRGB (B/F) + RLCA + RLCA + RLCA + ; MASK FOR RELEVANT BITS, SO A IS 0R0B0R0B + AND %01010101 + ; SAVE A IN C AND SET A = E + LD C,A + LD A,E + ; MASK FOR RELEVANT BITS, SO A IS 00G0I0G0 + AND %00101010 + ; COMBINE WITH SAVED + OR E + ; SAVE NEW ATTR VALUE + LD (VGA_ATTR),A ; AND SAVE THE RESULT +VGA_VDASCO2: + ; CHECK FOR REVERSE VIDEO + LD A,(VGA_RUB) ; GET RUB SETTING + BIT 2,A ; REVERSE IS BIT 2 + JR Z,VGA_VDASCO3 ; DONE IF REVERSE VID NOT SET + ; IMPLEMENT REVERSE VIDEO + LD A,(VGA_ATTR) ; GET ATTRIBUTE + PUSH AF ; SAVE IT + AND %00001000 ; ISOLATE INTENSITY BIT + LD E,A ; SAVE IN E + POP AF ; GOT ATTR BACK + RLCA ; SWAP FG/BG COLORS + RLCA + RLCA + RLCA + AND %01110111 ; REMOVE HIGH BITS + OR E ; COMBINE WITH PREVIOUS INTENSITY BIT + LD (VGA_ATTR),A ; SAVE NEW VALUE +VGA_VDASCO3: + XOR A ; SIGNAL SUCCESS + RET + +VGA_VDAWRC: + LD A,E ; CHARACTER TO WRITE GOES IN A + CALL VGA_PUTCHAR ; PUT IT ON THE SCREEN + XOR A ; SIGNAL SUCCESS + RET + +VGA_VDAFIL: + LD A,E ; FILL CHARACTER GOES IN A + EX DE,HL ; FILL LENGTH GOES IN DE + CALL VGA_FILL ; DO THE FILL + XOR A ; SIGNAL SUCCESS + RET + +VGA_VDACPY: + ; LENGTH IN HL, SOURCE ROW/COL IN DE, DEST IS VGA_POS + ; BLKCPY USES: HL=SOURCE, DE=DEST, BC=COUNT + PUSH HL ; SAVE LENGTH + CALL VGA_XY2IDX ; ROW/COL IN DE -> SOURCE ADR IN HL + POP BC ; RECOVER LENGTH IN BC + LD DE,(VGA_POS) ; PUT DEST IN DE + JP VGA_BLKCPY ; DO A BLOCK COPY + +VGA_VDASCR: + LD A,E ; LOAD E INTO A + OR A ; SET FLAGS + RET Z ; IF ZERO, WE ARE DONE + PUSH DE ; SAVE E + JP M,VGA_VDASCR1 ; E IS NEGATIVE, REVERSE SCROLL + CALL VGA_SCROLL ; SCROLL FORWARD ONE LINE + POP DE ; RECOVER E + DEC E ; DECREMENT IT + JR VGA_VDASCR ; LOOP +VGA_VDASCR1: + CALL VGA_RSCROLL ; SCROLL REVERSE ONE LINE + POP DE ; RECOVER E + INC E ; INCREMENT IT + JR VGA_VDASCR ; LOOP +; +;====================================================================== +; VGA DRIVER - PRIVATE DRIVER FUNCTIONS +;====================================================================== +; +;---------------------------------------------------------------------- +; SET BOARD CONFIGURATON REGISTER +; MASK IN H, VALUE IN L +;---------------------------------------------------------------------- +; +VGA_SETCFG: + PUSH AF ; PRESERVE AF + LD A,H ; MASK IN ACCUM + CPL ; INVERT IT + LD H,A ; BACK TO H + LD A,(VGA_CFGV) ; GET CURRENT CONFIG VALUE + AND H ; RESET ALL TARGET BITS + OR L ; SET TARGET BITS + LD (VGA_CFGV),A ; SAVE NEW VALUE + OUT (VGA_CFG),A ; AND WRITE IT TO REGISTER + POP AF ; RESTORE AF + RET +; +;---------------------------------------------------------------------- +; UPDATE CRTC REGISTERS +; VGA_REGWR WRITES VALUE IN A TO VDU REGISTER SPECIFIED IN C +;---------------------------------------------------------------------- +; +VGA_REGWR: + PUSH AF ; SAVE VALUE TO WRITE + LD A,C ; SET A TO VGA REGISTER TO SELECT + OUT (VGA_REG),A ; WRITE IT TO SELECT THE REGISTER + POP AF ; RESTORE VALUE TO WRITE + OUT (VGA_DATA),A ; WRITE IT + RET +; +VGA_REGWRX: + LD A,H ; SETUP MSB TO WRITE + CALL VGA_REGWR ; DO IT + INC C ; NEXT CVDU REGISTER + LD A,L ; SETUP LSB TO WRITE + JR VGA_REGWR ; DO IT & RETURN +; +;---------------------------------------------------------------------- +; READ CRTC REGISTERS +; VGA_REGRD READS VDU REGISTER SPECIFIED IN C AND RETURNS VALUE IN A +;---------------------------------------------------------------------- +; +VGA_REGRD: + LD A,C ; SET A TO VGA REGISTER TO SELECT + OUT (VGA_REG),A ; WRITE IT TO SELECT THE REGISTER + IN A,(VGA_DATA) ; READ IT + RET +; +VGA_REGRDX: + CALL VGA_REGRD ; GET VALUE FROM REGISTER IN C + LD H,A ; SAVE IN H + INC C ; BUMP TO NEXT REGISTER OF PAIR + CALL VGA_REGRD ; READ THE VALUE + LD L,A ; SAVE IT IN L + RET +; +;---------------------------------------------------------------------- +; WRITE VIDEO RAM +; VGA_MEMWR WRITES VALUE IN A TO ADDRESS IN DE +; VGA_MEMWRX WRITES VALUE IN HL TO ADDRESS IN DE +;---------------------------------------------------------------------- +; +VGA_MEMWR: + LD C,VGA_HI + OUT (C),D + INC C + OUT (C),E + INC C + OUT (C),A + RET +; +VGA_MEMWRX: + LD C,VGA_HI + OUT (C),D + INC C + OUT (C),E + INC C + OUT (C),H + INC E + DEC C + OUT (C),E + INC C + OUT (C),L + DEC E + RET +; +;---------------------------------------------------------------------- +; READ VIDEO RAM +; VGA_MEMRD READS VALUE IN DE TO A +; VGA_MEMRDX READS VALUE IN DE TO HL +;---------------------------------------------------------------------- +; +VGA_MEMRD: + LD C,VGA_HI + OUT (C),D + INC C + OUT (C),E + INC C + IN A,(C) + RET +; +VGA_MEMRDX: + LD C,VGA_HI + OUT (C),D + INC C + OUT (C),E + INC C + IN H,(C) + INC E + DEC C + OUT (C),E + INC C + IN L,(C) + DEC E + RET +; +;---------------------------------------------------------------------- +; PROBE FOR VGA HARDWARE +;---------------------------------------------------------------------- +; +; ON RETURN, ZF SET INDICATES HARDWARE FOUND +; +VGA_PROBE: + LD DE,0 ; POINT TO FIRST BYTE OF VRAM + LD A,$A5 ; INITIAL TEST VALUE + LD B,A ; SAVE IN B + CALL VGA_MEMWR ; WRITE IT + INC E ; NEXT BYTE OF VRAM + CPL ; INVERT TEST VALUE + CALL VGA_MEMWR ; WRITE IT + DEC E ; BACK TO FIRST BYTE OF VRAM + CALL VGA_MEMRD ; READ IT + CP B ; CHECK FOR TEST VALUE + RET NZ ; RETURN NZ IF FAILURE + INC E ; SECOND VRAM BYTE + CALL VGA_MEMRD ; READ IT + CPL ; INVERT IT + CP B ; CHECK FOR INVERTED TEST VALUE + RET ; RETURN WITH ZF SET BASED ON CP +; +;---------------------------------------------------------------------- +; CRTC DISPLAY CONTROLLER CHIP INITIALIZATION +;---------------------------------------------------------------------- +; +VGA_CRTINIT: + LD HL,$FF00 ; ZERO ALL CFG BITS + CALL VGA_SETCFG ; DO IT + + CALL VGA_RES ; RESET CRTC (ALL REGS TO ZERO) + + LD HL,DEFREGS ; HL = POINTER TO TABLE OF REG VALUES +VGA_CRTINIT1: + LD A,(HL) ; FIRST BYTE IS REG ADR + LD C,A ; PUT IN C FOR LATER + INC A ; TEST FOR END MARKER ($FF) + RET Z ; IF EQUAL, DONE + INC HL ; NEXT BYTE + LD A,(HL) ; SECOND BYTE IS REG VAL + INC HL ; HL TO NEXT ENTRY + CALL VGA_REGWR ; WRITE REGISTER VALUE + JR VGA_CRTINIT1 ; LOOP +; +VGA_RES: + LD C,0 ; START WITH REG ZERO + LD B,40 ; CLEAR 40 REGISTERS +VGA_RES1: + XOR A ; VALUE IS ZERO + CALL VGA_REGWR ; SET VALUE + INC C ; NEXT REGISTER + DJNZ VGA_RES1 ; LOOP TILL DONE + RET ; DONE +; +VGA_CRTCDUMP: + LD C,0 ; START WITH REG ZERO + LD B,40 ; CLEAR 40 REGISTERS +VGA_CRTCDUMP1: + CALL VGA_REGRD ; SET VALUE + CALL PRTHEXBYTE + CALL PC_SPACE + INC C ; NEXT REGISTER + DJNZ VGA_CRTCDUMP1 ; LOOP TILL DONE + RET ; DONE +; +;---------------------------------------------------------------------- +; LOAD FONT DATA +;---------------------------------------------------------------------- +; +VGA_LOADFONT: + LD HL,$7000 ; CLEAR FONT PAGE NUM + CALL VGA_SETCFG + + LD DE,$7000 ; PAGE 7 OF VIDEO RAM + LD HL,FONT_HI ; START OF FONT DATA +VGA_LOADFONT1: + LD A,(HL) ; GET NEXT BYTE + CALL VGA_MEMWR ; MEM(DE) := A + INC HL ; NEXT FONT BYTE + INC DE ; NEXT MEM BYTE + LD A,D + CP $80 ; CHECK FOR END + JR NZ,VGA_LOADFONT1 ; LOOP + LD HL,$7070 ; SET FONT PAGE NUM TO 7 + CALL VGA_SETCFG + RET ; DONE +; +;---------------------------------------------------------------------- +; SET CURSOR POSITION TO ROW IN D AND COLUMN IN E +;---------------------------------------------------------------------- +; +VGA_XY: + CALL VGA_XY2IDX ; CONVERT ROW/COL TO BUF IDX + LD (VGA_POS),HL ; SAVE THE RESULT (DISPLAY POSITION) + LD C,14 ; CURSOR POSITION REGISTER PAIR + JP VGA_REGWRX ; DO IT AND RETURN +; +;---------------------------------------------------------------------- +; CONVERT XY COORDINATES IN DE INTO LINEAR INDEX IN HL +; D=ROW, E=COL +;---------------------------------------------------------------------- +; +VGA_XY2IDX: + LD A,E ; SAVE COLUMN NUMBER IN A + LD H,D ; SET H TO ROW NUMBER + LD E,VGA_COLS ; SET E TO ROW LENGTH + CALL MULT8 ; MULTIPLY TO GET ROW OFFSET + LD E,A ; GET COLUMN BACK + ADD HL,DE ; ADD IT IN + RET ; RETURN +; +;---------------------------------------------------------------------- +; WRITE VALUE IN A TO CURRENT VDU BUFFER POSTION, ADVANCE CURSOR +;---------------------------------------------------------------------- +; +VGA_PUTCHAR: + ; SETUP DE WITH BUFFER ADDRESS + LD DE,(VGA_POS) ; GET CURRENT POSITION + RL E ; MULTIPLY BY 2 + RL D ; ... 2 BYTES PER CHAR + ; SETUP CHAR/ATTR IN HL + LD H,A ; CHARACTER + LD A,(VGA_ATTR) ; ATTRIBUTE + LD L,A ; ... TO L + ; WRITE CHAR & ATTR + CALL VGA_MEMWRX + ; UPDATE CURRENT POSITION + LD HL,(VGA_POS) ; GET CURSOR POSITION + INC HL ; INCREMENT + LD (VGA_POS),HL ; SAVE NEW POSITION + LD C,14 ; CURSOR POSITION REGISTER PAIR + JP VGA_REGWRX ; DO IT AND RETURN +; +;---------------------------------------------------------------------- +; FILL AREA IN BUFFER WITH SPECIFIED CHARACTER AND CURRENT COLOR/ATTRIBUTE +; STARTING AT THE CURRENT FRAME BUFFER POSITION +; A: FILL CHARACTER +; DE: NUMBER OF CHARACTERS TO FILL +;---------------------------------------------------------------------- +; +VGA_FILL: + PUSH DE ; COUNT ON STACK + LD H,A ; H = CHAR + LD A,(VGA_ATTR) ; GET CUR ATTR + LD L,A ; PUT INT L + + ; SETUP DE WITH INITIAL BUFFER ADDRESS + LD DE,(VGA_POS) ; GET CURRENT POSITION + RL E ; MULTIPLY BY 2 + RL D ; ... 2 BYTES PER CHAR + LD C,VGA_HI + +VGA_FILL1: + OUT (C),D ; SET HI ADDR + INC C ; POINT TO LO ADDR REG + +VGA_FILL2: + EX (SP),HL ; HL = COUNT, SAVE CHAR/ATTR + LD A,H ; CHECK FOR + OR L ; ... ZERO + JR Z,VGA_FILL3 ; ALL DONE + DEC HL ; DEC COUNT + EX (SP),HL ; HL = CHAR/ATTR, COUNT ON STACK + + + OUT (C),E ; SET LO ADDR + INC C ; POINT TO DATA REG + + OUT (C),H ; OUTPUT CHAR + INC E ; INC ADDR + DEC C ; POINT TO LO ADDR REG + OUT (C),E ; UPDATE LO ADDR + INC C ; POINT TO DATA REG + OUT (C),L ; OUTPUT ATTR + + DEC C ; POINT TO LO ADDR REG + INC E ; INC ADDR LO + JR NZ,VGA_FILL2 ; IF NO CF, SHORT LOOP + + DEC C ; POINT TO HI ADDR REG + INC D ; INC ADDR HI + JR VGA_FILL1 ; FULL LOOP + +VGA_FILL3: + POP DE ; CLEAR STACK + RET +; +;---------------------------------------------------------------------- +; SCROLL ENTIRE SCREEN FORWARD BY ONE LINE (CURSOR POSITION UNCHANGED) +;---------------------------------------------------------------------- +; +VGA_SCROLL: + ; CLEAR LINE ABOUT TO BE EXPOSED + LD DE,(VGA_POS) + PUSH DE + LD DE,0 + (VGA_ROWS * VGA_COLS) + LD (VGA_POS),DE + LD DE,VGA_COLS + LD A,' ' + CALL VGA_FILL + POP DE + LD (VGA_POS),DE + + ; USE BLOCK COPY TO SCROLL UP ONE LINE + LD HL,VGA_COLS + LD DE,0 + LD BC,0 + ((VGA_ROWS) * VGA_COLS) + CALL VGA_BLKCPY + + RET +; +;---------------------------------------------------------------------- +; REVERSE SCROLL ENTIRE SCREEN BY ONE LINE (CURSOR POSITION UNCHANGED) +;---------------------------------------------------------------------- +; +VGA_RSCROLL: + ; USE BLOCK COPY TO SCROLL DOWN ONE LINE + LD HL,0 + ((VGA_ROWS - 1) * VGA_COLS) - 1 ; SRC IS EOS - 1 LINE + LD DE,0 + ((VGA_ROWS) * VGA_COLS) - 1 ; DEST IS EOS + LD BC,0 + ((VGA_ROWS - 1) * VGA_COLS) ; LENGTH IS ROWS - 1 + CALL VGA_RBLKCPY + + ; CLEAR TOP LINE + LD DE,(VGA_POS) + PUSH DE + LD DE,0 + LD (VGA_POS),DE + LD DE,VGA_COLS + LD A,' ' + CALL VGA_FILL + POP DE + LD (VGA_POS),DE + + RET +; +;---------------------------------------------------------------------- +; BLOCK COPY BC BYTES FROM HL TO DE +;---------------------------------------------------------------------- +; +VGA_BLKCPY: + ; ADJUST POINTERS FOR 2 BYTE WIDTH (CHAR & ATTR) + RL E + RL D + RL L + RL H + +VGA_BLKCPY1: + + PUSH BC ; SAVE COUNT + + ; BA = (HL), HL INCREMENTED + LD C,VGA_HI ; C := VGA_HI + OUT (C),H ; VGA_HI := SOURCE HI (H) + INC C ; C := VGA_LO + OUT (C),L ; VGA_LO := SOURCE LO (L) + INC C ; C := VGA_DATA + IN B,(C) ; B := EVEN DATA BYTE (CHAR) + INC HL ; INC SOURCE PTR + DEC C ; C := VGA_LO + OUT (C),L ; VGA_LO := SOURCE LO (L), VGA_HI IS UNCHANGED! + INC C ; C := VGA_DATA + IN A,(C) ; A := ODD DATA BYTE (ATTR) + INC HL ; INC SOURCE PTR + + ; (DE) = BA, DE INCREMENTED + LD C,VGA_HI ; C := VGA_HI + OUT (C),D ; VGA_HI := DEST HI (D) + INC C ; C := VGA_LO + OUT (C),E ; VGA_LO := DEST LO (E) + INC C ; C := VGA_DATA + OUT (C),B ; EVEN DATA BYTE (CHAR) := B + INC DE ; INC DEST PTR + DEC C ; C := VGA_LO + OUT (C),E ; VGA_LO := DEST LO (E), VGA_HI IS UNCHANGED + INC C ; C := VGA_DATA + OUT (C),A ; ODD DATA BYTE (ATTR) := A + INC DE ; INC DEST PTR + + ; CHECK COUNT AND LOOP TILL DONE + POP BC ; RECOVER COUNT + DEC BC ; DEC COUNT + LD A,B ; CHECK COUNT + OR C ; ... FOR ZERO + JR NZ,VGA_BLKCPY1 ; LOOP TILL DONE + + RET ; DONE +; +VGA_RBLKCPY: + ; ADJUST POINTERS FOR 2 BYTE WIDTH (CHAR & ATTR) + RL E + RL D + RL L + RL H + + ; ADJUST TO POINT TO SECOND BYTE OF PAIR (ATTR) + INC E + INC L + +VGA_RBLKCPY1: + + PUSH BC ; SAVE COUNT + + ; BA = (HL), HL INCREMENTED + LD C,VGA_HI ; C := VGA_HI + OUT (C),H ; VGA_HI := SOURCE HI (H) + INC C ; C := VGA_LO + OUT (C),L ; VGA_LO := SOURCE LO (L) + INC C ; C := VGA_DATA + IN A,(C) ; A := ODD DATA BYTE (ATTR) + DEC HL ; DEC SOURCE PTR + DEC C ; C := VGA_LO + OUT (C),L ; VGA_LO := SOURCE LO (L), VGA_HI IS UNCHANGED! + INC C ; C := VGA_DATA + IN B,(C) ; B := EVEN DATA BYTE (CHAR) + DEC HL ; DEC SOURCE PTR + + ; (DE) = BA, DE INCREMENTED + LD C,VGA_HI ; C := VGA_HI + OUT (C),D ; VGA_HI := DEST HI (D) + INC C ; C := VGA_LO + OUT (C),E ; VGA_LO := DEST LO (E) + INC C ; C := VGA_DATA + OUT (C),A ; ODD DATA BYTE (ATTR) := A + DEC DE ; DEC DEST PTR + DEC C ; C := VGA_LO + OUT (C),E ; VGA_LO := DEST LO (E), VGA_HI IS UNCHANGED + INC C ; C := VGA_DATA + OUT (C),B ; EVEN DATA BYTE (CHAR) := B + DEC DE ; DEC DEST PTR + + ; CHECK COUNT AND LOOP TILL DONE + POP BC ; RECOVER COUNT + DEC BC ; DEC COUNT + LD A,B ; CHECK COUNT + OR C ; ... FOR ZERO + JR NZ,VGA_RBLKCPY1 ; LOOP TILL DONE + + RET ; DONE +; +;================================================================================================== +; VGA DRIVER - DATA +;================================================================================================== +; +VGA_ATTR .DB 0 ; CURRENT COLOR +VGA_POS .DW 0 ; CURRENT DISPLAY POSITION +VGA_CFGV .DB 0 ; CURRENT BOARD CONFIG VALUE +VGA_RUB .DB 0 ; REVERSE/UNDERLINE/BLINK (-----RUB) +; +; ATTRIBUTE ENCODING: +; BIT 7: ALT FONT +; BIT 6: BG REG +; BIT 5: BG GREEN +; BIT 4: BG BLUE +; BIT 3: FG INTENSITY +; BIT 2: FG RED +; BIT 1: FG GREEN +; BIT 0: FG BLUE +; +;=============================================================================== +; DEFAULT REGISTER VALUES +;=============================================================================== +; +REGS_VGA: + .DB 0,100 - 1 ; HORZ TOT - 1 + .DB 1,80 ; HORZ DISP + .DB 2,80 + 2 ; HORZ DISP + HORZ FP + .DB 3,(2 << 4) | (12 & $0F) ; VERT SW, HORZ SW + .DB 4,28 - 1 ; VERT TOT - 1 + .DB 5,1 ; VERT TOT ADJ + .DB 6,25 ; VERT DISP + .DB 7,25 + 1 ; VERT DISP + VERT FP + .DB 9,16 - 1 ; CHAR HEIGHT - 1 + .DB 10,(13 | $60) ; CURSOR START & CURSOR BLINK + .DB 11,14 ; CURSOR END + .DB 12,($0000 >> 8) & $FF ; SCRN 1 START (HI) + .DB 13,($0000 & $FF) ; SCRN 1 START (LO) + .DB 30,0 ; CONTROL 1 + .DB 31,0 ; CONTROL 2 + .DB 33,0 ; CONTROL 3 + .DB $FF ; END MARKER +; +;================================================================================================== +; VGA DRIVER - INSTANCE DATA +;================================================================================================== +; +VGA_IDAT: + .DB VGA_KBDST + .DB VGA_KBDDATA diff --git a/Source/Images/BuildFD.cmd b/Source/Images/BuildFD.cmd index d04878d9..b251f23e 100644 --- a/Source/Images/BuildFD.cmd +++ b/Source/Images/BuildFD.cmd @@ -1 +1 @@ -@PowerShell .\BuildFD.ps1 %* \ No newline at end of file +@PowerShell -ExecutionPolicy Unrestricted .\BuildFD.ps1 %* \ No newline at end of file diff --git a/Source/Images/BuildHD.cmd b/Source/Images/BuildHD.cmd index 8352803d..c7db537e 100644 --- a/Source/Images/BuildHD.cmd +++ b/Source/Images/BuildHD.cmd @@ -1 +1 @@ -@PowerShell .\BuildHD.ps1 %* \ No newline at end of file +@PowerShell -ExecutionPolicy Unrestricted .\BuildHD.ps1 %* \ No newline at end of file diff --git a/Source/Images/cpmtools.cmd b/Source/Images/cpmtools.cmd deleted file mode 100644 index cfa4d321..00000000 --- a/Source/Images/cpmtools.cmd +++ /dev/null @@ -1,5 +0,0 @@ -@echo off -setlocal -set PATH=%CD%\Tools\cpmtools;%PATH% -set PROMPT=[CPM Tools] %PROMPT% -%ComSpec% /K diff --git a/Source/Images/fd0/u0/NULU.COM b/Source/Images/fd0/u0/NULU.COM index fc5594b1..3d45098a 100644 Binary files a/Source/Images/fd0/u0/NULU.COM and b/Source/Images/fd0/u0/NULU.COM differ diff --git a/Source/Images/fd1/u0/NULU.COM b/Source/Images/fd1/u0/NULU.COM index fc5594b1..3d45098a 100644 Binary files a/Source/Images/fd1/u0/NULU.COM and b/Source/Images/fd1/u0/NULU.COM differ diff --git a/Source/Images/hd0/s0/u0/NULU.COM b/Source/Images/hd0/s0/u0/NULU.COM index fc5594b1..3d45098a 100644 Binary files a/Source/Images/hd0/s0/u0/NULU.COM and b/Source/Images/hd0/s0/u0/NULU.COM differ diff --git a/Source/Images/hd0/s1/u0/NULU.COM b/Source/Images/hd0/s1/u0/NULU.COM index fc5594b1..3d45098a 100644 Binary files a/Source/Images/hd0/s1/u0/NULU.COM and b/Source/Images/hd0/s1/u0/NULU.COM differ diff --git a/Source/Images/hd1/s0/u0/TEST.TXT b/Source/Images/hd1/s0/u0/TEST.TXT deleted file mode 100644 index 8318c86b..00000000 --- a/Source/Images/hd1/s0/u0/TEST.TXT +++ /dev/null @@ -1 +0,0 @@ -Test \ No newline at end of file diff --git a/Source/ReadMe.txt b/Source/ReadMe.txt new file mode 100644 index 00000000..0bcf8061 --- /dev/null +++ b/Source/ReadMe.txt @@ -0,0 +1,620 @@ +*********************************************************************** +*** *** +*** R o m W B W *** +*** *** +*** Z80/Z180 System Software *** +*** *** +*********************************************************************** + +This directory is the root directory for the source tree for RomWBW. + +This document describes the process to build a customized version +of the RomWBW firmware. RomWBW was explicitly organized in a way +that makes it very easy to rebuild the firmware. + +Significant customization can be achieved with a custom built +firmware using simple option configuration files. You can +customize your firmware to: + + - Include support for add-on support boards such as + the DiskIO, Dual-IDE, etc. + - Modify operational parameters such as serial port + speed or wait state insertion. + - Add or remove programs or files contained on the ROM disk. + +Thought not necessary, advanced users can easily modify any of +the software including the operating systems. + +A cross-platform approach is used to build the RomWBW firmware. +The software is built using a Microsoft Windows computer, then the +resulting firmware image is programmed into the ROM of your +RetroBrew Computer CPU board. + +Build System Requirements +------------------------- + +All that is required to build the firmware is a computer running +Microsoft Windows and the RomWBW distribution zip archive file. +The zip archive includes all of the required source code +(including the operating systems) and the programs required to run +the build. + +The build process is run via some simple scripts that automate the +process. These scripts utilize both batch command files as well as +Windows PowerShell. All versions of Microsoft Windows starting with +Vista include PowerShell and will run the build process with no +addtional programs required. Either 32 or 64 bit versions of +Microsoft Windows are fine. + +Process Overview +---------------- + +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) Program the resultant ROM image and try it. + +It is *not* necessary to perform steps 1 or 2 before running a +build. In fact, I strongly recommend that you perform steps 3 and +4 initially to make sure that you have no issues building and +programming a ROM that works the same as a pre-built ROM. + +Each of the 4 steps above is described in more detail below. + +1. Create/Update Configuration File +----------------------------------- + +The options for a build are primarily controled by a configuration +file that is included in the build process. In order to customize +your settings, it is easiest to make a copy of an existing +configuration file and make your changes there. + +Configuration files are found in the Source\HBIOS\Config +directory. If you look in the this directory, you will see a +series of files named _.asm where refers to the +CPU board in your system and is used to name the specific +configuration so you can maintain multiple configurations. + +You will notice that there is initially one configuration file for +each CPU platform with a name of "std". For example, you there is +a file called MK4_std.asm. This is the standard ("std") +configuration for a Mark IV CPU board. + +The platform names are predefined. Refer to the following table +to determine the component of the configuration filename: + + 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 can use any name you choose for the component of the +configuration filename. So, let's say you want to create a custom +ROM for the Mark IV. You would simply copy "MK4_std.asm" to +something like "MK4_cust.asm". + +Now, just edit the new file ("MK4_cust.asm" in this example) as +desired. + +You will see that the file already has lines for all of the common +options and there is a comment after each option indicating the +possible values. + +In our example, let's say you have added a Dual-IDE board to your +Mark IV system and want to include floppy support. You will see a +couple lines similar to these in the config file: + +FDENABLE .SET FALSE ; TRUE FOR FLOPPY DEVICE SUPPORT +FDMODE .SET FDMODE_DIDE ; FDMODE_DIO, FDMODE_DIDE, FDMODE_DIO3 + +To enable floppy support, you would just change FDENABLE to TRUE: + +FDENABLE .SET TRUE ; TRUE FOR FLOPPY DEVICE SUPPORT + +Since FDMODE is already set to FDMODE_DIDE, it is correct as is. +If instead, you had added a DiskIO V3 board and wanted to use it +for floppy support, you would also change FDMODE to +FDMODE_FDMODE_DIO3: + +FDMODE .SET FDMODE_DIO3 ; FDMODE_DIO, FDMODE_DIDE, FDMODE_DIO3 + +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. + +These directories are already populated in the distribution. You do +not need to do anything unless you want to change the files that are +included in the ROM Disk. + +In summary, the ROM Disk imbedded in the ROM firmware you build, +will include the files from the ROM_512KB directory (or the +ROM_1024KB directory if building a 1024KB firmware). +Additionally, files will be added from the directory associated +with the platform specified in the ROM Build. + +There is a ReadMe.txt document in the \Source\RomDsk directory +with a more detailed description of this process. + +3. Run the Build Process +------------------------ + +The build involves running commands at the command prompt. Open a +command prompt window for the Source directory. If you unzipped +the distribution to "C:\", then your command prompt should look +like this: + + C:\RomWBW\Source> + +Now run the first of two commands, the BuildShared command: + + C:\RomWBW\Source> BuildShared + +This command will run a series of commands that generate the +software which is "shared" by all ROM builds. It is normal to +have some lines indicating a warning like the following. This is +normal and expected. + + ++ Warning: program origin NOT at 100H ++ + +A sample run of the BuildShared command is provided later in this +document. + +Now run the second command, the BuildROM command: + + C:\RomWBW\Source> BuildROM + +This command will prompt you twice as it runs. These prompts +determine the platform and configuration to be built. The first +prompt is for the platform, as shown below: + + Platform [SBC|ZETA|ZETA2|N8|MK4|UNA]: + +Enter the option corresponding to the platform of the ROM firmware +you are building. If you enter something other than one of the +possible options, the prompt will be repeated until you provide an +acceptable response. + +Next, you will be prompted for the specific configuration of the +platform to be built. The options presented will be based on the +configuration files in the Config directory. So, if you have made +a copy of the MK4_std.asm config and called it MK4_cust.asm, you +would see a prompt like this: + + Configurations available: + > std + > cust + Configuration: + +Enter one of the configuration options to build a ROM with the +associated config file. + +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. + +A sample run of the BuildROM command is provided later in this +document. + +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: + + HBIOS PROXY STACK space: 38 bytes. + HBIOS INT space remaining: 82 bytes. + DSRTC occupies 423 bytes. + UART occupies 716 bytes. + ASCI occupies 580 bytes. + MD occupies 451 bytes. + IDE occupies 1276 bytes. + SD occupies 2191 bytes. + HBIOS space remaining: 21434 bytes. + +4. Deploy the ROM +----------------- + +Upon completion of a successful build, you should find the +resulting firmware in the Binary directory. These output files +will have names that match the config filename, but will different +extensions. + +Three output files will be created for a single BuildROM run: + + _.rom - binary ROM image to burn to EEPROM + _.com - executable version of the system image + that can be copied via X-Modem to a + running system to test the build. + _.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. Simply burn the .rom image to your ROM and install +it in your hardware. The process for programming your ROM depends +on your hardware, but the .rom file is in a pure binary format (it +is not hex encoded). + +Refer to the document ReadMe.txt in the Binary directory for more +information on the other two file extensions created. + +Specifying Build Options on Command Line +---------------------------------------- + +If you don't want to be prompted for the options to the "BuildROM" +command, you can specify the options right on the command line. + +For example: + + C:\RomWBW\Source> BuildROM MK4 cust + +In this case, you will not be prompted. This is useful if you +wish to automate your build process. + +There is a third parameter that you can specify to the BuildROM +command via a command line. If you want to build a 1024K (1MB) +ROM, you can add "1024" to the end of the line, like this: + + C:\RomWBW\Source> BuildROM MK4 cust 1024 + +Special Build Commands +---------------------- + +You may notice there are a few additional Build*.cmd files in the +Source directory. They are not used or required for building ROM +firmware. Their purpose is described below: + +BuildHardware: Some of the RetroBrew Computer support boards + require onboard firmware separate from the CPU + board firmware. For the most part, this is the + Propeller-based boards (ParPortProp and PropIO). + This build script generates the firmware for these + boards. + +BuildImages: RomWBW has the ability to create floppy disk and hard + disk images for use on systems running the RomWBW + firmware. This script allows you to place the files + you want on a CP/M floppy or hard disk in a directory + and will turn them into a writable disk image. Refer + to the ReadMe.txt document in the Source\Images + directory for a detailed description of this process. + +BuildBP: This command builds another OS variant called BPBIOS. It + is a work in progress and should not be used at this time + without contacting Wayne Warthen. + +BuildDoc: This command is used to build a new generation of RomWBW + documentation based on LaTeX. This is also a work in + progress and requires LaTeX be installed on your Windows + computer. It is not intended for use at this time. + +Example BuildShared Run +----------------------- + +C:\RomWBW\Source> BuildShared + +Building SysCopy... +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 Assign... +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 Format... +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 Talk... +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 OSLdr... +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 + +Z80ASM Copyright (C) 1983-86 by SLR Systems Rel. 1.32 #AB1234 + + SYSGEN/F +End of file Pass 1 +End of file Pass 2 + 0 Error(s) Detected. + 1132 Absolute Bytes. 80 Symbols Detected. + + + +Building ccpb03... +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 bdosb01... +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 +CP/M MACRO ASSEM 2.0 +D7F2 +00BH USE FACTOR +END OF ASSEMBLY + +MLOAD v25 Copyright (c) 1983, 1984, 1985, 1988 +by NightOwl Software, Inc. +Loaded 1887 bytes (075FH) to file P0:CCP.BIN +Start address: D000H Ending address: D7BAH Bias: 0000H +Saved image size: 2048 bytes (0800H, - 16 records) + +++ Warning: program origin NOT at 100H ++ + +CP/M MACRO ASSEM 2.0 +E5EE +017H USE FACTOR +END OF ASSEMBLY + +MLOAD v25 Copyright (c) 1983, 1984, 1985, 1988 +by NightOwl Software, Inc. +Loaded 3453 bytes (0D7DH) to file P0:BDOS.BIN +Start address: D800H Ending address: E5B2H Bias: 0000H +Saved image size: 3584 bytes (0E00H, - 28 records) + +++ Warning: program origin NOT at 100H ++ + +CP/M MACRO ASSEM 2.0 +D7F2 +008H USE FACTOR +END OF ASSEMBLY + +MLOAD v25 Copyright (c) 1983, 1984, 1985, 1988 +by NightOwl Software, Inc. +Loaded 1906 bytes (0772H) to file P0:CCP22.BIN +Start address: D000H Ending address: D7CCH Bias: 0000H +Saved image size: 2048 bytes (0800H, - 16 records) + +++ Warning: program origin NOT at 100H ++ + +CP/M MACRO ASSEM 2.0 +E633 +012H USE FACTOR +END OF ASSEMBLY + +MLOAD v25 Copyright (c) 1983, 1984, 1985, 1988 +by NightOwl Software, Inc. +Loaded 3518 bytes (0DBEH) to file P0:BDOS22.BIN +Start address: D800H Ending address: E5EDH Bias: 0000H +Saved image size: 3584 bytes (0E00H, - 28 records) + +++ Warning: program origin NOT at 100H ++ + +CP/M MACRO ASSEM 2.0 +D7F2 +00BH USE FACTOR +END OF ASSEMBLY + +MLOAD v25 Copyright (c) 1983, 1984, 1985, 1988 +by NightOwl Software, Inc. +Loaded 1887 bytes (075FH) to file P0:OS2CCP.BIN +Start address: D000H Ending address: D7BAH Bias: 0000H +Saved image size: 2048 bytes (0800H, - 16 records) + +++ Warning: program origin NOT at 100H ++ + +CP/M MACRO ASSEM 2.0 +E5EE +017H USE FACTOR +END OF ASSEMBLY + +MLOAD v25 Copyright (c) 1983, 1984, 1985, 1988 +by NightOwl Software, Inc. +Loaded 3453 bytes (0D7DH) to file P0:OS3BDOS.BIN +Start address: D800H Ending address: E5B2H Bias: 0000H +Saved image size: 3584 bytes (0E00H, - 28 records) + +++ Warning: program origin NOT at 100H ++ + +CP/M MACRO ASSEM 2.0 +D7EF +00EH USE FACTOR +END OF ASSEMBLY + +MLOAD v25 Copyright (c) 1983, 1984, 1985, 1988 +by NightOwl Software, Inc. +Loaded 1888 bytes (0760H) to file P0:ZCPR.BIN +Start address: D000H Ending address: D7EEH Bias: 0000H +Saved image size: 2048 bytes (0800H, - 16 records) + +++ Warning: program origin NOT at 100H ++ + +CP/M MACRO ASSEM 2.0 +01B3 +000H USE FACTOR +END OF ASSEMBLY + +MLOAD v25 Copyright (c) 1983, 1984, 1985, 1988 +by NightOwl Software, Inc. +Loaded 179 bytes (00B3H) to file P0:BDLOC.COM +Start address: 0100H Ending address: 01B2H Bias: 0000H +Saved image size: 256 bytes (0100H, - 2 records) + + +No Fatal error(s) + + +Link-80 3.44 09-Dec-81 Copyright (c) 1981 Microsoft + +Data 0100 08F7 < 2039> + +51779 Bytes Free +[0000 08F7 8] + + + +ZMAC Relocating Macro Assembler v 1.7, 04/09/93 + Copyright 1988,1989 by A.E. Hawley + + + P0:ZSDOS.Z80 assembled with NO ERRORS + +..To produce: + +P0:ZSDOS.REL, P0:ZSDOS.PRN + +Source Lines 3345 Unused Memory 7995H +Labels 429 Total Code Size 0DF6H +Macros -Read none + -Expanded none + + === SEGMENT SIZES === + +ASEG =empty CSEG =0DF6H DSEG =empty BLANK =empty + + Named COMMON segments + +_BIOS_ +LINK 1.31 + +/_BIOS_/ E600 + +ABSOLUTE 0000 +CODE SIZE 0E00 (D800-E5FF) +DATA SIZE 0000 +COMMON SIZE 0000 +USE FACTOR 1C + + +Building CBIOS for RomWBW... + +TASM Z80 Assembler. Version 3.2 September, 2001. + Copyright (C) 2001 Squak Valley Software +tasm: pass 1 complete. +CBIOS extension info occupies 6 bytes. +UTIL occupies 485 bytes. +INIT code slack space: 2924 bytes. +HEAP space: 4450 bytes. +CBIOS total space used: 6144 bytes. +tasm: pass 2 complete. +tasm: Number of errors = 0 + +Building CBIOS for UNA... + +TASM Z80 Assembler. Version 3.2 September, 2001. + Copyright (C) 2001 Squak Valley Software +tasm: pass 1 complete. +CBIOS extension info occupies 6 bytes. +UTIL occupies 485 bytes. +INIT code slack space: 2909 bytes. +HEAP space: 4263 bytes. +CBIOS total space used: 6400 bytes. +tasm: pass 2 complete. +tasm: Number of errors = 0 + +Example BuildROM Run +----------------------- + +C:\RomWBW\Source> BuildROM +Platform [SBC|ZETA|ZETA2|N8|MK4|UNA]: MK4 +Configurations available: + > std + > cust +Configuration: cust + +Building MK4_cust: 512KB ROM configuration cust for Z180... + +tasm -t180 -g3 dbgmon.asm dbgmon.bin dbgmon.lst +TASM Z180 Assembler. Version 3.2 September, 2001. + Copyright (C) 2001 Squak Valley Software +tasm: pass 1 complete. +DBGMON space remaining: 1533 bytes. +tasm: pass 2 complete. +tasm: Number of errors = 0 +tasm -t180 -g3 prefix.asm prefix.bin prefix.lst +TASM Z180 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 -t180 -g3 romldr.asm romldr.bin romldr.lst +TASM Z180 Assembler. Version 3.2 September, 2001. + Copyright (C) 2001 Squak Valley Software +tasm: pass 1 complete. +LOADER space remaining: 1217 bytes. +tasm: pass 2 complete. +tasm: Number of errors = 0 +tasm -t180 -g3 -dROMBOOT hbios.asm hbios_rom.bin hbios_rom.lst +TASM Z180 Assembler. Version 3.2 September, 2001. + Copyright (C) 2001 Squak Valley Software +tasm: pass 1 complete. +HBIOS PROXY STACK space: 38 bytes. +HBIOS INT space remaining: 82 bytes. +DSRTC occupies 423 bytes. +UART occupies 716 bytes. +ASCI occupies 580 bytes. +MD occupies 451 bytes. +IDE occupies 1276 bytes. +SD occupies 2191 bytes. +HBIOS space remaining: 21454 bytes. +tasm: pass 2 complete. +tasm: Number of errors = 0 +tasm -t180 -g3 -dAPPBOOT hbios.asm hbios_app.bin hbios_app.lst +TASM Z180 Assembler. Version 3.2 September, 2001. + Copyright (C) 2001 Squak Valley Software +tasm: pass 1 complete. +HBIOS PROXY STACK space: 38 bytes. +HBIOS INT space remaining: 82 bytes. +DSRTC occupies 423 bytes. +UART occupies 716 bytes. +ASCI occupies 580 bytes. +MD occupies 451 bytes. +IDE occupies 1276 bytes. +SD occupies 2191 bytes. +HBIOS space remaining: 21434 bytes. +tasm: pass 2 complete. +tasm: Number of errors = 0 +tasm -t180 -g3 -dIMGBOOT hbios.asm hbios_img.bin hbios_img.lst +TASM Z180 Assembler. Version 3.2 September, 2001. + Copyright (C) 2001 Squak Valley Software +tasm: pass 1 complete. +HBIOS PROXY STACK space: 38 bytes. +HBIOS INT space remaining: 82 bytes. +DSRTC occupies 423 bytes. +UART occupies 716 bytes. +ASCI occupies 580 bytes. +MD occupies 451 bytes. +IDE occupies 1276 bytes. +SD occupies 2191 bytes. +HBIOS space remaining: 21434 bytes. +tasm: pass 2 complete. +tasm: Number of errors = 0 +Building MK4_cust output files... +Building 512KB MK4_cust ROM disk data file... diff --git a/Source/RomDsk/sbc_dide/FD.COM b/Source/RomDsk/MK4/FD.COM similarity index 100% rename from Source/RomDsk/sbc_dide/FD.COM rename to Source/RomDsk/MK4/FD.COM diff --git a/Source/RomDsk/mk4_cvdu/RTC.COM b/Source/RomDsk/MK4/RTC.COM similarity index 100% rename from Source/RomDsk/mk4_cvdu/RTC.COM rename to Source/RomDsk/MK4/RTC.COM diff --git a/Source/RomDsk/mk4_cvdu/XM-A0.COM b/Source/RomDsk/MK4/XM-A0.COM similarity index 100% rename from Source/RomDsk/mk4_cvdu/XM-A0.COM rename to Source/RomDsk/MK4/XM-A0.COM diff --git a/Source/RomDsk/mk4_cvdu/XM-A1.COM b/Source/RomDsk/MK4/XM-A1.COM similarity index 100% rename from Source/RomDsk/mk4_cvdu/XM-A1.COM rename to Source/RomDsk/MK4/XM-A1.COM diff --git a/Source/RomDsk/mk4_cvdu/XM5-A0.COM b/Source/RomDsk/MK4/XM5-A0.COM similarity index 100% rename from Source/RomDsk/mk4_cvdu/XM5-A0.COM rename to Source/RomDsk/MK4/XM5-A0.COM diff --git a/Source/RomDsk/mk4_cvdu/XM5-A1.COM b/Source/RomDsk/MK4/XM5-A1.COM similarity index 100% rename from Source/RomDsk/mk4_cvdu/XM5-A1.COM rename to Source/RomDsk/MK4/XM5-A1.COM diff --git a/Source/RomDsk/n8_2312/FD.COM b/Source/RomDsk/N8/FD.COM similarity index 100% rename from Source/RomDsk/n8_2312/FD.COM rename to Source/RomDsk/N8/FD.COM diff --git a/Source/RomDsk/n8_2312/RTC.COM b/Source/RomDsk/N8/RTC.COM similarity index 100% rename from Source/RomDsk/n8_2312/RTC.COM rename to Source/RomDsk/N8/RTC.COM diff --git a/Source/RomDsk/mk4_diskio3/XM-A0.COM b/Source/RomDsk/N8/XM-A0.COM similarity index 100% rename from Source/RomDsk/mk4_diskio3/XM-A0.COM rename to Source/RomDsk/N8/XM-A0.COM diff --git a/Source/RomDsk/mk4_diskio3/XM-A1.COM b/Source/RomDsk/N8/XM-A1.COM similarity index 100% rename from Source/RomDsk/mk4_diskio3/XM-A1.COM rename to Source/RomDsk/N8/XM-A1.COM diff --git a/Source/RomDsk/mk4_diskio3/XM5-A0.COM b/Source/RomDsk/N8/XM5-A0.COM similarity index 100% rename from Source/RomDsk/mk4_diskio3/XM5-A0.COM rename to Source/RomDsk/N8/XM5-A0.COM diff --git a/Source/RomDsk/mk4_diskio3/XM5-A1.COM b/Source/RomDsk/N8/XM5-A1.COM similarity index 100% rename from Source/RomDsk/mk4_diskio3/XM5-A1.COM rename to Source/RomDsk/N8/XM5-A1.COM diff --git a/Source/RomDsk/ROM_1024KB/FA16.DOC b/Source/RomDsk/ROM_1024KB/FA16.DOC deleted file mode 100644 index 08b46875..00000000 --- a/Source/RomDsk/ROM_1024KB/FA16.DOC +++ /dev/null @@ -1,264 +0,0 @@ - - FILEATTR - Version 1.6 - - Gene Pizzetta - January 18, 1992 - A ZSDOS utility, copyright (c) 1988 by Carson Wilson. - - -FILEATTR (FA) is a utility that allows rapid settin, resetting, -or displaying of file attributes under ZSDOS, ZRDOS, and CP/M -2.2. Several additional features are available under ZCPR3, -including error flag setting, error handler invocation, an -enhanced display, and better error detection. - -FA will not run under CP/M 3.0 or Z3PLUS. - -USAGE: - - FILEATTR {dir:}{afn} {{/}options} - -If a DIR or DU specification is not given, the current directory -is assumed (under vanilla CP/M only the drive is significant). -If no ambiguous or unambiguous filename is given, all files -("*.*") are matched. - -If no attribute options are given, FILEATTR merely displays the -current state of each file's attributes. Files are displayed in -the order that they appear in the directory. - -Once operation begins, FA cannot be aborted by the user. If a ^C -is entered at the keyboard, all screen output stops, but file -attribute operations continue to completion. If that was not the -case, attributes might be set on some entries for a file and not -on others. Nevertheless, suppressing screen output speeds things -up a bit. - -OPTIONS: A leading slash is required unless the option list is -the second parameter on the command line. Options may be -separated by spaces, commas, or nothing at all. - -ATTRIBUTE OPTIONS: These options set (turn on) corresponding -attributes on files matching the file specification. Attributes -not specified by an attribute option remain unchanged. - -If the option is preceded by a minus ("-") or by an "N", the -corresponding attribute is reset (turned off). - - 1 F1. This is a user attribute which has no predefined - meaning. - - P Public (f2). Under ZSDOS, when this attribute is set, - a file is available from any user area of the disk on - which it resides. A file cannot be made public if - another file with the same name exists in any other - user area on that drive. In that case FA will issue an - error message and leave the attribute off. - - D Inhibit access datestamp (f3). Under ZSDOS, when this - attribute is set, the file's access datestamp will not - be updated, which may speed file access slightly. If - the attribute is turned off, normal access datestamping - resumes. - - 4 F4. This is a user attribute which has no predefined - meaning. - - W Wheel protect (f8). Under ZSDOS, when this attribute - is set, the file becomes read-only when the wheel byte - is off and cannot be erased. If the wheel byte is on, - the file can be erased normally. - - R Read only (t1). When this attribute is set, the file - cannot be erased or modified by most programs. - - S System (t2). When this attribute is set, the file - becomes a "hidden" file that will not be found by most - directory programs or by most well-behaved utilities - that accept ambiguous filenames. (FA must find system - files, of course.) - - A Archive (t3). When this attribute is set, it signals - some archival programs that the file has not been - modified since it was last backed up. If a file is - modified, ZSDOS and ZRDOS turn this attribute off. - CP/M does not fully support this attribute, however. - -OTHER OPTIONS: These options affect only the screen display. - - Q Quiet mode. Console output is suppressed unless there - is an error. All other operations are performed - normally. - - X Screen paging off. With this option, screen paging is - turned off. The screen can still be paused by pressing - any key except ^C. - -ERRORS: Under ZCPR3, errors will cause FA to set the program -error flag and to invoke the error handler. The error flag will -be set to the following values: - 2 invalid directory specification - 4 miscellaneous (conflicting file, no files on disk) - 10 no matching files found (no error handler) - 18 Disk read-only - 19 Invalid option - -For error code 10 (no matching files found), the error flag is -set, but the error handler is not called. - -In addition, under ZCPR 3.3 and above, an invalid directory -specification will abort FA to the error handler, but no message -is printed. - -The following error messages may be seen: - -Conflicting entry, can't set public attribute - If there are files with the same name in other user areas of - the disk, the public attribute cannot be set. - -No files on disk - The disk directory is empty. - -Bad Option: /o - The command line option shown is unknown to FILEATTR. - -Drive R/O - The drive is set to read-only by the operating system and - attributes cannot be changed. - -CP/M version 2.x required - FILEATTR will not run on this system. - -BIOS write error near directory sector n - An error occurred at or near the given directory sector, - which is expressed as a decimal offset from the beginning of - the directory. - -BIOS set track detected - FA aborting - A background program is attempting to modify the current - track setting. The background program must be removeed - before running FA again. - -Not Wheel - Under ZCPR3 the wheel byte must be set before FILEATTR can - be run. - -CONFIGURATION: While no installation is necessary, all options -can be set as defaults, if you prefer, using ZCNFG. The -configuration options are fully explained on the ZCNFG help -screens. - -It is best not to change the name of the configuration file. Its -special name assures that ZCNFG will always find the correct CFG -file, even if the name of FA has been changed or if more than one -version of FA is online. - -HISTORY: - -Version 1.6 -- April 14, 1991 -- Gene Pizzetta - Now displays target DU and directory name in summary. Fixed - bug that caused "GO" to be displayed as program name, if it - was re-invoked with the GO command. - -Version 1.5 -- March 27, 1991 -- Gene Pizzetta - Now calls CP/M version checking routine (it was there, but - it wasn't called). Changed error codes: 10, no matching - files found. "No files on disk" error now gets - miscellaneous error code (4). Error 10 does not invoke - error handler. Not released. - -Version 1.4 -- March 20, 1991 -- Gene Pizzetta, Howard Goldstein - Code to check module data byte (S2) was replaced by Howard - Goldstein's elegant solution which uses a "true" extent - number: ((data_mod * 32) + extent). Entering a ^C no - longer really aborts FILEATTR; instead FA immediately prints - "Wait..." on the screen, turns off paging, turns on quiet - mode, sets the results flag, and finishes what it was doing. - All this is to prevent unexpected results when only some of - a file's directory entries are changed. All errors - including a conflicting file found during a PUBLIC request, - now set the program error flag and invoke the error handler - so an active SUBMIT or ZEX script can be aborted. The error - flag will have the following values: 2, invalid directory; - 10, no files on disk; 18, disk is read-only; 19, invalid - option; 4, all other errors. If no matching files are - found, the program error flag will be set to FFh, but the - error handler will not be invoked. A few other code changes - were made, including a check for CP/M-Plus, under which - FILEATTR will not work. Not released. - -Version 1.3 -- February 22, 1991 -- Gene Pizzetta - Corrected bug that caused faulty operation on large files: - The module data byte (S2) byte was not being checked, so - such files appeared 2 or more times in the directory display - and the public routine was often not finding conflicting - files. Added configuration byte and command line option (X) - for screen paging (paging is suppressed in quiet mode). - Made quiet mode responsive to ZCPR quiet flag and changed Q - command line option to toggle. Usage screen reflects - current effect of X and Q toggles. Attribute configuration - area changed to be compatible with ZCNFG TOGL3 routine. - Actions of D and ND options reversed so they work the same - as the others. Added configuration byte for printing - summary line even in quiet mode, as suggested by Howard - Goldstein. Removed blank lines from screen display, - allowing three more filenames to be shown. Removed tabs - from usage screen so PRINT and PSTR are not needed. - Eliminated leading zero from user number display. Now - prints "file" instead of "files" in summary when only 1 - matching file is found. Ditto for attribute(s) altered. - -Version 1.2 -- November 30, 1988 -- Carson Wilson - Fixed bug of no program name display when FILEATTR's name - was 8 characters long. - -Version 1.1 -- October 30, 1988 -- Carson Wilson - Now wildcards the command forms "FA d: /options" and "FA d: - options." - -Version 1.0 -- September 26, 1988 -- Carson Wilson - If a filespec is given, no leading slash is required before - the options. Link with version 4 libraries. Removed /X - option--ZSDOS 10T always closes the first extent when a file - is written to. Changed summary to read "files matched". - -Version 0.9 -- July 7, 1988 -- Carson Wilson - Increased length of search FCB (AMBFIL) by one byte. Set up - AMBFIL as '?' + 35 binary 0's. ZRDOS and CP/M zero the - drive byte (FCB+0) during search next calls, so reinitialize - it to '?' before rescanning the directory. PROGID now - prints stored name on GO/JUMP. - -Version 0.8 -- June 26, 1988 -- Carson Wilson - Use SYSLIB PRINT for help display. VPRINT does not expand - tabs. Now traps disk track changes at the BIOS level. - Allows '-' as well as 'N' for "negate option." Auto- - wildcards FCB1 for attribute set as well as display. - -Version 0.7 -- May 24, 1988 -- Carson Wilson - Cosmetic changes to help, display. Made public routines - faster by 1/2 directory scan average. Consolidated file - attribute setting/resetting routines for efficiency and - clarity. - -Version 0.6 -- May 14, 1988 -- Carson Wilson - Changed "Publ" to "Publc" and "Priv" to "Privt". Added Q - and X options, made options installable. Added test for bad - ZCPR directory & chain to error handler. - -Version 0.5 -- May 4, 1988 -- Carson Wilson - Fixed bug at CHKRO inherited from MAKE.ASM. Uses Bridger - Mitchell's FRESET to reset disks. Uses ZCPR invocation name - in signon, help, etc. Added F4 attribute. Now includes all - valid ZSDOS attributes. Help now fully "smart" under ZCPR. - Reworked VID3.Z80 and VID4.Z80 from VLIB11 and moved them - into FA.Z80 (see end of file). Put STNDOUT mode ON by - default at beginning of each attribute display sequence for - faster ZCPR displays. - -Version 0.4 -- April 27, 1988 -- Carson Wilson - Tests for matching files at other user areas before setting - the public attribit. - -Version 0.3 -- April 26, 1988 -- Carson Wilson diff --git a/Source/RomDsk/ROM_1024KB/FA16A.FOR b/Source/RomDsk/ROM_1024KB/FA16A.FOR deleted file mode 100644 index e9ed3d43..00000000 --- a/Source/RomDsk/ROM_1024KB/FA16A.FOR +++ /dev/null @@ -1,6 +0,0 @@ -An update and bug-fix of FILEATTR (FA), a ZSDOS utility that -allows rapid setting, resetting, or displaying of file attributes -under ZSDOS, ZRDOS, and CP/M 2.2. Several additional features -are available under ZCPR3, including error flag setting, error -handler invocation, and an enhanced display. Version 1.6A adds -documentation; otherwise, same as 1.6. diff --git a/Source/RomDsk/ROM_1024KB/FA16CFG.TXT b/Source/RomDsk/ROM_1024KB/FA16CFG.TXT deleted file mode 100644 index 4067b9ba..00000000 --- a/Source/RomDsk/ROM_1024KB/FA16CFG.TXT +++ /dev/null @@ -1,39 +0,0 @@ - -Option Q -- If the ZCPR quiet flag is set, FILEATTR will always default to -quiet mode. To make quiet mode the default at all times, even when running -under CP/M, set this configuration option to "Yes". Whatever is selected -here can be toggled with the command line "Q" option. - -Option X -- A "Yes" will cause FILEATTR to page screen output by default. -A "No" will default to continuous scrolling. The chosen default can be -toggled with the command line "X" option. Screen paging is always turned -off in quiet mode. - -Option R -- As distributed, FILEATTR prints nothing to the screen when it -is operating in quiet mode. If this configuration option is "Yes", the -results summary line that gives the number of matching files found and the -number of attributes changed will be printed even in quiet mode. - -Option S -- Enter the number of lines on your video display screen. Under -ZCPR 3.3 and higher, the number of screen lines for paging is obtained from -the environment descriptor. This configuration parameter is used only if -running under CP/M. - - - Attribute Configuration Options - -As distributed, FILEATTR will not change any file attribute unless -explicitly commanded to do so by a command line option. To configure -FILEATTR to turn a file attribute ON or OFF by default, toggle the -appropriate configuration selection. - -For example, to make FILEATTR set all matching files to Public by default, -change the "Public attribute" setting to "Turn On". Then FILEATTR will set -the specified files to Public unless the /NP command line option is given -(which would cause the files to be set to Private). Since there is no -command which tells FILEATTR not to change an attribute, however, the -program will now insist on turning the Public attribute either on (default) -or off (through the /NP option). - -Most users will have neither need nor desire to change the configuration -default as distributed which will "Leave As-Is" all matching files. diff --git a/Source/RomDsk/ROM_1024KB/FDISK80.COM b/Source/RomDsk/ROM_1024KB/FDISK80.COM index 4523c291..ace4b0a6 100644 Binary files a/Source/RomDsk/ROM_1024KB/FDISK80.COM and b/Source/RomDsk/ROM_1024KB/FDISK80.COM differ diff --git a/Source/RomDsk/ROM_1024KB/NULU.COM b/Source/RomDsk/ROM_1024KB/NULU.COM index fc5594b1..3d45098a 100644 Binary files a/Source/RomDsk/ROM_1024KB/NULU.COM and b/Source/RomDsk/ROM_1024KB/NULU.COM differ diff --git a/Source/RomDsk/ROM_1024KB/PUTBG.COM b/Source/RomDsk/ROM_1024KB/PUTBG.COM deleted file mode 100644 index 970e2d8a..00000000 Binary files a/Source/RomDsk/ROM_1024KB/PUTBG.COM and /dev/null differ diff --git a/Source/RomDsk/ROM_512KB/FDISK80.COM b/Source/RomDsk/ROM_512KB/FDISK80.COM index 4523c291..ace4b0a6 100644 Binary files a/Source/RomDsk/ROM_512KB/FDISK80.COM and b/Source/RomDsk/ROM_512KB/FDISK80.COM differ diff --git a/Source/RomDsk/ROM_512KB/NULU.COM b/Source/RomDsk/ROM_512KB/NULU.COM index fc5594b1..3d45098a 100644 Binary files a/Source/RomDsk/ROM_512KB/NULU.COM and b/Source/RomDsk/ROM_512KB/NULU.COM differ diff --git a/Source/RomDsk/ReadMe.txt b/Source/RomDsk/ReadMe.txt index fcc442ac..37cf4faf 100644 --- a/Source/RomDsk/ReadMe.txt +++ b/Source/RomDsk/ReadMe.txt @@ -1,30 +1,37 @@ -This is the parent directory for all files to -be included in the rom disk when the ROM is built. - -When constructing the ROM disk as part of a build, -the build process first grabs all of the "standard" -files for the size of ROM being built and the type -of the OS being used. So, if you are building a -ZSystem, 1MB ROM, all of the files in ZSYS_1024KB -will be pulled in. If you are building a CP/M -512KB ROM, then all the files in CPM_512KB will -be pulled in. - -After adding all of the standard files for the -size of ROM being built, the build process will -add the files from the appropriate configuration -directory. So, if you are building the standard -Zeta configuration (zeta_std), all of the files -in the zeta_std directory will be added. - -If you are building your own ROM, you will need to -add a new directory of the name xxx_yyy where xxx -is the name of your platform (N8VEM, N8, ZETA, etc.) -and yyy is the name of the configuration you have -created. The xxx_yyy name must match the -xxx_yyy.asm file in the Config directory. You -will want to add any specific files you want added -to your ROM build to this directory. Note that the -build will complain if there are no files in your -custom configuration directory, but it is not a -real problem (error can be ignored). \ No newline at end of file +*********************************************************************** +*** *** +*** R o m W B W *** +*** *** +*** Z80/Z180 System Software *** +*** *** +*********************************************************************** + +This is the parent directory for all files to be included in the ROM +Disk when a ROM is built. + +When constructing the ROM disk as part of a build, the build process +first grabs all of the "standard" files for the size of ROM being +built. So, if you are building a normal 512KB ROM, all of the files +in 512KB directory will be pulled in. + +After adding all of the standard files for the size of ROM being +built, the build process will add the files from the appropriate +platform directory. So, if you are building a ROM for the Zeta +platform, all of the files in the zeta directory will be added. + +The reason for the platform directories is that some programs are +specific to a platform. The platform directories provide a mechanism +to add platform specific programs. + +You may freely add/delete/update the files in these directories to +change the contents of the ROM Disk of your ROM firmware. + +CAUTION: The space on the ROM Disk is very limited and adding files +is likely to cause the ROM Disk to run out of space. If this +happens, you will see an error like the following when running the +BuildROM script: + + cpmcp: can not write cpm.sys: device full + +The resulting ROM Disk is still OK to use, but will not contain the +file(s) that did not fit. diff --git a/Source/RomDsk/sbc_cvdu/1200.COM b/Source/RomDsk/SBC/1200.COM similarity index 100% rename from Source/RomDsk/sbc_cvdu/1200.COM rename to Source/RomDsk/SBC/1200.COM diff --git a/Source/RomDsk/sbc_cvdu/38400.COM b/Source/RomDsk/SBC/38400.COM similarity index 100% rename from Source/RomDsk/sbc_cvdu/38400.COM rename to Source/RomDsk/SBC/38400.COM diff --git a/Source/RomDsk/sbc_cvdu/9600.COM b/Source/RomDsk/SBC/9600.COM similarity index 100% rename from Source/RomDsk/sbc_cvdu/9600.COM rename to Source/RomDsk/SBC/9600.COM diff --git a/Source/RomDsk/mk4_diskio3/FD.COM b/Source/RomDsk/SBC/FD.COM similarity index 100% rename from Source/RomDsk/mk4_diskio3/FD.COM rename to Source/RomDsk/SBC/FD.COM diff --git a/Source/RomDsk/sbc_std/RTC.COM b/Source/RomDsk/SBC/RTC.COM similarity index 100% rename from Source/RomDsk/sbc_std/RTC.COM rename to Source/RomDsk/SBC/RTC.COM diff --git a/Source/RomDsk/sbc_cvdu/XM.COM b/Source/RomDsk/SBC/XM.COM similarity index 100% rename from Source/RomDsk/sbc_cvdu/XM.COM rename to Source/RomDsk/SBC/XM.COM diff --git a/Source/RomDsk/sbc_cvdu/XM5.COM b/Source/RomDsk/SBC/XM5.COM similarity index 100% rename from Source/RomDsk/sbc_cvdu/XM5.COM rename to Source/RomDsk/SBC/XM5.COM diff --git a/Source/RomDsk/sbc_simh/HDIR.COM b/Source/RomDsk/SIMH/HDIR.COM similarity index 100% rename from Source/RomDsk/sbc_simh/HDIR.COM rename to Source/RomDsk/SIMH/HDIR.COM diff --git a/Source/RomDsk/sbc_simh/R.COM b/Source/RomDsk/SIMH/R.COM similarity index 100% rename from Source/RomDsk/sbc_simh/R.COM rename to Source/RomDsk/SIMH/R.COM diff --git a/Source/RomDsk/sbc_simh/RSETSIMH.COM b/Source/RomDsk/SIMH/RSETSIMH.COM similarity index 100% rename from Source/RomDsk/sbc_simh/RSETSIMH.COM rename to Source/RomDsk/SIMH/RSETSIMH.COM diff --git a/Source/RomDsk/sbc_simh/TIMER.COM b/Source/RomDsk/SIMH/TIMER.COM similarity index 100% rename from Source/RomDsk/sbc_simh/TIMER.COM rename to Source/RomDsk/SIMH/TIMER.COM diff --git a/Source/RomDsk/sbc_simh/URL.COM b/Source/RomDsk/SIMH/URL.COM similarity index 100% rename from Source/RomDsk/sbc_simh/URL.COM rename to Source/RomDsk/SIMH/URL.COM diff --git a/Source/RomDsk/sbc_simh/W.COM b/Source/RomDsk/SIMH/W.COM similarity index 100% rename from Source/RomDsk/sbc_simh/W.COM rename to Source/RomDsk/SIMH/W.COM diff --git a/Source/RomDsk/mk4_dsd/XM-A0.COM b/Source/RomDsk/UNA/XM-A0.COM similarity index 100% rename from Source/RomDsk/mk4_dsd/XM-A0.COM rename to Source/RomDsk/UNA/XM-A0.COM diff --git a/Source/RomDsk/mk4_dsd/XM-A1.COM b/Source/RomDsk/UNA/XM-A1.COM similarity index 100% rename from Source/RomDsk/mk4_dsd/XM-A1.COM rename to Source/RomDsk/UNA/XM-A1.COM diff --git a/Source/RomDsk/sbc_dide/XM.COM b/Source/RomDsk/UNA/XM.COM similarity index 100% rename from Source/RomDsk/sbc_dide/XM.COM rename to Source/RomDsk/UNA/XM.COM diff --git a/Source/RomDsk/mk4_dsd/XM5-A0.COM b/Source/RomDsk/UNA/XM5-A0.COM similarity index 100% rename from Source/RomDsk/mk4_dsd/XM5-A0.COM rename to Source/RomDsk/UNA/XM5-A0.COM diff --git a/Source/RomDsk/mk4_dsd/XM5-A1.COM b/Source/RomDsk/UNA/XM5-A1.COM similarity index 100% rename from Source/RomDsk/mk4_dsd/XM5-A1.COM rename to Source/RomDsk/UNA/XM5-A1.COM diff --git a/Source/RomDsk/sbc_dide/XM5.COM b/Source/RomDsk/UNA/XM5.COM similarity index 100% rename from Source/RomDsk/sbc_dide/XM5.COM rename to Source/RomDsk/UNA/XM5.COM diff --git a/Source/RomDsk/sbc_dide/1200.COM b/Source/RomDsk/ZETA/1200.COM similarity index 100% rename from Source/RomDsk/sbc_dide/1200.COM rename to Source/RomDsk/ZETA/1200.COM diff --git a/Source/RomDsk/sbc_dide/38400.COM b/Source/RomDsk/ZETA/38400.COM similarity index 100% rename from Source/RomDsk/sbc_dide/38400.COM rename to Source/RomDsk/ZETA/38400.COM diff --git a/Source/RomDsk/sbc_dide/9600.COM b/Source/RomDsk/ZETA/9600.COM similarity index 100% rename from Source/RomDsk/sbc_dide/9600.COM rename to Source/RomDsk/ZETA/9600.COM diff --git a/Source/RomDsk/zeta_ppide/FD.COM b/Source/RomDsk/ZETA/FD.COM similarity index 100% rename from Source/RomDsk/zeta_ppide/FD.COM rename to Source/RomDsk/ZETA/FD.COM diff --git a/Source/RomDsk/sbc_cvdu/RTC.COM b/Source/RomDsk/ZETA/RTC.COM similarity index 100% rename from Source/RomDsk/sbc_cvdu/RTC.COM rename to Source/RomDsk/ZETA/RTC.COM diff --git a/Source/RomDsk/sbc_diskio/XM.COM b/Source/RomDsk/ZETA/XM.COM similarity index 100% rename from Source/RomDsk/sbc_diskio/XM.COM rename to Source/RomDsk/ZETA/XM.COM diff --git a/Source/RomDsk/sbc_diskio/XM5.COM b/Source/RomDsk/ZETA/XM5.COM similarity index 100% rename from Source/RomDsk/sbc_diskio/XM5.COM rename to Source/RomDsk/ZETA/XM5.COM diff --git a/Source/RomDsk/sbc_diskio/1200.COM b/Source/RomDsk/ZETA2/1200.COM similarity index 100% rename from Source/RomDsk/sbc_diskio/1200.COM rename to Source/RomDsk/ZETA2/1200.COM diff --git a/Source/RomDsk/sbc_diskio/38400.COM b/Source/RomDsk/ZETA2/38400.COM similarity index 100% rename from Source/RomDsk/sbc_diskio/38400.COM rename to Source/RomDsk/ZETA2/38400.COM diff --git a/Source/RomDsk/sbc_diskio/9600.COM b/Source/RomDsk/ZETA2/9600.COM similarity index 100% rename from Source/RomDsk/sbc_diskio/9600.COM rename to Source/RomDsk/ZETA2/9600.COM diff --git a/Source/RomDsk/zeta2_ppide/FD.COM b/Source/RomDsk/ZETA2/FD.COM similarity index 100% rename from Source/RomDsk/zeta2_ppide/FD.COM rename to Source/RomDsk/ZETA2/FD.COM diff --git a/Source/RomDsk/sbc_dide/RTC.COM b/Source/RomDsk/ZETA2/RTC.COM similarity index 100% rename from Source/RomDsk/sbc_dide/RTC.COM rename to Source/RomDsk/ZETA2/RTC.COM diff --git a/Source/RomDsk/sbc_diskio3+cvdu/XM.COM b/Source/RomDsk/ZETA2/XM.COM similarity index 100% rename from Source/RomDsk/sbc_diskio3+cvdu/XM.COM rename to Source/RomDsk/ZETA2/XM.COM diff --git a/Source/RomDsk/sbc_diskio3+cvdu/XM5.COM b/Source/RomDsk/ZETA2/XM5.COM similarity index 100% rename from Source/RomDsk/sbc_diskio3+cvdu/XM5.COM rename to Source/RomDsk/ZETA2/XM5.COM diff --git a/Source/RomDsk/mk4_diskio3/RTC.COM b/Source/RomDsk/mk4_diskio3/RTC.COM deleted file mode 100644 index 64788f53..00000000 Binary files a/Source/RomDsk/mk4_diskio3/RTC.COM and /dev/null differ diff --git a/Source/RomDsk/mk4_dsd/RTC.COM b/Source/RomDsk/mk4_dsd/RTC.COM deleted file mode 100644 index 64788f53..00000000 Binary files a/Source/RomDsk/mk4_dsd/RTC.COM and /dev/null differ diff --git a/Source/RomDsk/mk4_propio/RTC.COM b/Source/RomDsk/mk4_propio/RTC.COM deleted file mode 100644 index 64788f53..00000000 Binary files a/Source/RomDsk/mk4_propio/RTC.COM and /dev/null differ diff --git a/Source/RomDsk/mk4_propio/XM-A0.COM b/Source/RomDsk/mk4_propio/XM-A0.COM deleted file mode 100644 index 6afb31f3..00000000 Binary files a/Source/RomDsk/mk4_propio/XM-A0.COM and /dev/null differ diff --git a/Source/RomDsk/mk4_propio/XM-A1.COM b/Source/RomDsk/mk4_propio/XM-A1.COM deleted file mode 100644 index 42a67c31..00000000 Binary files a/Source/RomDsk/mk4_propio/XM-A1.COM and /dev/null differ diff --git a/Source/RomDsk/mk4_propio/XM5-A0.COM b/Source/RomDsk/mk4_propio/XM5-A0.COM deleted file mode 100644 index e233bee9..00000000 Binary files a/Source/RomDsk/mk4_propio/XM5-A0.COM and /dev/null differ diff --git a/Source/RomDsk/mk4_propio/XM5-A1.COM b/Source/RomDsk/mk4_propio/XM5-A1.COM deleted file mode 100644 index 625e06ac..00000000 Binary files a/Source/RomDsk/mk4_propio/XM5-A1.COM and /dev/null differ diff --git a/Source/RomDsk/mk4_std/RTC.COM b/Source/RomDsk/mk4_std/RTC.COM deleted file mode 100644 index 64788f53..00000000 Binary files a/Source/RomDsk/mk4_std/RTC.COM and /dev/null differ diff --git a/Source/RomDsk/mk4_std/XM-A0.COM b/Source/RomDsk/mk4_std/XM-A0.COM deleted file mode 100644 index 6afb31f3..00000000 Binary files a/Source/RomDsk/mk4_std/XM-A0.COM and /dev/null differ diff --git a/Source/RomDsk/mk4_std/XM-A1.COM b/Source/RomDsk/mk4_std/XM-A1.COM deleted file mode 100644 index 42a67c31..00000000 Binary files a/Source/RomDsk/mk4_std/XM-A1.COM and /dev/null differ diff --git a/Source/RomDsk/mk4_std/XM5-A0.COM b/Source/RomDsk/mk4_std/XM5-A0.COM deleted file mode 100644 index e233bee9..00000000 Binary files a/Source/RomDsk/mk4_std/XM5-A0.COM and /dev/null differ diff --git a/Source/RomDsk/mk4_std/XM5-A1.COM b/Source/RomDsk/mk4_std/XM5-A1.COM deleted file mode 100644 index 625e06ac..00000000 Binary files a/Source/RomDsk/mk4_std/XM5-A1.COM and /dev/null differ diff --git a/Source/RomDsk/n8_2312/XM-A0.COM b/Source/RomDsk/n8_2312/XM-A0.COM deleted file mode 100644 index 6afb31f3..00000000 Binary files a/Source/RomDsk/n8_2312/XM-A0.COM and /dev/null differ diff --git a/Source/RomDsk/n8_2312/XM-A1.COM b/Source/RomDsk/n8_2312/XM-A1.COM deleted file mode 100644 index 42a67c31..00000000 Binary files a/Source/RomDsk/n8_2312/XM-A1.COM and /dev/null differ diff --git a/Source/RomDsk/n8_2312/XM5-A0.COM b/Source/RomDsk/n8_2312/XM5-A0.COM deleted file mode 100644 index e233bee9..00000000 Binary files a/Source/RomDsk/n8_2312/XM5-A0.COM and /dev/null differ diff --git a/Source/RomDsk/n8_2312/XM5-A1.COM b/Source/RomDsk/n8_2312/XM5-A1.COM deleted file mode 100644 index 625e06ac..00000000 Binary files a/Source/RomDsk/n8_2312/XM5-A1.COM and /dev/null differ diff --git a/Source/RomDsk/n8_2511/FD.COM b/Source/RomDsk/n8_2511/FD.COM deleted file mode 100644 index 0090b8c8..00000000 Binary files a/Source/RomDsk/n8_2511/FD.COM and /dev/null differ diff --git a/Source/RomDsk/n8_2511/RTC.COM b/Source/RomDsk/n8_2511/RTC.COM deleted file mode 100644 index c644663a..00000000 Binary files a/Source/RomDsk/n8_2511/RTC.COM and /dev/null differ diff --git a/Source/RomDsk/n8_2511/XM-A0.COM b/Source/RomDsk/n8_2511/XM-A0.COM deleted file mode 100644 index 6afb31f3..00000000 Binary files a/Source/RomDsk/n8_2511/XM-A0.COM and /dev/null differ diff --git a/Source/RomDsk/n8_2511/XM-A1.COM b/Source/RomDsk/n8_2511/XM-A1.COM deleted file mode 100644 index 42a67c31..00000000 Binary files a/Source/RomDsk/n8_2511/XM-A1.COM and /dev/null differ diff --git a/Source/RomDsk/n8_2511/XM5-A0.COM b/Source/RomDsk/n8_2511/XM5-A0.COM deleted file mode 100644 index e233bee9..00000000 Binary files a/Source/RomDsk/n8_2511/XM5-A0.COM and /dev/null differ diff --git a/Source/RomDsk/n8_2511/XM5-A1.COM b/Source/RomDsk/n8_2511/XM5-A1.COM deleted file mode 100644 index 625e06ac..00000000 Binary files a/Source/RomDsk/n8_2511/XM5-A1.COM and /dev/null differ diff --git a/Source/RomDsk/sbc_diskio/ECIDETST.COM b/Source/RomDsk/sbc_diskio/ECIDETST.COM deleted file mode 100644 index f0140c58..00000000 Binary files a/Source/RomDsk/sbc_diskio/ECIDETST.COM and /dev/null differ diff --git a/Source/RomDsk/sbc_diskio/FD.COM b/Source/RomDsk/sbc_diskio/FD.COM deleted file mode 100644 index d411a1fb..00000000 Binary files a/Source/RomDsk/sbc_diskio/FD.COM and /dev/null differ diff --git a/Source/RomDsk/sbc_diskio/RTC.COM b/Source/RomDsk/sbc_diskio/RTC.COM deleted file mode 100644 index b36725f3..00000000 Binary files a/Source/RomDsk/sbc_diskio/RTC.COM and /dev/null differ diff --git a/Source/RomDsk/sbc_diskio/TP-IDE.COM b/Source/RomDsk/sbc_diskio/TP-IDE.COM deleted file mode 100644 index 726efd5b..00000000 Binary files a/Source/RomDsk/sbc_diskio/TP-IDE.COM and /dev/null differ diff --git a/Source/RomDsk/sbc_diskio3+cvdu/1200.COM b/Source/RomDsk/sbc_diskio3+cvdu/1200.COM deleted file mode 100644 index d00960b0..00000000 Binary files a/Source/RomDsk/sbc_diskio3+cvdu/1200.COM and /dev/null differ diff --git a/Source/RomDsk/sbc_diskio3+cvdu/38400.COM b/Source/RomDsk/sbc_diskio3+cvdu/38400.COM deleted file mode 100644 index 6d81bc17..00000000 Binary files a/Source/RomDsk/sbc_diskio3+cvdu/38400.COM and /dev/null differ diff --git a/Source/RomDsk/sbc_diskio3+cvdu/9600.COM b/Source/RomDsk/sbc_diskio3+cvdu/9600.COM deleted file mode 100644 index 4727badf..00000000 Binary files a/Source/RomDsk/sbc_diskio3+cvdu/9600.COM and /dev/null differ diff --git a/Source/RomDsk/sbc_diskio3+cvdu/FD.COM b/Source/RomDsk/sbc_diskio3+cvdu/FD.COM deleted file mode 100644 index dcea26ca..00000000 Binary files a/Source/RomDsk/sbc_diskio3+cvdu/FD.COM and /dev/null differ diff --git a/Source/RomDsk/sbc_diskio3+cvdu/RTC.COM b/Source/RomDsk/sbc_diskio3+cvdu/RTC.COM deleted file mode 100644 index b36725f3..00000000 Binary files a/Source/RomDsk/sbc_diskio3+cvdu/RTC.COM and /dev/null differ diff --git a/Source/RomDsk/sbc_diskio3/1200.COM b/Source/RomDsk/sbc_diskio3/1200.COM deleted file mode 100644 index d00960b0..00000000 Binary files a/Source/RomDsk/sbc_diskio3/1200.COM and /dev/null differ diff --git a/Source/RomDsk/sbc_diskio3/38400.COM b/Source/RomDsk/sbc_diskio3/38400.COM deleted file mode 100644 index 6d81bc17..00000000 Binary files a/Source/RomDsk/sbc_diskio3/38400.COM and /dev/null differ diff --git a/Source/RomDsk/sbc_diskio3/9600.COM b/Source/RomDsk/sbc_diskio3/9600.COM deleted file mode 100644 index 4727badf..00000000 Binary files a/Source/RomDsk/sbc_diskio3/9600.COM and /dev/null differ diff --git a/Source/RomDsk/sbc_diskio3/FD.COM b/Source/RomDsk/sbc_diskio3/FD.COM deleted file mode 100644 index dcea26ca..00000000 Binary files a/Source/RomDsk/sbc_diskio3/FD.COM and /dev/null differ diff --git a/Source/RomDsk/sbc_diskio3/RTC.COM b/Source/RomDsk/sbc_diskio3/RTC.COM deleted file mode 100644 index b36725f3..00000000 Binary files a/Source/RomDsk/sbc_diskio3/RTC.COM and /dev/null differ diff --git a/Source/RomDsk/sbc_diskio3/XM.COM b/Source/RomDsk/sbc_diskio3/XM.COM deleted file mode 100644 index abcc6828..00000000 Binary files a/Source/RomDsk/sbc_diskio3/XM.COM and /dev/null differ diff --git a/Source/RomDsk/sbc_diskio3/XM5.COM b/Source/RomDsk/sbc_diskio3/XM5.COM deleted file mode 100644 index 8ea2b661..00000000 Binary files a/Source/RomDsk/sbc_diskio3/XM5.COM and /dev/null differ diff --git a/Source/RomDsk/sbc_dsd/1200.COM b/Source/RomDsk/sbc_dsd/1200.COM deleted file mode 100644 index d00960b0..00000000 Binary files a/Source/RomDsk/sbc_dsd/1200.COM and /dev/null differ diff --git a/Source/RomDsk/sbc_dsd/38400.COM b/Source/RomDsk/sbc_dsd/38400.COM deleted file mode 100644 index 6d81bc17..00000000 Binary files a/Source/RomDsk/sbc_dsd/38400.COM and /dev/null differ diff --git a/Source/RomDsk/sbc_dsd/9600.COM b/Source/RomDsk/sbc_dsd/9600.COM deleted file mode 100644 index 4727badf..00000000 Binary files a/Source/RomDsk/sbc_dsd/9600.COM and /dev/null differ diff --git a/Source/RomDsk/sbc_dsd/RTC.COM b/Source/RomDsk/sbc_dsd/RTC.COM deleted file mode 100644 index b36725f3..00000000 Binary files a/Source/RomDsk/sbc_dsd/RTC.COM and /dev/null differ diff --git a/Source/RomDsk/sbc_dsd/VT3.COM b/Source/RomDsk/sbc_dsd/VT3.COM deleted file mode 100644 index 6290a6d3..00000000 Binary files a/Source/RomDsk/sbc_dsd/VT3.COM and /dev/null differ diff --git a/Source/RomDsk/sbc_dsd/XM.COM b/Source/RomDsk/sbc_dsd/XM.COM deleted file mode 100644 index abcc6828..00000000 Binary files a/Source/RomDsk/sbc_dsd/XM.COM and /dev/null differ diff --git a/Source/RomDsk/sbc_dsd/XM5.COM b/Source/RomDsk/sbc_dsd/XM5.COM deleted file mode 100644 index 8ea2b661..00000000 Binary files a/Source/RomDsk/sbc_dsd/XM5.COM and /dev/null differ diff --git a/Source/RomDsk/sbc_mfpic/1200.COM b/Source/RomDsk/sbc_mfpic/1200.COM deleted file mode 100644 index d00960b0..00000000 Binary files a/Source/RomDsk/sbc_mfpic/1200.COM and /dev/null differ diff --git a/Source/RomDsk/sbc_mfpic/38400.COM b/Source/RomDsk/sbc_mfpic/38400.COM deleted file mode 100644 index 6d81bc17..00000000 Binary files a/Source/RomDsk/sbc_mfpic/38400.COM and /dev/null differ diff --git a/Source/RomDsk/sbc_mfpic/9600.COM b/Source/RomDsk/sbc_mfpic/9600.COM deleted file mode 100644 index 4727badf..00000000 Binary files a/Source/RomDsk/sbc_mfpic/9600.COM and /dev/null differ diff --git a/Source/RomDsk/sbc_mfpic/PPIDETST.COM b/Source/RomDsk/sbc_mfpic/PPIDETST.COM deleted file mode 100644 index 1cfc72b7..00000000 Binary files a/Source/RomDsk/sbc_mfpic/PPIDETST.COM and /dev/null differ diff --git a/Source/RomDsk/sbc_mfpic/RTC.COM b/Source/RomDsk/sbc_mfpic/RTC.COM deleted file mode 100644 index b36725f3..00000000 Binary files a/Source/RomDsk/sbc_mfpic/RTC.COM and /dev/null differ diff --git a/Source/RomDsk/sbc_mfpic/VT3.COM b/Source/RomDsk/sbc_mfpic/VT3.COM deleted file mode 100644 index 6290a6d3..00000000 Binary files a/Source/RomDsk/sbc_mfpic/VT3.COM and /dev/null differ diff --git a/Source/RomDsk/sbc_mfpic/XM.COM b/Source/RomDsk/sbc_mfpic/XM.COM deleted file mode 100644 index abcc6828..00000000 Binary files a/Source/RomDsk/sbc_mfpic/XM.COM and /dev/null differ diff --git a/Source/RomDsk/sbc_mfpic/XM5.COM b/Source/RomDsk/sbc_mfpic/XM5.COM deleted file mode 100644 index 8ea2b661..00000000 Binary files a/Source/RomDsk/sbc_mfpic/XM5.COM and /dev/null differ diff --git a/Source/RomDsk/sbc_ppide/1200.COM b/Source/RomDsk/sbc_ppide/1200.COM deleted file mode 100644 index d00960b0..00000000 Binary files a/Source/RomDsk/sbc_ppide/1200.COM and /dev/null differ diff --git a/Source/RomDsk/sbc_ppide/38400.COM b/Source/RomDsk/sbc_ppide/38400.COM deleted file mode 100644 index 6d81bc17..00000000 Binary files a/Source/RomDsk/sbc_ppide/38400.COM and /dev/null differ diff --git a/Source/RomDsk/sbc_ppide/9600.COM b/Source/RomDsk/sbc_ppide/9600.COM deleted file mode 100644 index 4727badf..00000000 Binary files a/Source/RomDsk/sbc_ppide/9600.COM and /dev/null differ diff --git a/Source/RomDsk/sbc_ppide/PPIDETST.COM b/Source/RomDsk/sbc_ppide/PPIDETST.COM deleted file mode 100644 index 1cfc72b7..00000000 Binary files a/Source/RomDsk/sbc_ppide/PPIDETST.COM and /dev/null differ diff --git a/Source/RomDsk/sbc_ppide/RTC.COM b/Source/RomDsk/sbc_ppide/RTC.COM deleted file mode 100644 index b36725f3..00000000 Binary files a/Source/RomDsk/sbc_ppide/RTC.COM and /dev/null differ diff --git a/Source/RomDsk/sbc_ppide/VT3.COM b/Source/RomDsk/sbc_ppide/VT3.COM deleted file mode 100644 index 6290a6d3..00000000 Binary files a/Source/RomDsk/sbc_ppide/VT3.COM and /dev/null differ diff --git a/Source/RomDsk/sbc_ppide/XM.COM b/Source/RomDsk/sbc_ppide/XM.COM deleted file mode 100644 index abcc6828..00000000 Binary files a/Source/RomDsk/sbc_ppide/XM.COM and /dev/null differ diff --git a/Source/RomDsk/sbc_ppide/XM5.COM b/Source/RomDsk/sbc_ppide/XM5.COM deleted file mode 100644 index 8ea2b661..00000000 Binary files a/Source/RomDsk/sbc_ppide/XM5.COM and /dev/null differ diff --git a/Source/RomDsk/sbc_ppisd/1200.COM b/Source/RomDsk/sbc_ppisd/1200.COM deleted file mode 100644 index d00960b0..00000000 Binary files a/Source/RomDsk/sbc_ppisd/1200.COM and /dev/null differ diff --git a/Source/RomDsk/sbc_ppisd/38400.COM b/Source/RomDsk/sbc_ppisd/38400.COM deleted file mode 100644 index 6d81bc17..00000000 Binary files a/Source/RomDsk/sbc_ppisd/38400.COM and /dev/null differ diff --git a/Source/RomDsk/sbc_ppisd/9600.COM b/Source/RomDsk/sbc_ppisd/9600.COM deleted file mode 100644 index 4727badf..00000000 Binary files a/Source/RomDsk/sbc_ppisd/9600.COM and /dev/null differ diff --git a/Source/RomDsk/sbc_ppisd/RTC.COM b/Source/RomDsk/sbc_ppisd/RTC.COM deleted file mode 100644 index b36725f3..00000000 Binary files a/Source/RomDsk/sbc_ppisd/RTC.COM and /dev/null differ diff --git a/Source/RomDsk/sbc_ppisd/VT3.COM b/Source/RomDsk/sbc_ppisd/VT3.COM deleted file mode 100644 index 6290a6d3..00000000 Binary files a/Source/RomDsk/sbc_ppisd/VT3.COM and /dev/null differ diff --git a/Source/RomDsk/sbc_ppisd/XM.COM b/Source/RomDsk/sbc_ppisd/XM.COM deleted file mode 100644 index abcc6828..00000000 Binary files a/Source/RomDsk/sbc_ppisd/XM.COM and /dev/null differ diff --git a/Source/RomDsk/sbc_ppisd/XM5.COM b/Source/RomDsk/sbc_ppisd/XM5.COM deleted file mode 100644 index 8ea2b661..00000000 Binary files a/Source/RomDsk/sbc_ppisd/XM5.COM and /dev/null differ diff --git a/Source/RomDsk/sbc_propio/1200.COM b/Source/RomDsk/sbc_propio/1200.COM deleted file mode 100644 index d00960b0..00000000 Binary files a/Source/RomDsk/sbc_propio/1200.COM and /dev/null differ diff --git a/Source/RomDsk/sbc_propio/38400.COM b/Source/RomDsk/sbc_propio/38400.COM deleted file mode 100644 index 6d81bc17..00000000 Binary files a/Source/RomDsk/sbc_propio/38400.COM and /dev/null differ diff --git a/Source/RomDsk/sbc_propio/9600.COM b/Source/RomDsk/sbc_propio/9600.COM deleted file mode 100644 index 4727badf..00000000 Binary files a/Source/RomDsk/sbc_propio/9600.COM and /dev/null differ diff --git a/Source/RomDsk/sbc_propio/RTC.COM b/Source/RomDsk/sbc_propio/RTC.COM deleted file mode 100644 index b36725f3..00000000 Binary files a/Source/RomDsk/sbc_propio/RTC.COM and /dev/null differ diff --git a/Source/RomDsk/sbc_propio/XM.COM b/Source/RomDsk/sbc_propio/XM.COM deleted file mode 100644 index abcc6828..00000000 Binary files a/Source/RomDsk/sbc_propio/XM.COM and /dev/null differ diff --git a/Source/RomDsk/sbc_propio/XM5.COM b/Source/RomDsk/sbc_propio/XM5.COM deleted file mode 100644 index 8ea2b661..00000000 Binary files a/Source/RomDsk/sbc_propio/XM5.COM and /dev/null differ diff --git a/Source/RomDsk/sbc_rf/1200.COM b/Source/RomDsk/sbc_rf/1200.COM deleted file mode 100644 index d00960b0..00000000 Binary files a/Source/RomDsk/sbc_rf/1200.COM and /dev/null differ diff --git a/Source/RomDsk/sbc_rf/38400.COM b/Source/RomDsk/sbc_rf/38400.COM deleted file mode 100644 index 6d81bc17..00000000 Binary files a/Source/RomDsk/sbc_rf/38400.COM and /dev/null differ diff --git a/Source/RomDsk/sbc_rf/9600.COM b/Source/RomDsk/sbc_rf/9600.COM deleted file mode 100644 index 4727badf..00000000 Binary files a/Source/RomDsk/sbc_rf/9600.COM and /dev/null differ diff --git a/Source/RomDsk/sbc_rf/RTC.COM b/Source/RomDsk/sbc_rf/RTC.COM deleted file mode 100644 index b36725f3..00000000 Binary files a/Source/RomDsk/sbc_rf/RTC.COM and /dev/null differ diff --git a/Source/RomDsk/sbc_rf/VT3.COM b/Source/RomDsk/sbc_rf/VT3.COM deleted file mode 100644 index 6290a6d3..00000000 Binary files a/Source/RomDsk/sbc_rf/VT3.COM and /dev/null differ diff --git a/Source/RomDsk/sbc_rf/XM.COM b/Source/RomDsk/sbc_rf/XM.COM deleted file mode 100644 index abcc6828..00000000 Binary files a/Source/RomDsk/sbc_rf/XM.COM and /dev/null differ diff --git a/Source/RomDsk/sbc_rf/XM5.COM b/Source/RomDsk/sbc_rf/XM5.COM deleted file mode 100644 index 8ea2b661..00000000 Binary files a/Source/RomDsk/sbc_rf/XM5.COM and /dev/null differ diff --git a/Source/RomDsk/sbc_std/1200.COM b/Source/RomDsk/sbc_std/1200.COM deleted file mode 100644 index d00960b0..00000000 Binary files a/Source/RomDsk/sbc_std/1200.COM and /dev/null differ diff --git a/Source/RomDsk/sbc_std/38400.COM b/Source/RomDsk/sbc_std/38400.COM deleted file mode 100644 index 6d81bc17..00000000 Binary files a/Source/RomDsk/sbc_std/38400.COM and /dev/null differ diff --git a/Source/RomDsk/sbc_std/9600.COM b/Source/RomDsk/sbc_std/9600.COM deleted file mode 100644 index 4727badf..00000000 Binary files a/Source/RomDsk/sbc_std/9600.COM and /dev/null differ diff --git a/Source/RomDsk/sbc_std/VT3.COM b/Source/RomDsk/sbc_std/VT3.COM deleted file mode 100644 index 6290a6d3..00000000 Binary files a/Source/RomDsk/sbc_std/VT3.COM and /dev/null differ diff --git a/Source/RomDsk/sbc_std/XM.COM b/Source/RomDsk/sbc_std/XM.COM deleted file mode 100644 index abcc6828..00000000 Binary files a/Source/RomDsk/sbc_std/XM.COM and /dev/null differ diff --git a/Source/RomDsk/sbc_std/XM5.COM b/Source/RomDsk/sbc_std/XM5.COM deleted file mode 100644 index 8ea2b661..00000000 Binary files a/Source/RomDsk/sbc_std/XM5.COM and /dev/null differ diff --git a/Source/RomDsk/sbc_vdu/1200.COM b/Source/RomDsk/sbc_vdu/1200.COM deleted file mode 100644 index d00960b0..00000000 Binary files a/Source/RomDsk/sbc_vdu/1200.COM and /dev/null differ diff --git a/Source/RomDsk/sbc_vdu/38400.COM b/Source/RomDsk/sbc_vdu/38400.COM deleted file mode 100644 index 6d81bc17..00000000 Binary files a/Source/RomDsk/sbc_vdu/38400.COM and /dev/null differ diff --git a/Source/RomDsk/sbc_vdu/9600.COM b/Source/RomDsk/sbc_vdu/9600.COM deleted file mode 100644 index 4727badf..00000000 Binary files a/Source/RomDsk/sbc_vdu/9600.COM and /dev/null differ diff --git a/Source/RomDsk/sbc_vdu/RTC.COM b/Source/RomDsk/sbc_vdu/RTC.COM deleted file mode 100644 index b36725f3..00000000 Binary files a/Source/RomDsk/sbc_vdu/RTC.COM and /dev/null differ diff --git a/Source/RomDsk/sbc_vdu/XM.COM b/Source/RomDsk/sbc_vdu/XM.COM deleted file mode 100644 index abcc6828..00000000 Binary files a/Source/RomDsk/sbc_vdu/XM.COM and /dev/null differ diff --git a/Source/RomDsk/sbc_vdu/XM5.COM b/Source/RomDsk/sbc_vdu/XM5.COM deleted file mode 100644 index 8ea2b661..00000000 Binary files a/Source/RomDsk/sbc_vdu/XM5.COM and /dev/null differ diff --git a/Source/RomDsk/una_std/XM-A0.COM b/Source/RomDsk/una_std/XM-A0.COM deleted file mode 100644 index 6afb31f3..00000000 Binary files a/Source/RomDsk/una_std/XM-A0.COM and /dev/null differ diff --git a/Source/RomDsk/una_std/XM-A1.COM b/Source/RomDsk/una_std/XM-A1.COM deleted file mode 100644 index 42a67c31..00000000 Binary files a/Source/RomDsk/una_std/XM-A1.COM and /dev/null differ diff --git a/Source/RomDsk/una_std/XM.COM b/Source/RomDsk/una_std/XM.COM deleted file mode 100644 index abcc6828..00000000 Binary files a/Source/RomDsk/una_std/XM.COM and /dev/null differ diff --git a/Source/RomDsk/una_std/XM5-A0.COM b/Source/RomDsk/una_std/XM5-A0.COM deleted file mode 100644 index e233bee9..00000000 Binary files a/Source/RomDsk/una_std/XM5-A0.COM and /dev/null differ diff --git a/Source/RomDsk/una_std/XM5-A1.COM b/Source/RomDsk/una_std/XM5-A1.COM deleted file mode 100644 index 625e06ac..00000000 Binary files a/Source/RomDsk/una_std/XM5-A1.COM and /dev/null differ diff --git a/Source/RomDsk/una_std/XM5.COM b/Source/RomDsk/una_std/XM5.COM deleted file mode 100644 index 8ea2b661..00000000 Binary files a/Source/RomDsk/una_std/XM5.COM and /dev/null differ diff --git a/Source/RomDsk/zeta2_ppide/1200.COM b/Source/RomDsk/zeta2_ppide/1200.COM deleted file mode 100644 index d00960b0..00000000 Binary files a/Source/RomDsk/zeta2_ppide/1200.COM and /dev/null differ diff --git a/Source/RomDsk/zeta2_ppide/38400.COM b/Source/RomDsk/zeta2_ppide/38400.COM deleted file mode 100644 index 6d81bc17..00000000 Binary files a/Source/RomDsk/zeta2_ppide/38400.COM and /dev/null differ diff --git a/Source/RomDsk/zeta2_ppide/9600.COM b/Source/RomDsk/zeta2_ppide/9600.COM deleted file mode 100644 index 4727badf..00000000 Binary files a/Source/RomDsk/zeta2_ppide/9600.COM and /dev/null differ diff --git a/Source/RomDsk/zeta2_ppide/PPIDETST.COM b/Source/RomDsk/zeta2_ppide/PPIDETST.COM deleted file mode 100644 index 1cfc72b7..00000000 Binary files a/Source/RomDsk/zeta2_ppide/PPIDETST.COM and /dev/null differ diff --git a/Source/RomDsk/zeta2_ppide/RTC.COM b/Source/RomDsk/zeta2_ppide/RTC.COM deleted file mode 100644 index b36725f3..00000000 Binary files a/Source/RomDsk/zeta2_ppide/RTC.COM and /dev/null differ diff --git a/Source/RomDsk/zeta2_ppide/XM.COM b/Source/RomDsk/zeta2_ppide/XM.COM deleted file mode 100644 index abcc6828..00000000 Binary files a/Source/RomDsk/zeta2_ppide/XM.COM and /dev/null differ diff --git a/Source/RomDsk/zeta2_ppide/XM5.COM b/Source/RomDsk/zeta2_ppide/XM5.COM deleted file mode 100644 index 8ea2b661..00000000 Binary files a/Source/RomDsk/zeta2_ppide/XM5.COM and /dev/null differ diff --git a/Source/RomDsk/zeta2_ppisd/1200.COM b/Source/RomDsk/zeta2_ppisd/1200.COM deleted file mode 100644 index d00960b0..00000000 Binary files a/Source/RomDsk/zeta2_ppisd/1200.COM and /dev/null differ diff --git a/Source/RomDsk/zeta2_ppisd/38400.COM b/Source/RomDsk/zeta2_ppisd/38400.COM deleted file mode 100644 index 6d81bc17..00000000 Binary files a/Source/RomDsk/zeta2_ppisd/38400.COM and /dev/null differ diff --git a/Source/RomDsk/zeta2_ppisd/9600.COM b/Source/RomDsk/zeta2_ppisd/9600.COM deleted file mode 100644 index 4727badf..00000000 Binary files a/Source/RomDsk/zeta2_ppisd/9600.COM and /dev/null differ diff --git a/Source/RomDsk/zeta2_ppisd/FD.COM b/Source/RomDsk/zeta2_ppisd/FD.COM deleted file mode 100644 index 214698d4..00000000 Binary files a/Source/RomDsk/zeta2_ppisd/FD.COM and /dev/null differ diff --git a/Source/RomDsk/zeta2_ppisd/RTC.COM b/Source/RomDsk/zeta2_ppisd/RTC.COM deleted file mode 100644 index b36725f3..00000000 Binary files a/Source/RomDsk/zeta2_ppisd/RTC.COM and /dev/null differ diff --git a/Source/RomDsk/zeta2_ppisd/XM.COM b/Source/RomDsk/zeta2_ppisd/XM.COM deleted file mode 100644 index abcc6828..00000000 Binary files a/Source/RomDsk/zeta2_ppisd/XM.COM and /dev/null differ diff --git a/Source/RomDsk/zeta2_ppisd/XM5.COM b/Source/RomDsk/zeta2_ppisd/XM5.COM deleted file mode 100644 index 8ea2b661..00000000 Binary files a/Source/RomDsk/zeta2_ppisd/XM5.COM and /dev/null differ diff --git a/Source/RomDsk/zeta2_ppp/1200.COM b/Source/RomDsk/zeta2_ppp/1200.COM deleted file mode 100644 index d00960b0..00000000 Binary files a/Source/RomDsk/zeta2_ppp/1200.COM and /dev/null differ diff --git a/Source/RomDsk/zeta2_ppp/38400.COM b/Source/RomDsk/zeta2_ppp/38400.COM deleted file mode 100644 index 6d81bc17..00000000 Binary files a/Source/RomDsk/zeta2_ppp/38400.COM and /dev/null differ diff --git a/Source/RomDsk/zeta2_ppp/9600.COM b/Source/RomDsk/zeta2_ppp/9600.COM deleted file mode 100644 index 4727badf..00000000 Binary files a/Source/RomDsk/zeta2_ppp/9600.COM and /dev/null differ diff --git a/Source/RomDsk/zeta2_ppp/FD.COM b/Source/RomDsk/zeta2_ppp/FD.COM deleted file mode 100644 index 214698d4..00000000 Binary files a/Source/RomDsk/zeta2_ppp/FD.COM and /dev/null differ diff --git a/Source/RomDsk/zeta2_ppp/RTC.COM b/Source/RomDsk/zeta2_ppp/RTC.COM deleted file mode 100644 index b36725f3..00000000 Binary files a/Source/RomDsk/zeta2_ppp/RTC.COM and /dev/null differ diff --git a/Source/RomDsk/zeta2_ppp/TSTPPP.COM b/Source/RomDsk/zeta2_ppp/TSTPPP.COM deleted file mode 100644 index 761e43e1..00000000 Binary files a/Source/RomDsk/zeta2_ppp/TSTPPP.COM and /dev/null differ diff --git a/Source/RomDsk/zeta2_ppp/XM.COM b/Source/RomDsk/zeta2_ppp/XM.COM deleted file mode 100644 index abcc6828..00000000 Binary files a/Source/RomDsk/zeta2_ppp/XM.COM and /dev/null differ diff --git a/Source/RomDsk/zeta2_ppp/XM5.COM b/Source/RomDsk/zeta2_ppp/XM5.COM deleted file mode 100644 index 8ea2b661..00000000 Binary files a/Source/RomDsk/zeta2_ppp/XM5.COM and /dev/null differ diff --git a/Source/RomDsk/zeta2_std/1200.COM b/Source/RomDsk/zeta2_std/1200.COM deleted file mode 100644 index d00960b0..00000000 Binary files a/Source/RomDsk/zeta2_std/1200.COM and /dev/null differ diff --git a/Source/RomDsk/zeta2_std/38400.COM b/Source/RomDsk/zeta2_std/38400.COM deleted file mode 100644 index 6d81bc17..00000000 Binary files a/Source/RomDsk/zeta2_std/38400.COM and /dev/null differ diff --git a/Source/RomDsk/zeta2_std/9600.COM b/Source/RomDsk/zeta2_std/9600.COM deleted file mode 100644 index 4727badf..00000000 Binary files a/Source/RomDsk/zeta2_std/9600.COM and /dev/null differ diff --git a/Source/RomDsk/zeta2_std/FD.COM b/Source/RomDsk/zeta2_std/FD.COM deleted file mode 100644 index 214698d4..00000000 Binary files a/Source/RomDsk/zeta2_std/FD.COM and /dev/null differ diff --git a/Source/RomDsk/zeta2_std/RTC.COM b/Source/RomDsk/zeta2_std/RTC.COM deleted file mode 100644 index b36725f3..00000000 Binary files a/Source/RomDsk/zeta2_std/RTC.COM and /dev/null differ diff --git a/Source/RomDsk/zeta2_std/XM.COM b/Source/RomDsk/zeta2_std/XM.COM deleted file mode 100644 index abcc6828..00000000 Binary files a/Source/RomDsk/zeta2_std/XM.COM and /dev/null differ diff --git a/Source/RomDsk/zeta2_std/XM5.COM b/Source/RomDsk/zeta2_std/XM5.COM deleted file mode 100644 index 8ea2b661..00000000 Binary files a/Source/RomDsk/zeta2_std/XM5.COM and /dev/null differ diff --git a/Source/RomDsk/zeta_ppide/1200.COM b/Source/RomDsk/zeta_ppide/1200.COM deleted file mode 100644 index d00960b0..00000000 Binary files a/Source/RomDsk/zeta_ppide/1200.COM and /dev/null differ diff --git a/Source/RomDsk/zeta_ppide/38400.COM b/Source/RomDsk/zeta_ppide/38400.COM deleted file mode 100644 index 6d81bc17..00000000 Binary files a/Source/RomDsk/zeta_ppide/38400.COM and /dev/null differ diff --git a/Source/RomDsk/zeta_ppide/9600.COM b/Source/RomDsk/zeta_ppide/9600.COM deleted file mode 100644 index 4727badf..00000000 Binary files a/Source/RomDsk/zeta_ppide/9600.COM and /dev/null differ diff --git a/Source/RomDsk/zeta_ppide/PPIDETST.COM b/Source/RomDsk/zeta_ppide/PPIDETST.COM deleted file mode 100644 index 1cfc72b7..00000000 Binary files a/Source/RomDsk/zeta_ppide/PPIDETST.COM and /dev/null differ diff --git a/Source/RomDsk/zeta_ppide/RTC.COM b/Source/RomDsk/zeta_ppide/RTC.COM deleted file mode 100644 index b36725f3..00000000 Binary files a/Source/RomDsk/zeta_ppide/RTC.COM and /dev/null differ diff --git a/Source/RomDsk/zeta_ppide/XM.COM b/Source/RomDsk/zeta_ppide/XM.COM deleted file mode 100644 index abcc6828..00000000 Binary files a/Source/RomDsk/zeta_ppide/XM.COM and /dev/null differ diff --git a/Source/RomDsk/zeta_ppide/XM5.COM b/Source/RomDsk/zeta_ppide/XM5.COM deleted file mode 100644 index 8ea2b661..00000000 Binary files a/Source/RomDsk/zeta_ppide/XM5.COM and /dev/null differ diff --git a/Source/RomDsk/zeta_ppisd/1200.COM b/Source/RomDsk/zeta_ppisd/1200.COM deleted file mode 100644 index d00960b0..00000000 Binary files a/Source/RomDsk/zeta_ppisd/1200.COM and /dev/null differ diff --git a/Source/RomDsk/zeta_ppisd/38400.COM b/Source/RomDsk/zeta_ppisd/38400.COM deleted file mode 100644 index 6d81bc17..00000000 Binary files a/Source/RomDsk/zeta_ppisd/38400.COM and /dev/null differ diff --git a/Source/RomDsk/zeta_ppisd/9600.COM b/Source/RomDsk/zeta_ppisd/9600.COM deleted file mode 100644 index 4727badf..00000000 Binary files a/Source/RomDsk/zeta_ppisd/9600.COM and /dev/null differ diff --git a/Source/RomDsk/zeta_ppisd/FD.COM b/Source/RomDsk/zeta_ppisd/FD.COM deleted file mode 100644 index ef602c05..00000000 Binary files a/Source/RomDsk/zeta_ppisd/FD.COM and /dev/null differ diff --git a/Source/RomDsk/zeta_ppisd/RTC.COM b/Source/RomDsk/zeta_ppisd/RTC.COM deleted file mode 100644 index b36725f3..00000000 Binary files a/Source/RomDsk/zeta_ppisd/RTC.COM and /dev/null differ diff --git a/Source/RomDsk/zeta_ppisd/XM.COM b/Source/RomDsk/zeta_ppisd/XM.COM deleted file mode 100644 index abcc6828..00000000 Binary files a/Source/RomDsk/zeta_ppisd/XM.COM and /dev/null differ diff --git a/Source/RomDsk/zeta_ppisd/XM5.COM b/Source/RomDsk/zeta_ppisd/XM5.COM deleted file mode 100644 index 8ea2b661..00000000 Binary files a/Source/RomDsk/zeta_ppisd/XM5.COM and /dev/null differ diff --git a/Source/RomDsk/zeta_ppp/1200.COM b/Source/RomDsk/zeta_ppp/1200.COM deleted file mode 100644 index d00960b0..00000000 Binary files a/Source/RomDsk/zeta_ppp/1200.COM and /dev/null differ diff --git a/Source/RomDsk/zeta_ppp/38400.COM b/Source/RomDsk/zeta_ppp/38400.COM deleted file mode 100644 index 6d81bc17..00000000 Binary files a/Source/RomDsk/zeta_ppp/38400.COM and /dev/null differ diff --git a/Source/RomDsk/zeta_ppp/9600.COM b/Source/RomDsk/zeta_ppp/9600.COM deleted file mode 100644 index 4727badf..00000000 Binary files a/Source/RomDsk/zeta_ppp/9600.COM and /dev/null differ diff --git a/Source/RomDsk/zeta_ppp/FD.COM b/Source/RomDsk/zeta_ppp/FD.COM deleted file mode 100644 index ef602c05..00000000 Binary files a/Source/RomDsk/zeta_ppp/FD.COM and /dev/null differ diff --git a/Source/RomDsk/zeta_ppp/RTC.COM b/Source/RomDsk/zeta_ppp/RTC.COM deleted file mode 100644 index b36725f3..00000000 Binary files a/Source/RomDsk/zeta_ppp/RTC.COM and /dev/null differ diff --git a/Source/RomDsk/zeta_ppp/TSTPPP.COM b/Source/RomDsk/zeta_ppp/TSTPPP.COM deleted file mode 100644 index 761e43e1..00000000 Binary files a/Source/RomDsk/zeta_ppp/TSTPPP.COM and /dev/null differ diff --git a/Source/RomDsk/zeta_ppp/XM.COM b/Source/RomDsk/zeta_ppp/XM.COM deleted file mode 100644 index abcc6828..00000000 Binary files a/Source/RomDsk/zeta_ppp/XM.COM and /dev/null differ diff --git a/Source/RomDsk/zeta_ppp/XM5.COM b/Source/RomDsk/zeta_ppp/XM5.COM deleted file mode 100644 index 8ea2b661..00000000 Binary files a/Source/RomDsk/zeta_ppp/XM5.COM and /dev/null differ diff --git a/Source/RomDsk/zeta_std/1200.COM b/Source/RomDsk/zeta_std/1200.COM deleted file mode 100644 index d00960b0..00000000 Binary files a/Source/RomDsk/zeta_std/1200.COM and /dev/null differ diff --git a/Source/RomDsk/zeta_std/38400.COM b/Source/RomDsk/zeta_std/38400.COM deleted file mode 100644 index 6d81bc17..00000000 Binary files a/Source/RomDsk/zeta_std/38400.COM and /dev/null differ diff --git a/Source/RomDsk/zeta_std/9600.COM b/Source/RomDsk/zeta_std/9600.COM deleted file mode 100644 index 4727badf..00000000 Binary files a/Source/RomDsk/zeta_std/9600.COM and /dev/null differ diff --git a/Source/RomDsk/zeta_std/FD.COM b/Source/RomDsk/zeta_std/FD.COM deleted file mode 100644 index ef602c05..00000000 Binary files a/Source/RomDsk/zeta_std/FD.COM and /dev/null differ diff --git a/Source/RomDsk/zeta_std/RTC.COM b/Source/RomDsk/zeta_std/RTC.COM deleted file mode 100644 index b36725f3..00000000 Binary files a/Source/RomDsk/zeta_std/RTC.COM and /dev/null differ diff --git a/Source/RomDsk/zeta_std/XM.COM b/Source/RomDsk/zeta_std/XM.COM deleted file mode 100644 index abcc6828..00000000 Binary files a/Source/RomDsk/zeta_std/XM.COM and /dev/null differ diff --git a/Source/RomDsk/zeta_std/XM5.COM b/Source/RomDsk/zeta_std/XM5.COM deleted file mode 100644 index 8ea2b661..00000000 Binary files a/Source/RomDsk/zeta_std/XM5.COM and /dev/null differ diff --git a/Source/UBIOS/COPYING b/Source/UBIOS/COPYING new file mode 100644 index 00000000..5b244d55 --- /dev/null +++ b/Source/UBIOS/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + 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. + + + Copyright (C) + + 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 . + +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: + + Copyright (C) + 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 +. + + 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 +. + diff --git a/Source/UBIOS/ReadMe.txt b/Source/UBIOS/ReadMe.txt new file mode 100644 index 00000000..55b65521 --- /dev/null +++ b/Source/UBIOS/ReadMe.txt @@ -0,0 +1,6 @@ +The UNA BIOS Firmware is a product of John Coffman. + +Current releases, source code, and usage information is found on +the RetroBrew Computers Wiki: + +https://www.retrobrewcomputers.org/ \ No newline at end of file diff --git a/Source/UBIOS/ubios.inc b/Source/UBIOS/ubios.inc index fd6bec43..580ec42b 100644 --- a/Source/UBIOS/ubios.inc +++ b/Source/UBIOS/ubios.inc @@ -14,8 +14,6 @@ BF_DIOWRITE .EQU BF_DIO + 3 ; DISK WRITE ; ; MEMORY BANK CONFIGURATION ; -#IFDEF PLTUNA - ROMSIZE .EQU 512 RAMSIZE .EQU 512 @@ -37,5 +35,3 @@ BID_AUX .EQU BID_RAMN - 3 ; AUX BANK (BPBIOS, ETC.) BID_BIOS .EQU BID_RAMN - 2 ; BIOS BANK BID_USR .EQU BID_RAMN - 1 ; USER BANK (CP/M TPA, ETC.) BID_COM .EQU BID_RAMN ; COMMON BANK, UPPER 32K - -#ENDIF diff --git a/Tools/FixPowerShell.cmd b/Tools/FixPowerShell.cmd deleted file mode 100644 index 8da28217..00000000 --- a/Tools/FixPowerShell.cmd +++ /dev/null @@ -1,29 +0,0 @@ -@echo off -echo By default, PowerShell is configured to block the -echo execution of unsigned scripts on your local system. -echo This command file will attempt to modify your -echo PowerShell ExecutionPolicy to "Unrestricted" -echo which means that local scripts can be run without -echo being signed. This is required to use the RomWBW -echo build process. -echo. -PowerShell -command Write-Host "Your PowerShell ExecutionPolicy is currently set to: `'(Get-ExecutionPolicy)`'" -echo. -echo In order to modify the ExecutionPolicy, this command -echo file *MUST* be run with administrator privileges. -echo Generally, this means you want to right-click the -echo command file called FixPowerShell.cmd and choose -echo "Run as Administrator". If you attempt to continue -echo without administrator privileges, the modification -echo will fail with an error message, but no harm is done. -echo. -choice /m "Do you want to proceed" -if errorlevel 2 goto :eof -echo. -echo Attempting to change Execution Policy... -echo. -PowerShell Set-ExecutionPolicy Unrestricted -echo. -PowerShell -command Write-Host "Your new PowerShell ExecutionPolicy is now set to: `'(Get-ExecutionPolicy)`'" -echo. -pause \ No newline at end of file diff --git a/Tools/ReadMe.txt b/Tools/ReadMe.txt new file mode 100644 index 00000000..a66323e4 --- /dev/null +++ b/Tools/ReadMe.txt @@ -0,0 +1,76 @@ +*********************************************************************** +*** *** +*** R o m W B W *** +*** *** +*** Z80/Z180 System Software *** +*** *** +*********************************************************************** + +This directory ("Tools") is part of the RomWBW System Software +distribution archive. It is the root directory for a series of +programs that are used during the RomWBW build process. These +tools are included here as a convenience and their individual +licenses are unaltered by their inclusion here. + +ansicon: + +ANSICON provides ANSI escape sequences for Windows console +programs. It provides much the same functionality as 'ANSI.SYS' +does for MS-DOS. + +bst: + +The bst tool set is a multi-platform set of tools for developing +with the Parallax Propeller microcontroller. bst stands for +“Brad's Spin Tool”, however it is never capitalised. This toolset +is used to compile the Propeller firmware for PropIO and +ParPortProp. + +cpm: + +This is the root of a directory tree containing CP/M-80 programs. +These programs are used (via the Windows CP/M command line +emulator 'zx') to build certain components of RomWBW. The use of +real CP/M-80 programs as part of the build process ensures proper +construction of these components. + +cpmtools: + +This is a package of tools that allow a CP/M file system image to +be created and managed from a Windows command line. These tools +are used to construct CP/M file system images included with the +RomWBW distribution including the ROM disk image, floppy images, +and hard disk images. + +hex2bin: + +A pair of programs by John Coffman to translate between Intel hex +file format and pure binary images. + +rawwritewin: + +Program which can be used to write a floppy disk image to an +actual floppy disk. + +simh: + +A Z80 simulator for Windows. This simulator allows RomWBW ROM +images to be tested on Windows, if desired. + +tasm32: + +A cross-compiler that runs on Windows and assembles standard +Z80-based source files. This tool is the primary assembler for +the RomWBW HBIOS. + +Win32 Disk Imager: + +Program which can read or write hard disk images directly to or +from CF Cards or SD Cards. + +zx: + +A port of zxcc for Windows. This program is a command line +CP/M-80 emulator. It allows many CP/M-80 programs to run directly +from a Windows command prompt. This tool is used to run the CP/M +programs in the cpm directory listed above. \ No newline at end of file diff --git a/Tools/ansicon/ANSI32.dll b/Tools/ansicon/ANSI32.dll new file mode 100644 index 00000000..4a4ecd14 Binary files /dev/null and b/Tools/ansicon/ANSI32.dll differ diff --git a/Tools/ansicon/ANSI64.dll b/Tools/ansicon/ANSI64.dll new file mode 100644 index 00000000..9ad84456 Binary files /dev/null and b/Tools/ansicon/ANSI64.dll differ diff --git a/Tools/ansicon/ReadMe.txt b/Tools/ansicon/ReadMe.txt new file mode 100644 index 00000000..b092aa34 --- /dev/null +++ b/Tools/ansicon/ReadMe.txt @@ -0,0 +1,465 @@ + + ANSICON + + Copyright 2005-2013 Jason Hood + + Version 1.66. Freeware + + +Description +=========== + + ANSICON provides ANSI escape sequences for Windows console programs. It + provides much the same functionality as 'ANSI.SYS' does for MS-DOS. + + +Requirements +============ + + 32-bit: Windows 2000 Professional and later (it won't work with NT or 9X). + 64-bit: Vista and later (it won't work with XP64). + + +Installation +============ + + Add "x86" (if your OS is 32-bit) or "x64" (if 64-bit) to your PATH, or copy + the relevant files to a directory already on the PATH. Alternatively, use + option '-i' (or '-I', if permitted) to install it permanently, by adding an + entry to CMD.EXE's AutoRun registry value (current user or local machine, + respectively). + + Uninstall simply involves closing any programs that are currently using it; + running with '-u' (and/or '-U') to remove it from AutoRun; removing the + directory from PATH; and deleting the files. No other changes are made + (although you may have also created environment variables). + +Upgrading +--------- + + Delete ANSI.dll, it has been replaced with ANSI32.dll. + Delete ANSI-LLA.exe and ANSI-LLW.exe, they are no longer used. + Uninstall a pre-1.50 version and reinstall with this version. + + +Usage +===== + + Options (case sensitive): + + -l Log to "%TEMP%\ansicon.log". + + -p Enable the parent process (i.e. the command shell used to run + ANSICON) to recognise escapes. + + -m Set the current (and default) attribute to grey on black + ("monochrome"), or the attribute following the 'm' (please + use 'COLOR /?' for attribute values). + + -e Echo the command line - a space or tab after the 'e' is + ignored, the remainder is displayed verbatim. + + -E As above, but no newline is added. + + -t Display ("type") each file (or standard input if none or the + name is "-") as though they are a single file. + + -T Display "==> FILE NAME <==", a blank line (or an error + message), the file and another blank line. + + Running ANSICON with no arguments will start a new instance of the command + processor (the program defined by the 'ComSpec' environment variable, typ- + ically 'CMD.EXE'), or display standard input if it is redirected. Any arg- + ument will be treated as a program and its arguments. + + E.g.: 'ansicon -m30 -t file.ans' will display "file.ans" using black on + cyan as the default color. + + The attribute may start with '-' to permanently reverse the foreground and + background colors (but not when using '-p'). E.g.: 'ansicon -m-f0 -t + file.log' will use reversed black on white as the default (i.e. white on + black, with foreground sequences changing the background). + + If you experience trouble with certain programs, the log may help in find- + ing the cause; it can be found at "%TEMP%\ansicon.log". A number should + follow the 'l': + + 0 No logging + 1 Log process start and end + 2 Above, plus log modules used by the process + 3 Above, plus log functions that are hooked + 4 Log console output (add to any of the above) + 8 Append to the existing file (add to any of the above) + 16 Log all imported modules (add to any of the above) + + The log option will not work with '-p'; set the environment variable + ANSICON_LOG instead. The variable is only read once when a new process is + started; changing it won't affect running processes. If you identify a + module that causes problems, add it to the ANSICON_EXC environment variable + (see ANSICON_API below, but the extension is required). + + E.g.: 'ansicon -l5' will start a new command processor, logging every pro- + cess it starts along with their output. + + Once installed, the ANSICON environment variable will be created. This + variable is of the form "WxH (wxh)", where 'W' & 'H' are the width and + height of the buffer and 'w' & 'h' are the width and height of the window. + The variable is updated whenever a program reads it directly (i.e. as an + individual request, not as part of the entire environment block). For + example, 'set an' will not update it, but 'echo %ansicon%' will. Also + created is ANSICON_VER, which contains the version without the point (1.50 + becomes "150"). This variable does not exist as part of the environment + block ('set an' will not show it). + + If installed, GUI programs will not be hooked. Either start the program + directly with 'ansicon', or add it to the ANSICON_GUI variable (see + ANSICON_API below). + + Using 'ansicon' after install will always start with the default attrib- + utes, restoring the originals on exit; all other programs will use the cur- + rent attributes. The shift state is always reset for a new process. + + The Windows API WriteFile and WriteConsoleA functions will set the number + of characters written, not the number of bytes. When using a multibyte + character set, this results in a smaller number (since multiple bytes are + used to represent a single character). Some programs recognise this as a + reduced write and will inadvertently repeat previous characters. If you + discover such a program, use the ANSICON_API environment variable to record + it and override the API, returning the original byte count. Ruby (prior to + 1.9.3) is an example of such a program, so use 'set ANSICON_API=ruby' to + avoid the repitition. The full syntax is: + + ANSICON_API=[!]program;program;program... + + PROGRAM is the name of the program, with no path and extension. The lead- + ing exclamation inverts the usage, meaning the API will always be over- + ridden, unless the program is in the list. The variable can be made perm- + anent by going to System Properties, selecting the Advanced tab (with Vista + onwards, this can be done by running "SystemPropertiesAdvanced") and click- + ing Environment Variables. + + +Sequences Recognised +==================== + + The following escape sequences are recognised. + + \e]0;titleBEL Set (xterm) window's title (and icon) + \e[21t Report (xterm) window's title + \e[s Save Cursor + \e[u Restore Cursor + \e[#G CHA Cursor Character Absolute + \e[#E CNL Cursor Next Line + \e[#F CPL Cursor Preceding Line + \e[#D CUB Cursor Left + \e[#B CUD Cursor Down + \e[#C CUF Cursor Right + \e[#;#H CUP Cursor Position + \e[#A CUU Cursor Up + \e[#P DCH Delete Character + \e[?25h DECTCEM DEC Text Cursor Enable Mode (show cursor) + \e[?25l DECTCEM DEC Text Cursor Enable Mode (hide cursor) + \e[#M DL Delete Line + \e[#n DSR Device Status Report + \e[#X ECH Erase Character + \e[#J ED Erase In Page + \e[#K EL Erase In Line + \e[#` HPA Character Position Absolute + \e[#j HPB Character Position Backward + \e[#a HPR Character Position Forward + \e[#;#f HVP Character And Line Position + \e[#@ ICH Insert Character + \e[#L IL Insert Line + SI LS0 Locking-shift Zero (see below) + SO LS1 Locking-shift One + \e[#;#;#m SGR Select Graphic Rendition + \e[#d VPA Line Position Absolute + \e[#k VPB Line Position Backward + \e[#e VPR Line Position Forward + + '\e' represents the escape character (ASCII 27); '#' represents a decimal + number (optional, in most cases defaulting to 1); BEL, SO and SI are ASCII + 7, 14 and 15. Regarding SGR: bold will set the foreground intensity; blink + and underline will set the background intensity; conceal uses background as + foreground. See "sequences.txt" for a more complete description. + + I make a distinction between '\e[m' and '\e[0;...m'. Both will restore the + original foreground/background colors (and so '0' should be the first para- + meter); the former will also restore the original bold and underline attri- + butes, whilst the latter will explicitly reset them. The environment var- + iable ANSICON_DEF can be used to change the default colors (same value as + '-m'; setting the variable does not change the current colors). + + +Sequences Ignored +================= + + The following escape sequences are explicitly ignored. + + \e(? Designate G0 character set ('?' is any character). + \e)? Designate G1 character set ('?' is any character). + \e[?... Private sequence + \e[>... Private sequence + + The G0 character set is always ASCII; the G1 character set is always the + DEC Special Graphics Character Set. + + +DEC Special Graphics Character Set +================================== + + This is my interpretation of the set, as shown by + http://vt100.net/docs/vt220-rm/table2-4.html. + + + Char Unicode Code Point & Name + ---- ------------------------- + _ U+0020 Space (blank) + ` U+2666 Black Diamond Suit + a U+2592 Medium Shade + b U+2409 Symbol For Horizontal Tabulation + c U+240C Symbol For Form Feed + d U+240D Symbol For Carriage Return + e U+240A Symbol For Line Feed + f U+00B0 Degree Sign + g U+00B1 Plus-Minus Sign + h U+2424 Symbol For Newline + i U+240B Symbol For Vertical Tabulation + j U+2518 Box Drawings Light Up And Left + k U+2510 Box Drawings Light Down And Left + l U+250C Box Drawings Light Down And Right + m U+2514 Box Drawings Light Up And Right + n U+253C Box Drawings Light Vertical And Horizontal + o U+00AF Macron (SCAN 1) + p U+25AC Black Rectangle (SCAN 3) + q U+2500 Box Drawings Light Horizontal (SCAN 5) + r U+005F Low Line (SCAN 7) + s U+005F Low Line (SCAN 9) + t U+251C Box Drawings Light Vertical And Right + u U+2524 Box Drawings Light Vertical And Left + v U+2534 Box Drawings Light Up And Horizontal + w U+252C Box Drawings Light Down And Horizontal + x U+2502 Box Drawings Light Vertical + y U+2264 Less-Than Or Equal To + z U+2265 Greater-Than Or Equal To + { U+03C0 Greek Small Letter Pi + | U+2260 Not Equal To + } U+00A3 Pound Sign + ~ U+00B7 Middle Dot + + G1.txt is a Unicode file to view the glyphs "externally". G1.bat is a + batch file (using 'x86\ansicon') to show the glyphs in the console. The + characters will appear as they should using Lucida (other than the Sym- + bols), but code page will influence them when using a raster font (but of + particular interest, 437 and 850 both show the Box Drawings). + + +Limitations +=========== + + The entire console buffer is used, not just the visible window. + + There's a conflict with NVIDIA's drivers, requiring the setting of the + Environment Variable: + + ANSICON_EXC=nvd3d9wrap.dll;nvd3d9wrapx.dll + + +Version History +=============== + + Legend: + added, - bug-fixed, * changed. + + 1.66 - 20 September, 2013: + - fix 32-bit process trying to detect 64-bit process. + + 1.65 - 4 September, 2013: + - fix finding 32-bit LoadLibraryW address from 64-bit; + - fix \e[K (was using window, not buffer). + + 1.64 - 2 August, 2013: + - improved detection of console output. + + 1.63 - 25 July, 2013: + - don't write the reset sequence (when it's already installed) if output is + redirected. + + 1.62 - 18 July, 2013: + - indicate if opening HKLM failed; + * removed ANSI-LLW.exe again, properly this time; + * add the architecture (32- or 64-bit) to the log. + + 1.61 - 14 February, 2013: + * revert back to using ANSI-LLW.exe, as the new method was unreliable. + + 1.60 - 24 November, 2012: + * new method to get the 32-bit LoadLibraryW address from 64-bit code. + This removes the need for ANSI-LLW.exe, which caused lots of virus + warnings, for some reason. + - set the code page to display some file names properly; + + expand wildcards for -t (ignoring directories and hidden/binary files). + + 1.53 - 12 June, 2012: + - fix for multiple simultaneous process creation (e.g. "cl /MP ..."). + + 1.52 - 2 June, 2012: + + 32-bit processes can inject into 64-bit processes; + + implemented \e[39m & \e[49m (set default foreground/background color); + + added \e[#X, \e[#`, \e[#a, \e[#d, \e[#e, \[e#j and \e[#k; + * changed sequence descriptions to those in ECMA-48, ordered by acronym. + + 1.51 - 24 February, 2012: + - fixed installing into a piped/redirected CMD.EXE; + - fixed 32-bit process trying to identify a 64-bit process; + - ignore version within core API DLL names (now Win8 works); + + hook _lwrite & _hwrite (now Silverfrost FTN95 v6.20 works). + + 1.50 - 14 December, 2011: + - -u does not imply -p; + - return the program's exit code; + - -p by itself will not restore original color; + - output error messages to stderr; + * logging is always available, with various levels; include the pid; + * don't automatically hook GUI programs, use 'ansicon' or ANSICON_GUI; + * always place first in AutoRun; don't run if already installed; + + global reverse video capability; + + added ANSICON_VER to provide version/install test; + + added ANSICON_EXC to exclude selected modules; + + added ANSICON_DEF to explicitly set the default SGM. + + 1.40 - 1 March, 2011: + - hook GetProcAddress (now PowerShell works); + + add SO/SI, using the DEC Special Graphics Character Set for G1; + + add DECTCEM to show/hide the cursor. + + 1.32 - 22 December, 2010: + - fixed crash due to NULL lpNumberOfBytesWritten/lpNumberOfCharsWritten; + - -p will test the parent process for validity; + * hook into GUI processes; + + recognise DSR and xterm window title sequences; + - fixed MinGW32 binaries (LLW was wrong). + + 1.31 - 19 November, 2010: + - fixed multibyte support (no extra junk with UTF-8 files); + * provide workaround for API byte/character differences; + * fixed potential problem if install path uses Unicode. + + 1.30 - 7 September, 2010: + + x64 version. + + 1.25 - 22 July, 2010: + - hook LoadLibraryEx (now CScript works); + - fixed -i when AutoRun existed, but was empty; + + support for Windows 7; + + -I (and -U) use HKEY_LOCAL_MACHINE. + + 1.24 - 7 January, 2010: + - fix -t and -e when ANSICON was already running; + + read standard input if redirected with no arguments, if -t has no + files, or if the name is "-" (which also serves as a workaround for + programs that don't get hooked, such as CScript). + + 1.23 - 11 November, 2009: + - restore hooked functions when unloading; + - reverse the "bold" and "underline" settings; + * conceal characters by making foreground color same as background. + + 1.22 - 5 October, 2009: + - hook LoadLibrary to inject into applications started via association. + + 1.21 - 23 September, 2009: + + -i (and -u) option to add (remove) entry to AutoRun value. + + 1.20 - 21 June, 2009: + * use another injection method; + + create ANSICON environment variable; + + -e (and -E) option to echo the command line (without newline); + + -t (and -T) option to type (display) files (with file name). + + 1.15 - 17 May, 2009: + - fix output corruption for long (over 8192 characters) ANSI strings. + + 1.14 - 3 April, 2009: + - fix the test for an empty import section (eg. XCOPY now works). + + 1.13 - 21 & 27 March, 2009: + * use a new injection method (to work with DEP); + * use Unicode. + + 1.12 - 9 March, 2009: + - fix processing child programs (generate a relocatable DLL). + + 1.11 - 28 February, 2009: + - fix processing child programs (only use for console executables). + + 1.10 - 22 February, 2009: + - fix output corruption (buffer overflow in MyConsoleWriteW); + - recognise current screen attributes as current ANSI atrributes; + - ignore Ctrl+C and Ctrl+Break; + + process child programs. + + 1.01 - 12 March, 2006: + * \e[m will restore original color, not set grey on black; + + -m option to set default (and initial) color; + - restore original color on exit; + - disable escape processing when console has disabled processed output; + + \e[5m (blink) is the same as \e[4m (underline); + - do not conceal control characters (0 to 31). + + 1.00 - 23 October, 2005: + + initial release. + + +Acknowledgments +=============== + + Jean-Louis Morel, for his Perl package Win32::Console::ANSI. It provided + the basis of 'ANSI.dll'. + + Sergey Oblomov (hoopoepg), for Console Manager. It provided the basis of + 'ansicon.exe'. + + Anton Bassov's article "Process-wide API spying - an ultimate hack" in "The + Code Project". + + Richard Quadling - his persistence in finding bugs has made ANSICON what it + is today. + + Dmitry Menshikov, Marko Bozikovic and Philippe Villiers, for their assis- + tance in making the 64-bit version a reality. + + Luis Lavena and the Ruby people for additional improvements. + + Leigh Hebblethwaite for documentation tweaks. + + Vincent Fatica for pointing out \e[K was not right. + + +Contact +======= + + mailto:jadoxa@yahoo.com.au + http://ansicon.adoxa.vze.com/ + https://github.com/adoxa/ansicon + + Jason Hood + 11 Buckle Street + North Rockhampton + Qld 4701 + Australia + + +Distribution +============ + + The original zipfile can be freely distributed, by any means. However, I + would like to be informed if it is placed on a CD-ROM (other than an arch- + ive compilation; permission is granted, I'd just like to know). Modified + versions may be distributed, provided it is indicated as such in the ver- + sion text and a source diff is made available. In particular, the supplied + binaries are freely redistributable. A formal license (zlib) is available + in LICENSE.txt. + + +=============================== +Jason Hood, 20 September, 2013. diff --git a/Tools/ansicon/ansicon.exe b/Tools/ansicon/ansicon.exe new file mode 100644 index 00000000..84f210e3 Binary files /dev/null and b/Tools/ansicon/ansicon.exe differ diff --git a/Tools/cpm/bin/GENCPM.COM b/Tools/cpm/bin/GENCPM.COM new file mode 100644 index 00000000..d1c872c2 Binary files /dev/null and b/Tools/cpm/bin/GENCPM.COM differ diff --git a/Tools/cpm/bin/NULU.COM b/Tools/cpm/bin/NULU.COM index fc5594b1..3d45098a 100644 Binary files a/Tools/cpm/bin/NULU.COM and b/Tools/cpm/bin/NULU.COM differ diff --git a/Tools/cpm/bin/UCRLZH.COM b/Tools/cpm/bin/UCRLZH.COM new file mode 100644 index 00000000..7a435c91 Binary files /dev/null and b/Tools/cpm/bin/UCRLZH.COM differ diff --git a/Tools/cpm/bin/UNZIP.COM b/Tools/cpm/bin/UNZIP.COM new file mode 100644 index 00000000..b231bf47 Binary files /dev/null and b/Tools/cpm/bin/UNZIP.COM differ diff --git a/Tools/zx/COPYING b/Tools/zx/COPYING new file mode 100644 index 00000000..a43ea212 --- /dev/null +++ b/Tools/zx/COPYING @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 675 Mass Ave, Cambridge, MA 02139, USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) 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 +this service 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 make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. 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. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute 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 and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +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 +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the 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 a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, 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. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE 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. + + END OF TERMS AND CONDITIONS + + Appendix: 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 +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) 19yy + + 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 2 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, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision 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, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This 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 Library General +Public License instead of this License. diff --git a/Tools/zx/ReadMe.txt b/Tools/zx/ReadMe.txt new file mode 100644 index 00000000..90a7b1c3 --- /dev/null +++ b/Tools/zx/ReadMe.txt @@ -0,0 +1,12 @@ +ZX Command + +An adaptation of zxcc-0.5.6 by Wayne Warthen + +This is simply a stripped down variant of John Elliott's zxcc package that +runs under a Windows command line (32 or 64 bit Windows). It contains +only one command, "zx", which is generally equivalent to the original +zxcc command. + +Please see http://www.seasip.info/Unix/Zxcc/ for more information on zxcc. + +Refer to the zx.html document for usage information. diff --git a/Tools/zx/zx-src.zip b/Tools/zx/zx-src.zip new file mode 100644 index 00000000..cb9e929a Binary files /dev/null and b/Tools/zx/zx-src.zip differ diff --git a/Tools/zx/zx.exe b/Tools/zx/zx.exe index a7f67259..bde1d36f 100644 Binary files a/Tools/zx/zx.exe and b/Tools/zx/zx.exe differ diff --git a/Tools/zx/zx.html b/Tools/zx/zx.html index e7658b8e..b425ee1e 100644 --- a/Tools/zx/zx.html +++ b/Tools/zx/zx.html @@ -1,200 +1,131 @@ -zx v0.5.2 +zx CP/M Command Line Emulator -

zx v0.5.2

+

zx CP/M Command Line Emulator

-

zx is a wrapper for the Hi-Tech C CP/M compiler, allowing it to -be used as a cross-compiler under UNIX. Version 0.5.0 also works with the build -tools necessary to assemble CP/M 3 (MAC, RMAC, LINK, GENCOM). +

zx allows execution of CP/M 2.2 and 3.X application from a +Windows command line. It is compatible with Windows XP and greater (both +32 and 64 bit).

+ +

zx is basically a port of a subset of the zxcc package by John Elliott. +The GPLv2 licensing carries forward. Please refer to the + +zxcc web page for more information.

+ +

While the original zxcc package was generally intended to allow +execution of the Hi-Tech C CP/M compiler under Unix, zx is slightly +more general and intended to allow running most CP/M tools. Specific +changes were incorporated to improve interactice console operation of +CP/M applications.

+ +

Setup

+ +

The zx application (zx.exe) may be copied to any directory for execution. +The bios.bin file must be copied to the same directory. For ease of use, +you will probably want the directory to part of your PATH environment +variable so that you can run the tool from any location.

+ +

You will also need the CP/M applications that you want to run. +zx will load files fromthe current directory or one of the following +directories based on file type. Any of the following environment +variables may be defined to determine where zx searches for the +respective file types:

-

New in this version:

    -
  • Compiles on boxes where sync() does not return int (reported by multiple -users). -
  • BDOS function 10 takes a pointer to unsigned char, thus allowing input -buffers longer than 128 bytes (Andy Parkins) +
  • ZXBINDIR may contain a single path which will +be searched for executable files (usually *.com)
  • +
  • ZXLIBDIR may contain a single path which will +be search for library files (usually *.lib)
  • +
  • ZXINCDIR may contain a single path which will +be searched for include files (usually *.inc)
-

Setting up

- -

Firstly, build the compiler. It should not be necessary to rebuild bios.bin; -but if you have to, it assembles using the z80asm assembler (part of -the z80pack emulation package which can be found on the Walnut Creek -CP/M CDROM) or the -ZMAC assembler -(downloadable from <http://www.nenie.org/cpcip/index.html#zmac>). -

Previous versions of ZX could be compiled under DOS using -DJGPP; this may still be possible, but has not been tested since the build -system was changed to use the GNU autotools. - -

This version of zx contains copies of the CPMIO and CPMREDIR libraries, -so you won't need to obtain them separately. - -

You will need the tools you want to use; either the Hi-Tech C compiler for -CP/M <http://www.hitech.com.au> - -or Digital Research's tools at - -<http://www.cpm.z80.de> - -Once you have obtained the tools, documentation and possibly the library -source, you need to decide where to put the files. zx uses -three directories: - -

    -
  • BINDIR80 (by default, /usr/local/lib/cpm/bin80) - holds the compiler itself. You should copy the compiler .com files - (or MAC, RMAC etc.) and bios.bin to this directory. -
  • LIBDIR80 (by default, /usr/local/lib/cpm/lib80) - holds the C libraries libc.lib, libf.lib, crtcpm.obj and rrtcpm.obj. -
  • INCDIR80 (by default, /usr/local/lib/cpm/include80) - holds the compiler .h files. -
- -

The locations of these directories are normally set by the configure -script; you can override them by editing zx.h and uncommenting the lines -that redefine them. - -

Once you have installed zx and the build tools, try -building Hello World: - -

-#include <stdio.h>
-void main()
-{
- printf("Hello World\n");
-}
-
- -or for RMAC: - -
- CSEG
-
- LXI D,HELLO
- MVI C,9
- CALL 5
- RST 0
-
-HELLO: DB 'Hello World',13,10,'$' - -
- -

To compile the first example, type

zxc hello.c
; if -all goes well, you should end up with a file called hello.com. You can -test the resulting file by typing
zx hello.com
. - -

To assemble the second example, type -

- zx rmac.com hello
- zx link.com hello -
-and run it as above. NOTE: RMAC requires that lines be terminated with CR/LF. -You may need to put a unix2dos command in your makefile before you invoke RMAC. +

Usage

-

Using zx

+

In general CP/M applications are executed by prefixing the CP/M command +line with "zx". So for example, you could assemble a test.asm using +rmac with a command line like:

-

For detailed instructions, see the documentation for Hi-Tech C or -the CP/M tools. zx behaves in the same way, but note the -following points: +

zx rmac hello
-

Program names

+

In this case, rmac.com would need to be in the directory specified by +environment variable ZXBINDIR or in the current directory. Also, +hello.asm would need to be in the current directory.

-

The names of the programs have been changed between CP/M and UNIX; for -example, you would type

zxc hello.c
instead of -
c hello.c
. The programs to use are: +

Filenames

-
-
zxc
The equivalent of C.COM. -
zxas
The equivalent of ZAS.COM. -
zxlink
The equivalent of LINK.COM. -
zxlibr
The equivalent of LIBR.COM. -
+

Where you would normally enter a CP/M filename you instead enter +a Windows filename. Note that you will need to use a forward slash +instead of the traditional backslash as a directory separator. The +filename itself (as opposed to any directories in +its path) must obey CP/M 8.3 naming conventions.

-

All these programs work by converting their arguments to a form suitable -for zx, and then invoking zx. +

Where the documentation requires a CP/M drive letter/user number +you should enter a path complete with trailing slash, for example:

+
-I/usr/src/linux-80/include/
-

There are no front-end programs for the CP/M build tools; you will have to -enter arguments to these in the zx format given below. +

Technical

-

Filenames

+

zx emulates a subset of CP/M 3; hopefully enough to run the +most CP/M tools. It can be used as a limited general-purpose CP/M 3 +emulator provided the emulated program only uses a common subset of +system calls.

-

Where the documentation allows you to enter a CP/M filename, you should -instead enter a UNIX one. The filename itself (as opposed to any directories in -its path) must obey CP/M 8.3 naming conventions and be all lowercase. -

Where the documentation requires a CP/M driveletter / user number -

-I2:C:
you should enter a path complete with - trailing slash:
-I/usr/src/linux-80/include/
+

Syntax for zx is:

-

Technical

+
+zx comfile.com arg1 arg2 ... +
+ +

The comfile is the program to run; zx searches the current +directory and ZXBINDIR for it.

+ +

The arguments are parsed in this way:

+ +
    +
  • Any argument starting with a - sign is passed to the CP/M program as-is, +minus the leading - sign. +
  • Any argument starting with a + sign is parsed as a filename (see below) +and then concatenated to the previous argument. +
  • Any argument starting "+-" is concatenated without being parsed. +
  • All other arguments are parsed as filenames. The path is +converted to a CP/M driveletter. +
+ +

For example: +

+zx foo.com --Q -A /src/main --I +/src/sub +-, +/foo/bar +
+ +

would pass these arguments to foo.com:

+ +
+-Q A d:main -Id:sub,e:bar +
-

zx emulates a subset of CP/M 3; hopefully enough to run the -Hi-Tech C compiler. It can be used as a limited general-purpose CP/M 3 -emulator provided the emulated program only uses a restricted subset of -system calls. -

zx behaves like the emulator com, allowing CP/M -programs to be used transparently from a UNIX prompt. However com: -

    -
  • Emulates all of CP/M 2, rather than a subset of CP/M 3; -
  • Is designed for general use, not tailored to Hi-Tech C; -
  • Is written partly in assembly language and will only run on 68000-based -computers; -
  • Cannot map UNIX directories to CP/M drives; -
  • Contains some bugs connected with command parsing and file I/O. -
- -

Syntax for zx is: - -

- zx comfile.com arg1 arg2 ... -
- -

The comfile is the program to run; zx searches the current -directory and BINDIR80 for it. -

The arguments are parsed in this way: - -

    -
  • Any argument starting with a - sign is passed to the CP/M program as-is, - minus the leading - sign. -
  • Any argument starting with a + sign is parsed as a filename (see below) - and then concatenated to the previous argument. -
  • Any argument starting "+-" is concatenated without being parsed. -
  • All other arguments are parsed as filenames. The UNIX pathname is - converted to a CP/M driveletter. -
-

For example: -

- zx foo.com --Q -A /dev/null --I +/dev/zero +-, +/foo/bar -
-would pass these arguments to foo.com: -
- -Q A d:null -Id:zero,e:bar -
- -

The other programs are merely wrappers that convert their command lines -into the form required by zx. +

The other programs are merely wrappers that convert their command lines +into the form required by zx.

Errors

-

Any errors raised by the zx runtime system will be prefixed -with zx:. Some errors you may encounter are: - -

-
Unsupported BDOS call -
Part of CP/M 3 that the program uses has not been emulated. Add the -required functionality to zxbdos.c and recompile. -
Z80 encountered invalid trap -
The CP/M program being run attempted to call the zx runtime -system with an unknown call number. This will happen if the program was -written for my emulator "Joyce". -
-

Acknowledgements

- -
    -
  • Hi-Tech C was written by Hi-Tech Software. -
  • The Z80 emulation engine was written by Ian Collier. -
  • Thanks to Jacob Nevins, Andy Parkins and others for bug fix suggestions. -
-
-
John Elliott, 28 March 2003
+

Any errors raised by the zx runtime system will be prefixed +with zx:. Some errors you may encounter are:

+ +
+
Unsupported BDOS call
+
Part of CP/M 3 that the program uses has not been emulated. Add the +required functionality to zxbdos.c and recompile.
+
Z80 encountered invalid trap
+
The CP/M program being run attempted to call the zx runtime +system with an unknown call number.
+
+ +

Acknowledgements

+ +
    +
  • zxcc was written by John Elliott
  • +
  • Hi-Tech C was written by Hi-Tech Software.
  • +
  • The Z80 emulation engine was written by Ian Collier.
  • +
  • Thanks to Jacob Nevins, Andy Parkins and others for bug fix suggestions.
  • +
diff --git a/Tools/zx/zxdbg.exe b/Tools/zx/zxdbg.exe index b59e7a5b..11a5864d 100644 Binary files a/Tools/zx/zxdbg.exe and b/Tools/zx/zxdbg.exe differ